// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\r // SPDX-License-Identifier: Apache-2.0 using System; namespace AWS.Deploy.CLI { /// /// encapsulates the input configuration /// when the user is asked to select an existing option or create new /// /// public class UserInputConfiguration { /// /// Func to select string property from the option type /// which is returned as the ID of the selected option. /// public Func IDSelector; /// /// Func to select string property from the option type /// which is displayed to the user. /// public Func DisplaySelector; /// /// Func to select default option from the options /// which is displayed as default option to the user. /// public Func DefaultSelector; /// /// The current value for the option setting. /// public object? CurrentValue; /// /// If true, ask for the new name /// /// Default is false /// public bool AskNewName { get; set; } /// /// If is set to true, /// then is displayed as the default new name to the user. /// public string DefaultNewName { get; set; } /// /// If is set to true, /// then an empty user input is considered as a valid value. /// /// Default is false /// public bool CanBeEmpty { get; set; } /// /// If is set to true, /// then a "Create New" option will be added to the list of valid options. /// public bool CreateNew { get; set; } = true; /// /// If is set to true, /// then an "Empty" option will be added to the list of valid options. /// public bool EmptyOption { get; set; } public UserInputConfiguration( Func idSelector, Func displaySelector, Func defaultSelector, string defaultNewName = "") { IDSelector = idSelector; DisplaySelector = displaySelector; DefaultSelector = defaultSelector; DefaultNewName = defaultNewName; } } }