import { __esDecorate, __runInitializers } from "tslib";
import { AccessRule } from './AccessRule.js';
import { observed, toRaw } from '../../decorators/observed.js';
/**
 * The action is allowed if the authenticated user's email domain matches a specific domain.
 * This is used to restrict access based on the user's email address.
 * For example, only users with an email address from "my-company.com" can access certain resources.
 */
let MatchEmailDomainAccessRule = (() => {
    let _classSuper = AccessRule;
    let _domains_decorators;
    let _domains_initializers = [];
    let _domains_extraInitializers = [];
    return class MatchEmailDomainAccessRule extends _classSuper {
        static {
            const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
            _domains_decorators = [observed({ deep: true })];
            __esDecorate(this, null, _domains_decorators, { kind: "accessor", name: "domains", static: false, private: false, access: { has: obj => "domains" in obj, get: obj => obj.domains, set: (obj, value) => { obj.domains = value; } }, metadata: _metadata }, _domains_initializers, _domains_extraInitializers);
            if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
        }
        type;
        #domains_accessor_storage = __runInitializers(this, _domains_initializers, void 0);
        get domains() { return this.#domains_accessor_storage; }
        set domains(value) { this.#domains_accessor_storage = value; }
        constructor(state = {}) {
            super(state);
            __runInitializers(this, _domains_extraInitializers);
            this.type = 'matchEmailDomain';
            this.domains = state.domains ? [...state.domains] : [];
        }
        toJSON() {
            return {
                ...super.toJSON(),
                domains: structuredClone(toRaw(this, this.domains)),
            };
        }
    };
})();
export { MatchEmailDomainAccessRule };
//# sourceMappingURL=MatchEmailDomain.js.map