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 DnsRecordDoc = (() => {
    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 _domainId_decorators;
    let _domainId_initializers = [];
    let _domainId_extraInitializers = [];
    let _name_decorators;
    let _name_initializers = [];
    let _name_extraInitializers = [];
    let _type_decorators;
    let _type_initializers = [];
    let _type_extraInitializers = [];
    let _value_decorators;
    let _value_initializers = [];
    let _value_extraInitializers = [];
    let _ttl_decorators;
    let _ttl_initializers = [];
    let _ttl_extraInitializers = [];
    let _proxied_decorators;
    let _proxied_initializers = [];
    let _proxied_extraInitializers = [];
    let _source_decorators;
    let _source_initializers = [];
    let _source_extraInitializers = [];
    let _providerRecordId_decorators;
    let _providerRecordId_initializers = [];
    let _providerRecordId_extraInitializers = [];
    let _createdAt_decorators;
    let _createdAt_initializers = [];
    let _createdAt_extraInitializers = [];
    let _updatedAt_decorators;
    let _updatedAt_initializers = [];
    let _updatedAt_extraInitializers = [];
    let _createdBy_decorators;
    let _createdBy_initializers = [];
    let _createdBy_extraInitializers = [];
    var DnsRecordDoc = 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()];
            _domainId_decorators = [plugins.smartdata.svDb()];
            _name_decorators = [plugins.smartdata.svDb()];
            _type_decorators = [plugins.smartdata.svDb()];
            _value_decorators = [plugins.smartdata.svDb()];
            _ttl_decorators = [plugins.smartdata.svDb()];
            _proxied_decorators = [plugins.smartdata.svDb()];
            _source_decorators = [plugins.smartdata.svDb()];
            _providerRecordId_decorators = [plugins.smartdata.svDb()];
            _createdAt_decorators = [plugins.smartdata.svDb()];
            _updatedAt_decorators = [plugins.smartdata.svDb()];
            _createdBy_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, _domainId_decorators, { kind: "field", name: "domainId", static: false, private: false, access: { has: obj => "domainId" in obj, get: obj => obj.domainId, set: (obj, value) => { obj.domainId = value; } }, metadata: _metadata }, _domainId_initializers, _domainId_extraInitializers);
            __esDecorate(null, null, _name_decorators, { kind: "field", name: "name", static: false, private: false, access: { has: obj => "name" in obj, get: obj => obj.name, set: (obj, value) => { obj.name = value; } }, metadata: _metadata }, _name_initializers, _name_extraInitializers);
            __esDecorate(null, null, _type_decorators, { kind: "field", name: "type", static: false, private: false, access: { has: obj => "type" in obj, get: obj => obj.type, set: (obj, value) => { obj.type = value; } }, metadata: _metadata }, _type_initializers, _type_extraInitializers);
            __esDecorate(null, null, _value_decorators, { kind: "field", 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);
            __esDecorate(null, null, _ttl_decorators, { kind: "field", name: "ttl", static: false, private: false, access: { has: obj => "ttl" in obj, get: obj => obj.ttl, set: (obj, value) => { obj.ttl = value; } }, metadata: _metadata }, _ttl_initializers, _ttl_extraInitializers);
            __esDecorate(null, null, _proxied_decorators, { kind: "field", name: "proxied", static: false, private: false, access: { has: obj => "proxied" in obj, get: obj => obj.proxied, set: (obj, value) => { obj.proxied = value; } }, metadata: _metadata }, _proxied_initializers, _proxied_extraInitializers);
            __esDecorate(null, null, _source_decorators, { kind: "field", name: "source", static: false, private: false, access: { has: obj => "source" in obj, get: obj => obj.source, set: (obj, value) => { obj.source = value; } }, metadata: _metadata }, _source_initializers, _source_extraInitializers);
            __esDecorate(null, null, _providerRecordId_decorators, { kind: "field", name: "providerRecordId", static: false, private: false, access: { has: obj => "providerRecordId" in obj, get: obj => obj.providerRecordId, set: (obj, value) => { obj.providerRecordId = value; } }, metadata: _metadata }, _providerRecordId_initializers, _providerRecordId_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, null, _createdBy_decorators, { kind: "field", name: "createdBy", static: false, private: false, access: { has: obj => "createdBy" in obj, get: obj => obj.createdBy, set: (obj, value) => { obj.createdBy = value; } }, metadata: _metadata }, _createdBy_initializers, _createdBy_extraInitializers);
            __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
            DnsRecordDoc = _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);
        domainId = (__runInitializers(this, _id_extraInitializers), __runInitializers(this, _domainId_initializers, void 0));
        /** FQDN of the record (e.g. 'www.example.com'). */
        name = (__runInitializers(this, _domainId_extraInitializers), __runInitializers(this, _name_initializers, ''));
        type = (__runInitializers(this, _name_extraInitializers), __runInitializers(this, _type_initializers, void 0));
        value = (__runInitializers(this, _type_extraInitializers), __runInitializers(this, _value_initializers, void 0));
        ttl = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _ttl_initializers, 300));
        proxied = (__runInitializers(this, _ttl_extraInitializers), __runInitializers(this, _proxied_initializers, void 0));
        source = (__runInitializers(this, _proxied_extraInitializers), __runInitializers(this, _source_initializers, void 0));
        providerRecordId = (__runInitializers(this, _source_extraInitializers), __runInitializers(this, _providerRecordId_initializers, void 0));
        createdAt = (__runInitializers(this, _providerRecordId_extraInitializers), __runInitializers(this, _createdAt_initializers, void 0));
        updatedAt = (__runInitializers(this, _createdAt_extraInitializers), __runInitializers(this, _updatedAt_initializers, void 0));
        createdBy = (__runInitializers(this, _updatedAt_extraInitializers), __runInitializers(this, _createdBy_initializers, void 0));
        constructor() {
            super();
            __runInitializers(this, _createdBy_extraInitializers);
        }
        static async findById(id) {
            return await DnsRecordDoc.getInstance({ id });
        }
        static async findAll() {
            return await DnsRecordDoc.getInstances({});
        }
        static async findByDomainId(domainId) {
            return await DnsRecordDoc.getInstances({ domainId });
        }
    };
    return DnsRecordDoc = _classThis;
})();
export { DnsRecordDoc };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xhc3Nlcy5kbnMtcmVjb3JkLmRvYy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3RzL2RiL2RvY3VtZW50cy9jbGFzc2VzLmRucy1yZWNvcmQuZG9jLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLGtCQUFrQixDQUFDO0FBQzVDLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUd2RCxNQUFNLEtBQUssR0FBRyxHQUFHLEVBQUUsQ0FBQyxVQUFVLENBQUMsV0FBVyxFQUFFLENBQUMsS0FBSyxFQUFFLENBQUM7SUFHeEMsWUFBWTs0QkFEeEIsT0FBTyxDQUFDLFNBQVMsQ0FBQyxVQUFVLENBQUMsR0FBRyxFQUFFLENBQUMsS0FBSyxFQUFFLENBQUM7Ozs7c0JBQ1YsT0FBTyxDQUFDLFNBQVMsQ0FBQyxjQUFjOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzRCQUF4QyxTQUFRLFdBQTREOzs7OzhCQUMzRixPQUFPLENBQUMsU0FBUyx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