import { ProjectParent } from './ProjectParent.js';
import { IProjectDefinitionProperty } from './ProjectDefinitionProperty.js';
import { Environment, IEnvironment } from './Environment.js';
import { License, ILicense } from './License.js';
import { Provider, IProvider } from './Provider.js';
import { IThing } from './Thing.js';
import { ProjectItem, IProjectItem } from './ProjectItem.js';
import { IProjectFolder, ProjectFolder } from './ProjectFolder.js';
import { IProjectRequest, ProjectRequest } from './ProjectRequest.js';
import { ProjectSchema, IProjectSchema } from './ProjectSchema.js';
import { ARCSavedRequest, ARCHistoryRequest } from './legacy/request/ArcRequest.js';
import { ArcLegacyProject } from './legacy/models/ArcLegacyProject.js';
import { Certificate, HttpCertificate } from './ClientCertificate.js';
export declare const Kind = "Core#HttpProject";
export interface IItemOptions {
    /**
     * The parent folder of the item to.
     */
    parent?: string;
}
export interface IItemCreateOptions extends IItemOptions {
    /**
     * The position at which to add the item.
     */
    index?: number;
}
export interface IEnvironmentCreateOptions extends IItemCreateOptions {
}
/**
 * A list of options to initialize a project in various situations.
 */
export interface IProjectInitOptions {
    /**
     * The name of the project.
     */
    name: string;
}
export interface IFolderCreateOptions {
    /**
     * Ignores the operation when the folder with the same name already exists.
     * This command can be used used to ensure that the folder exists.
     */
    skipExisting?: boolean;
    /**
     * The id of the parent folder. When not set it adds the folder to the project root.
     */
    parent?: string;
    /**
     * Optionally the position at which to add the folder into the list of items.
     */
    index?: number;
}
export interface IFolderSearchOptions {
    /**
     * When set it searches for a folder using keys only.
     * By default it searches for a key and the name.
     */
    keyOnly?: boolean;
}
export interface IFolderDeleteOptions {
    /**
     * When set it won't throw an error when the folder is not found in the project.
     */
    safe?: boolean;
}
export interface IRequestAddOptions {
    /**
     * The id of the parent folder. When not set it adds the request to the project root.
     */
    parent?: string;
    /**
     * Optionally the position at which to add the request into the list of items.
     */
    index?: number;
}
export interface IRequestSearchOptions {
    /**
     * When set it searches for a request using keys only.
     * By default it searches for a key and the name.
     */
    keyOnly?: boolean;
}
export interface IRequestDeleteOptions {
    /**
     * When set it won't throw an error when the request is not found in the project.
     */
    safe?: boolean;
}
export interface IProjectMoveOptions {
    /**
     * The position at which to insert the object in the destination. BY default it adds the object at the end.
     */
    index?: number;
    /**
     * The name or the key of the parent folder to move the item into.
     * When not set it moves the item to the project's root.
     */
    parent?: string;
}
export interface IReadEnvironmentOptions extends IItemOptions {
    /**
     * The name or the key of the environment to select.
     *
     * When the name is not specified it selects:
     * - the first environment from the project, if any
     * - any parent folder's first environment to the requested folder, if any (if parent is set)
     * - the requested folder's first environment, if any (if parent is set)
     */
    nameOrKey?: string;
}
/**
 * The object stored as a list index for the projects.
 * This is used to list projects in the store and in the UI.
 */
