import { __esDecorate, __runInitializers } from "tslib";
import { AccessRule } from './AccessRule.js';
import { observed } from '../../decorators/observed.js';
/**
 * The action is allowed if a specific property on the authenticated user matches an expected value.
 * This is used to enforce other user-specific restrictions.
 */
let MatchUserPropertyAccessRule = (() => {
    let _classSuper = AccessRule;
    let _property_decorators;
    let _property_initializers = [];
    let _property_extraInitializers = [];
    let _value_decorators;
    let _value_initializers = [];
    let _value_extraInitializers = [];
    return class MatchUserPropertyAccessRule extends _classSuper {
        static {
            const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
            _property_decorators = [observed()];
            _value_decorators = [observed()];
            __esDecorate(this, null, _property_decorators, { kind: "accessor", name: "property", static: false, private: false, access: { has: obj => "property" in obj, get: obj => obj.property, set: (obj, value) => { obj.property = value; } }, metadata: _metadata }, _property_initializers, _property_extraInitializers);
            __esDecorate(this, null, _value_decorators, { kind: "accessor", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
            if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
        }
        type;
        #property_accessor_storage = __runInitializers(this, _property_initializers, void 0);
        get property() { return this.#property_accessor_storage; }
        set property(value) { this.#property_accessor_storage = value; }
        #value_accessor_storage = (__runInitializers(this, _property_extraInitializers), __runInitializers(this, _value_initializers, void 0));
        get value() { return this.#value_accessor_storage; }
        set value(value) { this.#value_accessor_storage = value; }
        constructor(state = {}) {
            super(state);
            __runInitializers(this, _value_extraInitializers);
            this.type = 'matchUserProperty';
            this.property = state.property ?? '';
            this.value = state.value ?? '';
        }
        toJSON() {
            return {
                ...super.toJSON(),
                property: this.property,
                value: this.value,
            };
        }
    };
})();
export { MatchUserPropertyAccessRule };
//# sourceMappingURL=MatchUserProperty.js.map