var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
    function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
    var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
    var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
    var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
    var _, done = false;
    for (var i = decorators.length - 1; i >= 0; i--) {
        var context = {};
        for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
        for (var p in contextIn.access) context.access[p] = contextIn.access[p];
        context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
        var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
        if (kind === "accessor") {
            if (result === void 0) continue;
            if (result === null || typeof result !== "object") throw new TypeError("Object expected");
            if (_ = accept(result.get)) descriptor.get = _;
            if (_ = accept(result.set)) descriptor.set = _;
            if (_ = accept(result.init)) initializers.unshift(_);
        }
        else if (_ = accept(result)) {
            if (kind === "field") initializers.unshift(_);
            else descriptor[key] = _;
        }
    }
    if (target) Object.defineProperty(target, contextIn.name, descriptor);
    done = true;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
    var useValue = arguments.length > 2;
    for (var i = 0; i < initializers.length; i++) {
        value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
    }
    return useValue ? value : void 0;
};
import * as plugins from '../../plugins.js';
import { DcRouterDb } from '../classes.dcrouter-db.js';
const getDb = () => DcRouterDb.getInstance().getDb();
let EmailDomainDoc = (() => {
    let _classDecorators = [plugins.smartdata.Collection(() => getDb())];
    let _classDescriptor;
    let _classExtraInitializers = [];
    let _classThis;
    let _classSuper = plugins.smartdata.SmartDataDbDoc;
    let _id_decorators;
    let _id_initializers = [];
    let _id_extraInitializers = [];
    let _domain_decorators;
    let _domain_initializers = [];
    let _domain_extraInitializers = [];
    let _linkedDomainId_decorators;
    let _linkedDomainId_initializers = [];
    let _linkedDomainId_extraInitializers = [];
    let _subdomain_decorators;
    let _subdomain_initializers = [];
    let _subdomain_extraInitializers = [];
    let _dkim_decorators;
    let _dkim_initializers = [];
    let _dkim_extraInitializers = [];
    let _rateLimits_decorators;
    let _rateLimits_initializers = [];
    let _rateLimits_extraInitializers = [];
    let _dnsStatus_decorators;
    let _dnsStatus_initializers = [];
    let _dnsStatus_extraInitializers = [];
    let _createdAt_decorators;
    let _createdAt_initializers = [];
    let _createdAt_extraInitializers = [];
    let _updatedAt_decorators;
    let _updatedAt_initializers = [];
    let _updatedAt_extraInitializers = [];
    var EmailDomainDoc = class extends _classSuper {
        static { _classThis = this; }
        static {
            const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
            _id_decorators = [plugins.smartdata.unI(), plugins.smartdata.svDb()];
            _domain_decorators = [plugins.smartdata.svDb()];
            _linkedDomainId_decorators = [plugins.smartdata.svDb()];
            _subdomain_decorators = [plugins.smartdata.svDb()];
            _dkim_decorators = [plugins.smartdata.svDb()];
            _rateLimits_decorators = [plugins.smartdata.svDb()];
            _dnsStatus_decorators = [plugins.smartdata.svDb()];
            _createdAt_decorators = [plugins.smartdata.svDb()];
            _updatedAt_decorators = [plugins.smartdata.svDb()];
            __esDecorate(null, null, _id_decorators, { kind: "field", name: "id", static: false, private: false, access: { has: obj => "id" in obj, get: obj => obj.id, set: (obj, value) => { obj.id = value; } }, metadata: _metadata }, _id_initializers, _id_extraInitializers);
            __esDecorate(null, null, _domain_decorators, { kind: "field", name: "domain", static: false, private: false, access: { has: obj => "domain" in obj, get: obj => obj.domain, set: (obj, value) => { obj.domain = value; } }, metadata: _metadata }, _domain_initializers, _domain_extraInitializers);
            __esDecorate(null, null, _linkedDomainId_decorators, { kind: "field", name: "linkedDomainId", static: false, private: false, access: { has: obj => "linkedDomainId" in obj, get: obj => obj.linkedDomainId, set: (obj, value) => { obj.linkedDomainId = value; } }, metadata: _metadata }, _linkedDomainId_initializers, _linkedDomainId_extraInitializers);
            __esDecorate(null, null, _subdomain_decorators, { kind: "field", name: "subdomain", static: false, private: false, access: { has: obj => "subdomain" in obj, get: obj => obj.subdomain, set: (obj, value) => { obj.subdomain = value; } }, metadata: _metadata }, _subdomain_initializers, _subdomain_extraInitializers);
            __esDecorate(null, null, _dkim_decorators, { kind: "field", name: "dkim", static: false, private: false, access: { has: obj => "dkim" in obj, get: obj => obj.dkim, set: (obj, value) => { obj.dkim = value; } }, metadata: _metadata }, _dkim_initializers, _dkim_extraInitializers);
            __esDecorate(null, null, _rateLimits_decorators, { kind: "field", name: "rateLimits", static: false, private: false, access: { has: obj => "rateLimits" in obj, get: obj => obj.rateLimits, set: (obj, value) => { obj.rateLimits = value; } }, metadata: _metadata }, _rateLimits_initializers, _rateLimits_extraInitializers);
            __esDecorate(null, null, _dnsStatus_decorators, { kind: "field", name: "dnsStatus", static: false, private: false, access: { has: obj => "dnsStatus" in obj, get: obj => obj.dnsStatus, set: (obj, value) => { obj.dnsStatus = value; } }, metadata: _metadata }, _dnsStatus_initializers, _dnsStatus_extraInitializers);
            __esDecorate(null, null, _createdAt_decorators, { kind: "field", name: "createdAt", static: false, private: false, access: { has: obj => "createdAt" in obj, get: obj => obj.createdAt, set: (obj, value) => { obj.createdAt = value; } }, metadata: _metadata }, _createdAt_initializers, _createdAt_extraInitializers);
            __esDecorate(null, null, _updatedAt_decorators, { kind: "field", name: "updatedAt", static: false, private: false, access: { has: obj => "updatedAt" in obj, get: obj => obj.updatedAt, set: (obj, value) => { obj.updatedAt = value; } }, metadata: _metadata }, _updatedAt_initializers, _updatedAt_extraInitializers);
            __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
            EmailDomainDoc = _classThis = _classDescriptor.value;
            if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
            __runInitializers(_classThis, _classExtraInitializers);
        }
        id = __runInitializers(this, _id_initializers, void 0);
        domain = (__runInitializers(this, _id_extraInitializers), __runInitializers(this, _domain_initializers, ''));
        linkedDomainId = (__runInitializers(this, _domain_extraInitializers), __runInitializers(this, _linkedDomainId_initializers, ''));
        subdomain = (__runInitializers(this, _linkedDomainId_extraInitializers), __runInitializers(this, _subdomain_initializers, void 0));
        dkim = (__runInitializers(this, _subdomain_extraInitializers), __runInitializers(this, _dkim_initializers, void 0));
        rateLimits = (__runInitializers(this, _dkim_extraInitializers), __runInitializers(this, _rateLimits_initializers, void 0));
        dnsStatus = (__runInitializers(this, _rateLimits_extraInitializers), __runInitializers(this, _dnsStatus_initializers, void 0));
        createdAt = (__runInitializers(this, _dnsStatus_extraInitializers), __runInitializers(this, _createdAt_initializers, void 0));
        updatedAt = (__runInitializers(this, _createdAt_extraInitializers), __runInitializers(this, _updatedAt_initializers, void 0));
        constructor() {
            super();
            __runInitializers(this, _updatedAt_extraInitializers);
        }
        static async findById(id) {
            return await EmailDomainDoc.getInstance({ id });
        }
        static async findByDomain(domain) {
            return await EmailDomainDoc.getInstance({ domain: domain.toLowerCase() });
        }
        static async findAll() {
            return await EmailDomainDoc.getInstances({});
        }
    };
    return EmailDomainDoc = _classThis;
})();
export { EmailDomainDoc };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xhc3Nlcy5lbWFpbC1kb21haW4uZG9jLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vdHMvZGIvZG9jdW1lbnRzL2NsYXNzZXMuZW1haWwtZG9tYWluLmRvYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsT0FBTyxLQ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