export interface IHttpProjectIndex {
    key: string;
    name: string;
    version?: string;
}
export interface IProjectCloneOptions {
    /**
     * By default it revalidates (re-creates) keys in the request.
     * Set this to true to not make any changes to the keys.
     */
    withoutRevalidate?: boolean;
}
export interface IFolderListOptions {
    /**
     * Folder name or key to list folders for.
     */
    folder?: string;
}
export interface ISchemaAddOptions {
    /**
     * Optionally the position at which to add the schema into the list of schemas.
     */
    index?: number;
}
export interface IProjectRequestIterator {
    /**
     * The parent folder key or name. Sets the starting point to iterate over the requests.
     */
    parent?: string;
    /**
     * When set it includes requests in the current folder and sub-folder according to the order
     * defined in the folder.
     */
    recursive?: boolean;
    /**
     * Limits the number of requests to include in the iterator.
     * It is an array of request keys or names.
     */
    requests?: string[];
    /**
     * The opposite of the `requests`. The list of names or keys of requests or folders to ignore.
     * Note, ignore is tested before the `requests`.
     */
    ignore?: string[];
}
export interface IProjectFolderIterator {
    /**
     * The parent folder key or name. Sets the starting point to iterate over the folder.
     */
    parent?: string;
    /**
     * When set it includes folders in the current folder and sub-folder according to the order
     * defined in the folder.
     */
    recursive?: boolean;
    /**
     * The list of names or keys to ignore.
     */
    ignore?: string[];
}
export interface IProjectFolderIteratorResult {
    /**
     * The folder.
     */
    folder: ProjectFolder;
    /**
     * Optional parent key.
     */
    parent?: string;
    /**
     * How deep in the structure the folder is located.
     * The indent is relative to the `parent`.
     */
    indent: number;
}
/**
 * The new definition of a project in API Client.
 * Note, this is not the same as future `ApiProject` which is reserved for building APIs
 * using RAML or OAS.
 */
export interface IHttpProject extends IProjectDefinitionProperty {
    kind: typeof Kind;
    /**
     * The license information for this HTTP project.
     */
    license?: ILicense;
    /**
     * The basic information about the project.
     */
    info: IThing;
    /**
     * Information about project provider.
     */
    provider?: IProvider;
    /**
     * The ordered list of HTTP requests / folders in the projects.
     * The UI uses this to manipulate the view without changing the definitions.
     */
    items: IProjectItem[];
    /**
     * The project definitions.
     * This is where all the data are stored.
     */
    definitions: IHttpProjectDefinitions;
}
export interface IHttpProjectDefinitions {
    requests?: IProjectRequest[];
    folders?: IProjectFolder[];
    schemas?: IProjectSchema[];
    environments?: IEnvironment[];
    certificates?: HttpCertificate[];
}
interface HttpProjectDefinitions {
    requests: ProjectRequest[];
    folders: ProjectFolder[];
    schemas: ProjectSchema[];
    environments: Environment[];
    certificates: Certificate[];
}
/**
 * An instance of an HttpProject.
 */
