import { __esDecorate, __runInitializers } from "tslib";
import { Action } from './Action.js';
import { observed, toRaw } from '../../decorators/observed.js';
/**
 * Enables keyword-based search across specified fields.
 * Endpoint: GET /[entity-collection-name]/search
 */
let SearchAction = (() => {
    let _classSuper = Action;
    let _kind_decorators;
    let _kind_initializers = [];
    let _kind_extraInitializers = [];
    let _fields_decorators;
    let _fields_initializers = [];
    let _fields_extraInitializers = [];
    return class SearchAction extends _classSuper {
        static {
            const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
            _kind_decorators = [observed()];
            _fields_decorators = [observed({ deep: true })];
            __esDecorate(this, null, _kind_decorators, { kind: "accessor", name: "kind", static: false, private: false, access: { has: obj => "kind" in obj, get: obj => obj.kind, set: (obj, value) => { obj.kind = value; } }, metadata: _metadata }, _kind_initializers, _kind_extraInitializers);
            __esDecorate(this, null, _fields_decorators, { kind: "accessor", name: "fields", static: false, private: false, access: { has: obj => "fields" in obj, get: obj => obj.fields, set: (obj, value) => { obj.fields = value; } }, metadata: _metadata }, _fields_initializers, _fields_extraInitializers);
            if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
        }
        #kind_accessor_storage = __runInitializers(this, _kind_initializers, void 0);
        get kind() { return this.#kind_accessor_storage; }
        set kind(value) { this.#kind_accessor_storage = value; }
        #fields_accessor_storage = (__runInitializers(this, _kind_extraInitializers), __runInitializers(this, _fields_initializers, void 0));
        get fields() { return this.#fields_accessor_storage; }
        set fields(value) { this.#fields_accessor_storage = value; }
        constructor(state = {}) {
            super(state);
            __runInitializers(this, _fields_extraInitializers);
            this.kind = 'search';
            this.fields = state.fields ? [...state.fields] : [];
        }
        toJSON() {
            return {
                ...super.toJSON(),
                kind: 'search',
                fields: structuredClone(toRaw(this, this.fields)),
            };
        }
        static isSearchActionSchema(schema) {
            return schema.kind === 'search';
        }
        static isSearchAction(action) {
            return action.kind === 'search';
        }
    };
})();
export { SearchAction };
//# sourceMappingURL=SearchAction.js.map