import { ProjectDefinitionProperty, IProjectDefinitionProperty } from './ProjectDefinitionProperty.js';
import { ProjectFolder } from './ProjectFolder.js';
import { IHttpRequest } from './HttpRequest.js';
import { HttpProject } from './HttpProject.js';
import { IRequest, Request } from './Request.js';
import { Environment } from './Environment.js';
import { Property } from './Property.js';
import { RequestAuthorization } from './RequestAuthorization.js';
export declare const Kind = "Core#ProjectRequest";
export interface RequestUrlReadOptions {
    /**
     * When set it won't apply variables to the URL.
     */
    noVariables?: boolean;
    /**
     * When set is returns the only the base URL defined in the environment without
     * adding the `url` defined on the request object.   *
     */
    baseUrl?: boolean;
    /**
     * When set it uses these variables instead one the onces defined on the project.
     * When this is defined then `noVariables` has no effect.
     */
    variables?: Record<string, string>;
}
export interface IProjectRequest extends IProjectDefinitionProperty, IRequest {
    kind: typeof Kind;
    /**
     * The identifier of the request.
     */
    key: string;
    /**
     * The key of an environment defined on the project to apply to this request.
     * When not set it inherits environments from parents.
     * However, when this is set, it makes sure that server/variables from this environment are always applied.
     */
    environment?: string;
}
export interface IRequestCloneOptions {
    /**
     * By default it revalidates (re-creates) keys in the request.
     * Set this to true to not make any changes to the keys.
     */
    withoutRevalidate?: boolean;
    /**
     * By default it attaches the request to the same parent as the original request.
     * Set this to `true` when moving a request between projects to prevent adding the request to the project.
     * Note, the request still have a reference to the original project. You need to update the `project` property.
     */
    withoutAttach?: boolean;
}
/**
 * **Note about the payload.**
 *
 * The payload is **always** stored in the request object in its serialized form.
 * Use the `readPayload()` to read the correct data type and the `writePayload()` to
 * safely store the payload.
 */
export declare class ProjectRequest extends Request implements ProjectDefinitionProperty {
    kind: string;
    /**
     * The identifier of the request.
     */
    key: string;
    /**
     * A reference to the top level project object.
     */
    project: HttpProject;
    /**
     * The key of an environment defined on the project to apply to this request.
     * When not set it inherits environments from parents.
     * However, when this is set, it makes sure that server/variables from this environment are always applied.
     */
    environment?: string;
    /**
     * Checks whether the input is a definition of a project folder.
     */
    static isProjectRequest(input: unknown): boolean;
    /**
     * Creates a project request from an URL.
     * This does not manipulate the project.
     *
     * @param url The Request URL. This is required.
     * @param project The parent project.
     */
    static fromUrl(url: string, project?: HttpProject): ProjectRequest;
    /**
     * Creates a project request from a name.
     * This does not manipulate the project.
     *
     * @param name The Request name.
     * @param project The parent project.This is required.
     */
    static fromName(name: string, project?: HttpProject): ProjectRequest;
    /**
     * Creates a project request from an HttpRequest definition.
     * This does not manipulate the project.
     *
     * @param project The parent project This is required.
     * @param info The request data.
     */
    static fromHttpRequest(info: IHttpRequest, project?: HttpProject): ProjectRequest;
    /**
     * Creates a project request for a schema of a Request.
     */
    static fromRequest(request: IRequest, project: HttpProject): ProjectRequest;
    constructor(project: HttpProject, input?: string | IProjectRequest);
    new(init: IProjectRequest): void;
    toJSON(): IProjectRequest;
    /**
     * The callback called when the object is attached to a parent.
     * This is called when the object is created and inserted to a project or a folder
     * and when the object is moved between folders.
     */
    attachedCallback(): void;
    /**
     * The callback called when the object is detached from its parent.
     * This callback is called when the item is deleted from a folder or a project,
     * or when the item is about to be moved to another folder.
     */
    detachedCallback(): void;
    /**
     * @returns The instance of the HttpProject or a ProjectFolder that is a closes parent of this instance.
     */
    getParent(): ProjectFolder | HttpProject | undefined;
    /**
     * @returns A reference to the parent folder or the top-level HTTP project.
     */
    getProject(): HttpProject;
    /**
     * Removes this request from the project.
     */
    remove(): void;
    /**
     * Makes a copy of this request.
     * By default it attaches the copied request to the same parent.
     * Use the options dictionary to control this behavior.
     */
    clone(opts?: IRequestCloneOptions): ProjectRequest;
    /**
     * The static version of the `clone()` method.
     *
     * @param request The request schema to clone.
     * @param project The project to add the request to.
     * @param opts Optional options.
     * @returns The copied request.
     */
    static clone(request: IProjectRequest, project: HttpProject, opts?: IRequestCloneOptions): ProjectRequest;
    /**
     * @returns The environment that should be applied to the request, if any.
     */
    getEnvironment(): Environment | undefined;
    /**
     * @returns All environments that can be applied to this request.
     */
    readEnvironments(): Environment[];
    /**
     * It reads the URL from an environment defined for the request..
     * The environment servers and variables are applies for all environments defined on each folder down to this request.
     * This respects the `encapsulate` flag defined on an environment.
     *
     * By default it applies variables collected from the environments to the url. You can configure this behavior
     * by passing a configuration option.
     *
     * Note on performance.
     * This is a heave computing operation so use it sparingly. For best performance only compute the URL when
     * environments, environment selection or variables change.
     *
     * @param opts Read URL options
     * @returns the read URL or undefined when the URL/environments are not defined.
     */
    readUrl(opts?: RequestUrlReadOptions): string | undefined;
    protected addProperty(item: Property, list: Property[]): void;
    /**
     * Evaluates the URI against variables.
     *
     * Note, this doesn't throw errors. When error occurs it returns the input string.
     *
     * @param uri The URI to process
     * @param variables The list of variables to use
     * @returns Expanded URI.
     */
    protected evaluateUri(uri: string, variables?: Property[] | Record<string, string>): string;
    /**
     * Reads the authorization that should be applied to the request.
     *
     * 1) First it returns the locally (on the request) defined authorization.
     * 2) Then it returns authorization defined on the selected environment.
     * 3) If has defined environment but no authorization on it, then it returns empty array.
     * 4) Only if the request has no selected environment then it reads first environment
     * that has authorization (from the request up to the project's root).
     */
    readAuthorization(): RequestAuthorization[];
    /**
     * @returns Authorization defined on the selected environment or undefined.
     */
    protected readEnvironmentAuthorization(): RequestAuthorization[] | undefined;
    /**
     * @returns Authorization defined on any inherited environment or undefined.
     */
    protected readEnvironmentsAuthorization(): RequestAuthorization[] | undefined;
}
//# sourceMappingURL=ProjectRequest.d.ts.map