import { PropertyValues, TemplateResult } from "lit";
import { IOAuth2Authorization, ApiDefinitions, IRequestAuthorization, IOauth2GrantType, AmfShapes, IApiCustomDomainProperty, IOAuth2CustomParameter } from "@api-client/core/build/browser.js";
import OAuth2Authorization from "../../authorization/ui/OAuth2Authorization.js";
import { AmfParameters } from "../../../amf/lib/AmfParameters.js";
import { OperationParameter } from "../../../amf/types.js";
import { BindingType } from "../../../amf/lib/AmfInputParser.js";
export default class AmfOauth2 extends OAuth2Authorization {
    /**
     * The in-memory key where the values are stored.
     */
    security?: ApiDefinitions.IApiParametrizedSecurityScheme;
    /**
     * @attribute
     */
    overrideAuthorizationUri?: string;
    /**
     * @attribute
     */
    overrideAccessTokenUri?: string;
    protected amfParameters: AmfParameters;
    constructor();
    protected willUpdate(cp: PropertyValues<this>): void;
    protected handleParamChange(): void;
    protected ensureConfig(): IRequestAuthorization;
    protected restoreValues(): void;
    serialize(): IOAuth2Authorization;
    setupOAuthDeliveryMethod(scheme?: ApiDefinitions.IApiSecurityScheme): void;
    /**
     * Determines placement of OAuth authorization token location.
     * It can be either query parameter or header. This function
     * reads API spec to get this information or provides default if
     * not specifies.
     *
     * @param info Security AMF model
     */
    getOauth2DeliveryMethod(info?: ApiDefinitions.IApiSecurityScheme): {
        method: string;
        name: string;
    };
    /**
     * Updates list of OAuth grant types supported by current endpoint.
     * The information should be available in RAML file.
     *
     * @param supportedTypes List of supported types. If empty
     * or not set then all available types will be displayed.
     */
    updateGrantTypes(supportedTypes?: string[]): void;
    /**
     * Computes list of grant types to render in the form.
     *
     * @param allowed List of types allowed by the
     * component configuration or API spec applied to this element. If empty
     * or not set then all OAuth 2.0 default types are returned.
     */
    computeGrantList(allowed?: string[]): IOauth2GrantType[];
    /**
     * It's quite a bit naive approach to determine whether given model is RAML's
     * or OAS'. There is a significant difference of how to treat grant types
     * (in OAS it is called flows). While in OAS it is mandatory to define a grant type
     * (a flow) RAML has no such requirement. By default this component assumes that
     * all standard (OAuth 2 defined) grant types are supported when grant types are not
     * defined. So it is possible to not define them and the component will work.
     * However, in the AMF model there's always at least one grant type (a flow) whether
     * it's RAML's or OAS' and whether grant type is defined or not.
     *
     * To apply correct settings this component needs to know how to process the data.
     * If it's OAS then when changing grant type it also changes current settings
     * (like scopes, auth uri, etc). If the model is RAML's then change in current grant type
     * won't trigger settings setup.
     *
     * Note, this function returns true when there's no flows whatsoever. It's not
     * really what it means but it is consistent with component's logic.
     *
     * Current method is deterministic and when AMF model change this most probably stop
     * working. It tests whether there's a single grant type and this grant type
     * has no AMF's `security:flow` property.
     *
     * @param flows List of current flows loaded with the AMF model.
     * @returns True if current model should be treated as RAML's model.
     */
    isRamlFlow(flows: ApiDefinitions.IApiSecurityOAuth2Flow[]): boolean;
    /**
     * Reads API security definition and applies in to the view as predefined
     * values.
     *
     * @param model AMF model describing settings of the security
     * scheme
     */
    preFillAmfData(model: ApiDefinitions.IApiSecurityOAuth2Settings): void;
    /**
     * API console supports an annotation with additional settings form the OAuth2 authorization
     * defined in https://github.com/raml-org/raml-annotations/blob/master/annotations/security-schemes/oauth-2-custom-settings.raml
     *
     * This reads (RAML) annotations to build the UI for these settings.
     *
     * @param model AMF model describing settings of the security scheme
     * @returns The extension definition or null
     */
    findOauth2CustomSettings(model: ApiDefinitions.IApiSecurityOAuth2Settings): IApiCustomDomainProperty | undefined;
    /**
     * Computes the final list of authorization grants defined in the spec and with applied annotation defined in
     * https://github.com/raml-org/raml-annotations/blob/master/annotations/security-schemes/oauth-2-custom-settings.raml
     *
     * @param grans The API spec annotation grants
     * @param customProperty The domain extension with the custom data
     * @returns The list of authorization grants to apply to the current operation.
     */
    computeGrants(customProperty?: IApiCustomDomainProperty, grans?: string[]): string[];
    /**
     * Pre-fills authorization data with OAS' definition of a grant type
     * which they call a flow. This method populates form with the information
     * find in the model.
     *
     * It tries to match a flow to currently selected `grantType`. When no match
     * then it takes first flow.
     *
     * Note, flow data are applied when `grantType` change.
     *
     * @param flows List of flows in the authorization description.
     */
    preFillFlowData(flows: ApiDefinitions.IApiSecurityOAuth2Flow[]): void;
    /**
     * Searches for a flow in the list of flows for given name.
     *
     * @param flows List of flows to search in.
     * @param type Grant type
     */
    flowForType(flows: ApiDefinitions.IApiSecurityOAuth2Flow[], type?: string): ApiDefinitions.IApiSecurityOAuth2Flow | undefined;
    /**
     * Reads list of scopes from a flow.
     *
     * @param flow A flow to process.
     * @returns List of scopes required by an endpoint / API.
     */
    readFlowScopes(flow: ApiDefinitions.IApiSecurityOAuth2Flow): string[] | undefined;
    /**
     * Reads list of grant types from the list of flows.
     *
     * @param flows List of flows to process.
     * @returns Grant types supported by this authorization.
     */
    readFlowsTypes(flows: ApiDefinitions.IApiSecurityOAuth2Flow[]): string[];
    /**
     * Applies settings from a flow to current properties.
     * OAS' flows may define different configuration for each flow.
     * This function is called each time a grant type change. If current settings
     * does not contain flows then this is ignored.
     *
     * @param name Set grant type
     */
    applyFlow(name?: string): void;
    /**
     * Extracts scopes list from the security definition
     */
    readSecurityScopes(scopes: ApiDefinitions.IApiSecurityScope[]): string[] | undefined;
    /**
     * Checks whether the security scheme is annotated with the `pkce` annotation.
     * This annotation is published at https://github.com/raml-org/raml-annotations/tree/master/annotations/security-schemes
     * @param model Model for the security settings
     * @returns True if the security settings are annotated with PKCE extension
     */
    readPkceValue(model: ApiDefinitions.IApiSecurityOAuth2Settings): boolean | undefined;
    /**
     * Adds `customData` property values that can be applied to the
     * authorization request.
     *
     * @param detail Token request detail object. The object is passed
     * by reference so no need for return value
     */
    computeAuthCustomData(detail: IOAuth2Authorization): void;
    /**
     * Adds `customData` property values that can be applied to the
     * token request.
     *
     * @param detail Token request detail object. The object is passed
     * by reference so no need for return value
     */
    computeTokenCustomData(detail: IOAuth2Authorization): void;
    /**
     * Sets up annotation supported variables to apply form view for:
     * - authorization query parameters
     * - authorization headers
     * - token query parameters
     * - token headers
     * - token body
     *
     * @param customProperty Annotation applied to the OAuth settings
     */
    setupAnnotationParameters(customProperty?: IApiCustomDomainProperty): void;
    /**
     * Appends a list of parameters to the list of rendered parameters
     */
    appendToParams(list: ApiDefinitions.IApiParameter[], source: string): void;
    /**
     * Sets up query parameters to be used with authorization request.
     *
     * @param properties List of parameters from the annotation.
     */
    setupAuthRequestQueryParameters(properties: {
        [key: string]: AmfShapes.IApiDataNodeUnion;
    }): void;
    /**
     * Sets up query parameters to be used with token request.
     *
     * @param properties List of parameters from the annotation.
     */
    setupTokenRequestQueryParameters(properties: {
        [key: string]: AmfShapes.IApiDataNodeUnion;
    }): void;
    /**
     * Sets up headers to be used with token request.
     *
     * @param properties params List of parameters from the annotation.
     */
    setupTokenRequestHeaders(properties: {
        [key: string]: AmfShapes.IApiDataNodeUnion;
    }): void;
    /**
     * Sets up body parameters to be used with token request.
     *
     * @param properties params List of parameters from the annotation.
     */
    setupTokenRequestBody(properties: {
        [key: string]: AmfShapes.IApiDataNodeUnion;
    }): void;
    /**
     * Computes list of parameter values from current model.
     *
     * This function ignores empty values if they are not required.
     * Required property are always included, even if the value is not set.
     *
     * @param params Model for form inputs.
     * @param reportKey The key name in the report.
     * @returns Array of objects with `name` and `value` properties or undefined if `params` is empty or no values are available.
     */
    computeCustomParameters(params: OperationParameter[], reportKey: keyof BindingType): IOAuth2CustomParameter[];
    renderCustomProperties(): TemplateResult;
}
//# sourceMappingURL=AmfOauth2.d.ts.map