import { type TemplateResult, type PropertyValues, nothing } from 'lit';
import { type DomainAssociation, type MatchUserRoleAccessRule, type AccessRule, type ApiModel, type DomainProperty, type DomainEntity } from '@api-client/core/browser.js';
import { ApiEditor } from './ApiEditor.js';
import type { ApiModelAccessTarget, ApiModelOperationName } from '../types.js';
/**
 * An editor for configuring access settings of the API.
 * Access settings can be added either to the API itself, on an endpoint (exposed entity), or to individual operations.
 *
 * This editor doesn't support the dirty state. Any changes made in the editor are immediately reflected in the model.
 */
export default class ApiModelingAccessConfiguration extends ApiEditor {
    /**
     * The operation of the access configuration.
     * Can be one of: `list`, `read`, `create`, `update`, `delete`, or `search`.
     *
     * This property is only relevant when the `target` property is set to `action`.
     * If the `target` property is set to `api` or `endpoint`, this property is ignored.
     *
     * If the value is not set, the editor will not render anything.
     * @attribute
     */
    accessor operation: ApiModelOperationName | undefined;
    /**
     * The target of the access configuration.
     * Can be one of: `api`, `action`, or `endpoint`.
     *
     * When the value is set to `api`, the `operation` and `domainKey` properties are ignored.
     * When the value is set to `action`, the `operation` property must be set and the `domainKey` property
     * must point to an exposed entity.
     * When the value is set to `endpoint`, the `operation` property is ignored and the `domainKey` property
     * must point to an exposed entity.
     *
     * If the value is not set, the editor will not render anything.
     * @attribute
     */
    accessor target: ApiModelAccessTarget | undefined;
    /**
     * The access rules being edited.
     * This property is set when the `model`, `domainKey`, `operation`, or `target` properties change.
     * The editor should use this property to render the access rules and allow editing them.
     *
     * Note, it is a direct reference to the underlying model. Any changes to this array or its items
     * will be reflected in the model.
     */
    accessor rules: AccessRule[];
    /**
     * The domain property of the user object in the domain model that has the UserRole semantic.
     */
    accessor userRoleProperty: DomainProperty | null;
    /**
     * An association of the exposed entity that has the ResourceOwner semantic.
     */
    accessor resourceOwnerAssociation: DomainAssociation | null;
    constructor();
    protected willUpdate(cp: PropertyValues<this>): void;
    protected resetModel(): void;
    protected setupModel(model?: ApiModel, domainKey?: string): void | Promise<void>;
    protected setupRules(model: ApiModel, target: ApiModelAccessTarget, domainKey?: string): void;
    protected setupUserRoleProperty(model: ApiModel): void;
    protected analyzeUserEntity(entity: DomainEntity): void;
    /**
     * Finds and sets the resource owner association for the exposed entity.
     * @param model The API model
     * @param target The target of the editor
     * @param domainKey The exposed entity id.
     */
    protected setupResourceOwnerAssociation(model: ApiModel, target: ApiModelAccessTarget, domainKey?: string): void;
    protected handleAddModeSelect(e: CustomEvent): void;
    /**
     * Adds an empty access rule of the given type to the model.
     * @param rule The rule to add
     */
    addEmptyRule(rule: AccessRule['type']): void;
    protected synchronizeModel(): void;
    protected handleRuleDelete(e: Event): void;
    protected handleAddDomain(e: Event): void;
    protected handleDomainDelete(e: Event): void;
    protected handleDomainChange(e: Event): void;
    protected handleUserRoleChange(e: Event): void;
    protected render(): TemplateResult | typeof nothing;
    protected renderIntro(): TemplateResult;
    protected renderAddButton(): TemplateResult;
    protected renderRules(): TemplateResult | typeof nothing;
    protected renderRule(rule: AccessRule, index: number): TemplateResult;
    protected renderRuleHeader(title: string, helpId: string, index: number): TemplateResult;
    protected renderRuleDescription(description: string): TemplateResult;
    protected renderPublicRule(index: number): TemplateResult;
    protected renderAuthenticatedRule(index: number): TemplateResult;
    protected renderResourceOwnerRule(index: number): TemplateResult;
    protected renderResourceOwnerRuleDetails(): TemplateResult;
    protected renderMatchUserRoleRule(rule: MatchUserRoleAccessRule, index: number): TemplateResult;
    protected renderUserRoles(rule: MatchUserRoleAccessRule, ruleIndex: number): TemplateResult;
    protected renderRoleInput(roles: string[], role: string, ruleIndex: number): TemplateResult;
    protected renderMatchEmailDomainRule(rule: Extract<AccessRule, {
        type: 'matchEmailDomain';
    }>, index: number): TemplateResult;
    protected renderEmailDomains(domains: string[], ruleIndex: number): TemplateResult;
    protected renderDomainInput(domain: string, index: number, ruleIndex: number): TemplateResult;
}
//# sourceMappingURL=ApiModelingAccessConfiguration.d.ts.map