import { TemplateResult } from 'lit';
import { ApiDefinitions, IRequestAuthorization } from '@api-client/core/build/browser.js';
import { Oauth2Credentials } from '../authorization/types.js';
import ApiElement from '../ApiElement.js';
import { Authorization } from '../authorization/ui/Authorization.js';
import '../../define/amf/authorization/amf-basic-authorization.js';
import '../../define/amf/authorization/amf-passthrough-authorization.js';
import '../../define/amf/authorization/amf-bearer-authorization.js';
import '../../define/amf/authorization/amf-apikey-authorization.js';
import '../../define/amf/authorization/amf-ramlcustom-authorization.js';
import '../../define/amf/authorization/amf-oauth2-authorization.js';
import '../../define/amf/authorization/amf-oidc-authorization.js';
export interface SecurityMethods {
    types: string[];
    schemes: ApiDefinitions.IApiParametrizedSecurityScheme[];
}
export default class ApiAuthorizationEditor extends ApiElement {
    protected securityInternal: ApiDefinitions.IApiSecurityRequirement | undefined;
    protected methodsInternal?: SecurityMethods;
    get security(): ApiDefinitions.IApiSecurityRequirement | undefined;
    set security(value: ApiDefinitions.IApiSecurityRequirement | undefined);
    get methods(): SecurityMethods | undefined;
    /**
     * Whether or not the element is invalid. The validation state changes
     * when settings change or when the `validate()` function is called.
     * @attribute
     */
    invalid?: boolean;
    /**
     * List of credentials source
     */
    credentialsSource?: Oauth2Credentials[];
    /**
     * Redirect URL for the OAuth2 authorization.
     * @attribute
     */
    oauth2RedirectUri?: string;
    /**
     * When set it overrides the `authorizationUri` in the authorization editor,
     * regardless to the authorization scheme applied to the request.
     * This is to be used with the mocking service.
     * @attribute
     */
    oauth2AuthorizationUri?: string;
    /**
     * When set it overrides the `authorizationUri` in the authorization editor,
     * regardless to the authorization scheme applied to the request.
     * This is to be used with the mocking service.
     * @attribute
     */
    oauth2AccessTokenUri?: string;
    readonly editors: NodeListOf<Authorization>;
    /**
     * Reads list of authorization methods from the model.
     */
    protected processModel(): void;
    /**
     * Computes list of security schemes that can be applied to the element.
     *
     * @param schemes A list of security schemes to process.
     * @returns A list of authorization methods that can be applied to
     * the current endpoint. Each object describes the list of security types
     * that can be applied to the editor. In OAS an auth method may be an union
     * of methods.
     */
    protected computeMethods(schemes: ApiDefinitions.IApiParametrizedSecurityScheme[]): SecurityMethods;
    /**
     * Reads authorization scheme's name and type from the AMF model.
     */
    protected listSchemeLabels(security: ApiDefinitions.IApiParametrizedSecurityScheme): string | undefined;
    /**
     * A function called each time anything change in the editor.
     * Revalidates the component and dispatches the `change` event.
     */
    protected changeHandler(): void;
    /**
     * Validates state of the editor. It sets `invalid` property when called.
     *
     * Exception: OAuth 2 form reports valid even when the `accessToken` is not
     * set. This adjust for this and reports invalid when `accessToken` for OAuth 2
     * is missing.
     *
     * @returns True when the form has valid data.
     */
    validate(): boolean;
    /**
     * Creates a list of configuration by calling the `serialize()` function on each
     * currently rendered authorization form.
     *
     * @returns List of authorization settings.
     */
    serialize(): IRequestAuthorization[];
    /**
     * Calls the `authorize()` function on each rendered authorization methods.
     * Currently only `OAuth 1.0` and `OAuth 2.0` actually perform the authorization.
     *
     * Each method is called in order to make sure the user is not overwhelmed with
     * dialogs or other UI elements.
     *
     * The function rejects when at least one authorization method rejects.
     */
    authorize(): Promise<void>;
    render(): TemplateResult;
    protected methodTemplate(scheme: ApiDefinitions.IApiParametrizedSecurityScheme, type: string): TemplateResult | string;
    /**
     * Renders a template for Basic authorization.
     */
    protected basicAuthTemplate(security: ApiDefinitions.IApiParametrizedSecurityScheme): TemplateResult;
    /**
     * Renders a template for Digest authorization.
     */
    protected digestAuthTemplate(): TemplateResult;
    /**
     * Renders a template for Pass through authorization.
     */
    protected passThroughAuthTemplate(security: ApiDefinitions.IApiParametrizedSecurityScheme): TemplateResult;
    /**
     * Renders a template for RAML custom authorization.
     */
    protected ramlCustomAuthTemplate(security: ApiDefinitions.IApiParametrizedSecurityScheme): TemplateResult;
    /**
     * Renders a template for Bearer authorization (OAS).
     */
    protected bearerAuthTemplate(security: ApiDefinitions.IApiParametrizedSecurityScheme): TemplateResult;
    /**
     * Renders a template for OAuth 1 authorization.
     */
    protected oa1AuthTemplate(): TemplateResult;
    /**
     * Renders a template for OAuth 2 authorization.
     */
    protected oa2AuthTemplate(security: ApiDefinitions.IApiParametrizedSecurityScheme): TemplateResult;
    /**
     * Renders a template for OAuth 2 authorization.
     */
    protected openIdConnectTemplate(security: ApiDefinitions.IApiParametrizedSecurityScheme): TemplateResult;
    /**
     * Renders a template for Api Keys authorization.
     */
    protected apiKeyTemplate(security: ApiDefinitions.IApiParametrizedSecurityScheme): TemplateResult;
}
//# sourceMappingURL=ApiAuthorizationEditor.element.d.ts.map