export declare class HttpProject extends ProjectParent {
    kind: string;
    private initEnvironments?;
    /**
     * The license information for this HTTP project.
     */
    license?: License;
    /**
     * Information about project provider.
     */
    provider?: Provider;
    /**
     * The list of all requests stored in this project.
     * Note, this is not used to visualized the request in the UI.
     * This is just the source of data.
     * The `items` property is used to build the view.
     */
    definitions: HttpProjectDefinitions;
    static defaultDefinitions(): HttpProjectDefinitions;
    /**
     * Creates a new HTTP project from a name.
     * @param {string} name The name to set.
     */
    static fromName(name: string): HttpProject;
    /**
     * Creates an HTTP project instance from ARC's legacy project definition.
     */
    static fromLegacy(project: ArcLegacyProject, requests: ARCSavedRequest[]): Promise<HttpProject>;
    /**
     * Creates an HTTP project from a Postman collection
     * @param init The postman collection object or a string that can be parsed to one.
     */
    static fromPostman(init: any): Promise<HttpProject>;
    /**
     * Creates a new project from a set of options.
     */
    static fromInitOptions(init: IProjectInitOptions): HttpProject;
    /**
     * @param input The project definition used to restore the state.
     * @param environments Optional list of environments to use with this project. It overrides
     *                     environments stored in the project definition.
     */
    constructor(input?: string | IHttpProject, environments?: IEnvironment[]);
    /**
     * Creates a new project definition clearing anything that is so far defined.
     *
     * Note, this throws an error when the project is not an API Client project.
     */
    new(init: IHttpProject): void;
    toJSON(): IHttpProject;
    /**
     * @returns JSON representation of the project
     */
    toString(): string;
    /**
     * Finds a parent of a definition.
     *
     * @param  key The key of the definition.
     * @returns The parent or undefine when not found.
     */
    findParent(key: string): ProjectFolder | HttpProject | undefined;
    /**
     * Appends a new folder to the project or a sub-folder.
     *
     * Passing the folder schema as the fist argument is primarily used to insert a folder on the client side
     * after a folder was created in the store.
     *
     * @param init The name or a folder schema. When not set a default name is assumed.
     * @param opts Folder create options.
     * @returns The newly inserted folder. If the folder already existed it returns its instance.
     */
    addFolder(init?: string | IProjectFolder | ProjectFolder, opts?: IFolderCreateOptions): ProjectFolder;
    /**
     * Searches for a folder in the structure.
     *
     * @param nameOrKey The name or the key of the folder.
     * @param opts Optional search options.
     * @returns Found project folder or undefined.
     */
    findFolder(nameOrKey: string, opts?: IFolderSearchOptions): ProjectFolder | undefined;
    /**
     * Removes a folder from the project.
     * @param key The folder key. It ignores the name when searching to the folder to avoid ambiguity.
     * @param opts Folder remove options.
     * @returns The removed folder definition or undefined when not removed.
     */
    removeFolder(key: string, opts?: IFolderDeleteOptions): ProjectFolder | undefined;
    /**
     * Moves a folder between folders and the project or between items inside a folder or a project
     *
     * Note, when the `parent` option is not specified it moved the folder to the project's root.
     *
     * @param key The key of the request to move.
     * @param opts The moving options.
     */
    moveFolder(key: string, opts?: IProjectMoveOptions): void;
    /**
     * Checks whether a folder has a child (anywhere down the structure).
     *
     * @param child The **key** of the child.
     * @param folder The **key** of the folder. When not set it searches from the project root.
     * @returns True when the child is located somewhere down the structure.
     */
    hasChild(child: string, folder?: string): boolean;
    /**
     * Adds a request to the project or a sub-folder.
     * @param request The request to add.
     * @param opts Thew request add options.
     * @returns The inserted into the definitions request.
     */
    addRequest(request: IProjectRequest | ProjectRequest | string, opts?: IRequestAddOptions): ProjectRequest;
    /**
     * Adds a request to the project that has been created for a previous version of ARC.
     *
     * @param legacy The legacy request definition.
     * @returns The created project request.
     */
    addLegacyRequest(legacy: ARCSavedRequest | ARCHistoryRequest): Promise<ProjectRequest>;
    /**
     * Searches for a request in the project.
     *
     * @param nameOrKey The name or the key of the request.
     * @param opts Optional search options.
     * @returns Found project request or undefined.
     */
    findRequest(nameOrKey: string, opts?: IRequestSearchOptions): ProjectRequest | undefined;
    /**
     * Removes a request from the project.
     *
     * @param key The request key. It ignores the name when searching to the request to avoid ambiguity.
     * @param opts Request remove options.
     * @returns The removed request definition or undefined when not removed.
     */
    removeRequest(key: string, opts?: IRequestDeleteOptions): ProjectRequest | undefined;
    /**
     * Moves a request between folders and the project or between items inside a folder or a project.
     *
     * Note, when the `parent` option is not specified it moved the request to the project's root.
     *
     * @param key The key of the request to move.
     * @param opts The moving options.
     */
    moveRequest(key: string, opts?: IProjectMoveOptions): void;
    /**
     * Lists items (not the actual definitions!) that are folders.
     */
    listFolderItems(): ProjectItem[];
    /**
     * Lists items (not the actual definitions!) that are requests.
     */
    listRequestItems(): ProjectItem[];
    /**
     * Lists folders from the project or a sub-folder.
     * @param opts Folder listing options.
     */
    listFolders(opts?: IFolderListOptions): ProjectFolder[];
    /**
     * Lists requests in this project or a sub-folder.
     * @param folder The optional folder name or the key to list requests for.
     */
    listRequests(folder?: string): ProjectRequest[];
    /**
     * Lists definitions for the `items` of the project or a folder.
     * @param folder Optionally the folder name to list the definitions for.
     */
    listDefinitions(folder?: string): (ProjectFolder | ProjectRequest | Environment)[];
    /**
     * Makes sure the license information exists.
     * @returns The set license.
     */
    ensureLicense(): License;
    /**
     * Makes sure the Provider information exists.
     * @returns The set provider.
     */
    ensureProvider(): Provider;
    /**
     * @returns On the project level this always returns undefined.
     */
    getParent(): ProjectFolder | HttpProject | undefined;
    attachedCallback(): void;
    detachedCallback(): void;
    getProject(): HttpProject;
    /**
     * Makes a copy of this project.
     */
    clone(opts?: IProjectCloneOptions): HttpProject;
    static clone(project: IHttpProject, opts?: IProjectCloneOptions): HttpProject;
    /**
     * Re-generates keys in the project, taking care of the references.
     *
     * Note, this changes the project properties. Make a copy of the project before calling this.
     *
     * @param src The project instance to re-generate keys for.
     */
    static regenerateKeys(src: HttpProject): void;
    /**
     * Adds a request to the project or a sub-folder.
     * @param schema The schema to add or a name of the schema.
     * @param opts Thew schema add options.
     * @returns The inserted into the schemas schema.
     */
    addSchema(schema: IProjectSchema | ProjectSchema | string, opts?: ISchemaAddOptions): ProjectSchema;
    /**
     * @returns The current list of schemas in the project.
     */
    listSchemas(): ProjectSchema[];
    /**
     * Iterates over requests in the project.
     */
    requestIterator(opts?: IProjectRequestIterator): Generator<ProjectRequest>;
    /**
     * Iterates over folders in the project.
     *
     * @param opts Iterator configuration options
     * @param indent Used internally to add `indent` to the result
     * @returns Iterator that yields when a folder is found, including all sub-folders (if configured).
     */
    folderIterator(opts?: IProjectFolderIterator, indent?: number): Generator<IProjectFolderIteratorResult>;
    [Symbol.iterator](): Generator<ProjectRequest>;
    /**
     * Depending on the options returns a project or a folder.
     * It throws when parent folder cannot ber found.
     */
    protected _getRoot(opts: IItemOptions): ProjectFolder | HttpProject;
    protected _insertItem(item: ProjectItem, root: ProjectFolder | HttpProject, opts: IItemCreateOptions): void;
    /**
     * Adds an environment to the project.
     * @param env The name of the environment to create or its schema
     * @returns The same or created environment.
     */
    addEnvironment(env: IEnvironment | Environment | string, opts?: IEnvironmentCreateOptions): Environment;
    protected _createEnv(env: IEnvironment | Environment | string): Environment;
    /**
     * This is different to `readEnvironments()`. While the `readEnvironments()`
     * function generate a list of all environments that apply to a folder, this method
     * just lists this folder's environments.
     *
     * @returns The list of environments defined in this folder
     */
    getEnvironments(opts?: IItemOptions): Environment[];
    /**
     * @param key The environment key to read.
     */
    getEnvironment(key: string, opts?: IItemOptions): Environment | undefined;
    /**
     * Removes an environment from the folder or a sub-folder.
     *
     * @param key the key of the environment to remove
     * @returns The removed environment, if any.
     */
    removeEnvironment(key: string, opts?: IItemOptions): Environment | undefined;
    /**
     * This is a link to the `getEnvironments()`. The difference is that on the
     * project level it won't return environments defined with the class initialization.
     */
    listEnvironments(opts?: IItemOptions): Environment[];
    /**
     * Reads the list of environments from then selected folder up to the project root.
     * It stops going up in the project structure when selected environment has the `encapsulated`
     * property set to true.
     * The environments are ordered from the top-most level to the selected folder.
     *
     * @param opts The environment read options
     */
    readEnvironments(opts?: IReadEnvironmentOptions): Environment[];
    /**
     * Finds a definition for an environment regardless of its parent.
     *
     * @param key The Key of the environment to find.
     * @returns The environment definition or undefined if not found.
     */
    findEnvironment(key: string): Environment | undefined;
    /**
     * Finds a definition for a certificate.
     *
     * @param key The key of the certificate to find.
     * @returns The certificate definition or undefined if not found.
     */
    findCertificate(key: string): Certificate | undefined;
    /**
     * Adds a certificate to the project.
     *
     * @param init Either an instance of a certificate or its definition.
     * @returns The inserted certificate.
     */
    addCertificate(init: Certificate | HttpCertificate): Certificate;
    /**
     * Removes a certificate from the project.
     *
     * @param key the key of the certificate to remove
     * @returns The removed certificate, if any.
     */
    removeCertificate(key: string): Certificate | undefined;
    /**
     * Finds the requests that are using the certificate identified by the key.
     *
     * @param key The key of the certificate to find the usage for.
     * @returns The list of requests that use this certificate.
     */
    findCertificateRequests(key: string): ProjectRequest[];
}
export {};
//# sourceMappingURL=HttpProject.d.ts.map