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 CertBackoffDoc = (() => {
    let _classDecorators = [plugins.smartdata.Collection(() => getDb())];
    let _classDescriptor;
    let _classExtraInitializers = [];
    let _classThis;
    let _classSuper = plugins.smartdata.SmartDataDbDoc;
    let _domain_decorators;
    let _domain_initializers = [];
    let _domain_extraInitializers = [];
    let _failures_decorators;
    let _failures_initializers = [];
    let _failures_extraInitializers = [];
    let _lastFailure_decorators;
    let _lastFailure_initializers = [];
    let _lastFailure_extraInitializers = [];
    let _retryAfter_decorators;
    let _retryAfter_initializers = [];
    let _retryAfter_extraInitializers = [];
    let _lastError_decorators;
    let _lastError_initializers = [];
    let _lastError_extraInitializers = [];
    var CertBackoffDoc = class extends _classSuper {
        static { _classThis = this; }
        static {
            const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
            _domain_decorators = [plugins.smartdata.unI(), plugins.smartdata.svDb()];
            _failures_decorators = [plugins.smartdata.svDb()];
            _lastFailure_decorators = [plugins.smartdata.svDb()];
            _retryAfter_decorators = [plugins.smartdata.svDb()];
            _lastError_decorators = [plugins.smartdata.svDb()];
            __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, _failures_decorators, { kind: "field", name: "failures", static: false, private: false, access: { has: obj => "failures" in obj, get: obj => obj.failures, set: (obj, value) => { obj.failures = value; } }, metadata: _metadata }, _failures_initializers, _failures_extraInitializers);
            __esDecorate(null, null, _lastFailure_decorators, { kind: "field", name: "lastFailure", static: false, private: false, access: { has: obj => "lastFailure" in obj, get: obj => obj.lastFailure, set: (obj, value) => { obj.lastFailure = value; } }, metadata: _metadata }, _lastFailure_initializers, _lastFailure_extraInitializers);
            __esDecorate(null, null, _retryAfter_decorators, { kind: "field", name: "retryAfter", static: false, private: false, access: { has: obj => "retryAfter" in obj, get: obj => obj.retryAfter, set: (obj, value) => { obj.retryAfter = value; } }, metadata: _metadata }, _retryAfter_initializers, _retryAfter_extraInitializers);
            __esDecorate(null, null, _lastError_decorators, { kind: "field", name: "lastError", static: false, private: false, access: { has: obj => "lastError" in obj, get: obj => obj.lastError, set: (obj, value) => { obj.lastError = value; } }, metadata: _metadata }, _lastError_initializers, _lastError_extraInitializers);
            __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
            CertBackoffDoc = _classThis = _classDescriptor.value;
            if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
            __runInitializers(_classThis, _classExtraInitializers);
        }
        domain = __runInitializers(this, _domain_initializers, void 0);
        failures = (__runInitializers(this, _domain_extraInitializers), __runInitializers(this, _failures_initializers, void 0));
        lastFailure = (__runInitializers(this, _failures_extraInitializers), __runInitializers(this, _lastFailure_initializers, void 0));
        retryAfter = (__runInitializers(this, _lastFailure_extraInitializers), __runInitializers(this, _retryAfter_initializers, void 0));
        lastError = (__runInitializers(this, _retryAfter_extraInitializers), __runInitializers(this, _lastError_initializers, void 0));
        constructor() {
            super();
            __runInitializers(this, _lastError_extraInitializers);
        }
        static async findByDomain(domain) {
            return await CertBackoffDoc.getInstance({ domain });
        }
        static async findAll() {
            return await CertBackoffDoc.getInstances({});
        }
    };
    return CertBackoffDoc = _classThis;
})();
export { CertBackoffDoc };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xhc3Nlcy5jZXJ0LWJhY2tvZmYuZG9jLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vdHMvZGIvZG9jdW1lbnRzL2NsYXNzZXMuY2VydC1iYWNrb2ZmLmRvYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsT0FBTyxLQUFLLE9BQU8sTUFBTSxrQkFBa0IsQ0FBQztBQUM1QyxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFFdkQsTUFBTSxLQ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