import { Property, IProperty } from './Property.js';
import { Server, IServer } from './Server.js';
import { IThing, Thing } from './Thing.js';
import { ARCVariable } from './legacy/models/Variable.js';
import { IRequestAuthorization, RequestAuthorization } from './RequestAuthorization.js';
export declare const Kind = "Core#Environment";
export interface IEnvironmentCloneOptions {
    /**
     * By default it revalidates (re-creates) keys in the environment.
     * Set this to true to not make any changes to the keys.
     */
    withoutRevalidate?: boolean;
}
/**
 * A project environment definition.
 */
export interface IEnvironment {
    kind: typeof Kind;
    /**
     * The identifier of the environment.
     */
    key: string;
    /**
     * The environment's meta info.
     */
    info: IThing;
    /**
     * The server's definition for the environment.
     * When a server is defined for the environment then all request that have no
     * absolute URL will inherit this server configuration.
     */
    server?: IServer;
    /**
     * The variables added to this project.
     * It overrides application defined variables.
     */
    variables: IProperty[];
    /**
     * When set this configuration does not allow to be extended by the parent object's environment configuration.
     * By default an environment can be extended by the parent object's values.
     */
    encapsulated?: boolean;
    /**
     * The security to be applied to all requests that are going to this environment.
     */
    authorization?: IRequestAuthorization[];
}
/**
 * An environment is applied to a project or a folder.
 * It consists of a list of variables and a server configuration.
 * This allows to apply the runtime configuration just by changing the environment.
 */
export declare class Environment {
    kind: string;
    key: string;
    /**
     * The name of the environment.
     */
    info: Thing;
    /**
     * The variables added to this project.
     * It overrides application defined variables.
     */
    variables: Property[];
    /**
     * The server's definition for the environment.
     * When a server is defined for the environment then all request that have no
     * absolute URL will inherit this server configuration.
     */
    server?: Server;
    /**
     * When set this configuration does not allow to be extended by the parent object's environment configuration.
     * By default an environment can be extended by the parent object's values.
     *
     * When encapsulation is disabled you can, for example, skip server definition and only overwrite variables.
     */
    encapsulated: boolean;
    /**
     * The security to be applied to all requests that are going to this server.
     */
    authorization?: RequestAuthorization[];
    /**
     * Creates a new Environment object from a name.
     *
     * @param name The name to set.
     */
    static fromName(name: string): Environment;
    static fromLegacyVariables(name: string, variables: ARCVariable[]): Environment;
    /**
     * @param input The environment definition used to restore the state.
     */
    constructor(input?: string | IEnvironment);
    /**
     * Creates a new environment clearing anything that is so far defined.
     *
     * Note, this throws an error when the environment is not an environment.
     */
    new(init: IEnvironment): void;
    /**
     * Checks whether the input is a definition of a environment.
     */
    static isEnvironment(input: unknown): boolean;
    toJSON(): IEnvironment;
    addVariable(name: string, value: unknown): Property;
    addVariable(variable: IProperty): Property;
    /**
     * Reads the server configuration.
     * @param force When set then it creates a server instance when missing.
     */
    getServer(force?: boolean): Server | undefined;
    /**
     * Adds a new server definition.
     * @param uriOrInfo Either URI to create the server from or the definition of the server.
     */
    addServer(uriOrInfo: string | IServer): Server;
    /**
     * Makes a copy of this environment
     * @param opts Cloning options.
     */
    clone(opts?: IEnvironmentCloneOptions): Environment;
    /**
     * Creates a map of variables from this environment.
     *
     * @param readStrategy The read strategy. When `lastWins` (default) then a variable with the same name overwrites
     *                     the previously set variable. The `firstWins` stops overwriting values once a variable is set.
     * @returns An object containing variables defined in this environment
     */
    variablesMap(readStrategy?: 'lastWins' | 'firstWins'): Record<string, string>;
    /**
     * @returns A list of unique properties. The last defined property wins (with the same name).
     */
    uniqueProperties(): Property[];
}
//# sourceMappingURL=Environment.d.ts.map