import { IBetterLogger } from "@codiac.io/codiac-common";
import { AtLeast } from '@codiac.io/codiac-common/contracts';
import { IOutputStyler, IUserInputProvider } from "../ops";
import { PromptChoice } from "../cli-common";
import { RootMap, EnterpriseRoot, EnvironmentRoot, CabinetClusterRoot, AssetTypesEnum, ClusterWithIngress, Asset } from "../apis/codiac-api/contracts";
export type TextValueParent = {
    text: string;
    value: string;
    children?: TextValueParent[];
};
/** For trees rendering/selecting environments. */
export interface IEnviroTreeEmbellisher {
    eachEnterprise: (entBranch: TextValueParent, ent: EnterpriseRoot, rootMap: RootMap) => void;
    eachEnviro: (envBranch: TextValueParent, env: EnvironmentRoot, ent: EnterpriseRoot, rootMap: RootMap) => void;
}
/** For trees rendering/selecting enviro|cluster pairings. */
export interface IEnviroClusterTreeEmbellisher extends IEnviroTreeEmbellisher {
    eachCluster: (clusterBranch: TextValueParent, cluster: ClusterWithIngress, env: EnvironmentRoot, ent: EnterpriseRoot, rootMap: RootMap) => void;
}
/** For trees rendering/selecting cabinets. */
export interface ICabinetTreeEmbellisher extends IEnviroTreeEmbellisher {
    eachCabinet: (cabBranch: TextValueParent, cab: CabinetClusterRoot, env: EnvironmentRoot, ent: EnterpriseRoot, rootMap: RootMap) => void;
}
/** Full designation of an environment and a cluster included in it. */
export type IEnviroClusterPair = {
    enterprise: string;
    environmentName: string;
    environment: EnvironmentRoot;
    cluster: string;
};
export declare class RootMapUiUtils {
    protected _ui: IUserInputProvider;
    protected styler: IOutputStyler;
    protected logger: IBetterLogger;
    constructor(_ui: IUserInputProvider, styler: IOutputStyler, logger: IBetterLogger);
    /** Validates the candidate's current value,
   * prompts the user if necessary,
   * mutates the candidate as needed,
   * and returns the applicable enterprise obj from the RootMap.
   *
   * Throws when unable to assign one,
   * so otherwise, candidate SHALL ALWAYS end up with an enterprise assigned.*/
    promptForEnterprise<TCandidate extends {
        enterprise?: string | undefined;
    }>(candidate: TCandidate, rootMap: RootMap): Promise<EnterpriseRoot>;
    /** Returns the ultiamate asset name and the flag telling whether the original user input was changed.
     *
     * @param type Must be pulled from asset record, but may be undefined.  MUST have this set for anything that's not a container service asset.
     * @param renderAutoSelected Writes a line showing the selected asset name when if none was specified and the one-and-only gets autoselected.
    */
    promptForAsset(assets: Pick<Asset, "name" | "type">[], current?: string | undefined, renderAutoSelected?: boolean): Promise<[string, boolean, AssetTypesEnum | undefined]>;
    /** Selects a cabinet from a tree view.
     *
     * @returns Cabinet object from RootMap and the environment name.
     * @param takeDefaults (optional, defaults to false) suppresses confirmation of default values when user has not provided any (but NOT when the user-supplied values were invalid and automatically CHANGED to a default).
     */
    promptForCabinet(enterprise: string, rootMap: RootMap, defaultValue?: string | undefined, takeDefaults?: boolean, embellisher?: ICabinetTreeEmbellisher): Promise<[CabinetClusterRoot, string]>;
    deriveEnvironmentFrom(enterprise: string, cabinet: string, rootMap: RootMap): EnvironmentRoot;
    /** Retrieves the cabinet object from the RootMap. */
    getCabinetInfrx(enterprise: string, environment: string, cabinet: string, rootMap: RootMap): CabinetClusterRoot;
    /** sets each value to "scope|target".
    *
    * @param embellisher  (optional) Adds custom content to each branch in the tree
    * */
    buildCabinetTree(rootMap: RootMap, embellisher?: ICabinetTreeEmbellisher): TextValueParent[];
    /**  */
    promptForEnviro(rootMap: RootMap, enterprise?: string, defaultEnviro?: string, takeDefaults?: boolean): Promise<EnvironmentRoot>;
    /**  */
    promptForEnviroCluster(rootMap: RootMap, enterpriseCode?: string, defaultEnviro?: string, defaultCluster?: string, takeDefaults?: boolean): Promise<[EnvironmentRoot, ClusterWithIngress]>;
    displayForEnv(enviro: EnvironmentRoot, showClusters?: boolean, hilite?: boolean): string;
    displayForEnvCluster(enviro: EnvironmentRoot, cluster: ClusterWithIngress): string;
    /** Selects a unique "enterprise|enviro|cluster?".
     *
     * @param embellisher  (optional) Adds custom content to each branch in the tree
     * */
    buildEnviroClusterTree(rootMap: RootMap, embellisher?: IEnviroClusterTreeEmbellisher): TextValueParent[];
    /** Detemines if the given environment exists within the given enterprise (via rootMap).
     * Hydrates the environment property if environmentName is valid.
     *
     * Mutates and returns the partial entity.
     * Throws any exceptions.
     */
    validateEnviro(partial: AtLeast<IEnviroClusterPair, "enterprise">, rootMap: RootMap): AtLeast<IEnviroClusterPair, "enterprise">;
    /** THrows on invalid.  Passthru for valid. */
    validateLocalVsRemoteCluster(partial: AtLeast<IEnviroClusterPair, "enterprise">, rootMap: RootMap): void;
    /** Detemines if the given cluster exists within the given rootMap.
     *
     * Mutates and returns the partial entity.
     * Throws any exceptions.
     */
    validateCluster(partial: AtLeast<IEnviroClusterPair, "enterprise">, rootMap: RootMap): AtLeast<IEnviroClusterPair, "enterprise">;
    /** Determines if the given environment exists within the given enterprise (via rootMap),
     * and whether the given cluster exists and is contained within the given environment.
     * An invalid or missing environment invalidates the cluster.
     *
     * Mutates and returns the partial entity.
     * Throws any exceptions.
     */
    validateEnviroCluster(partial: AtLeast<IEnviroClusterPair, "enterprise">, rootMap: RootMap): AtLeast<IEnviroClusterPair, "enterprise">;
    /** Truncates the string to the given length with an ellipses as suffix */
    protected ellipsis(maxLength: number, value: string): string;
    protected trimTreeLines(candidate: string): string;
    buildSelectChoicesFrom(tree: TextValueParent[]): PromptChoice[];
}
