"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.WildcardCertificateEntity = void 0;
const typeorm_1 = require("typeorm");
const cluster_entity_1 = require("../../infrastructure/clusters/entities/cluster.entity");
const dns_zone_entity_1 = require("./dns-zone.entity");
const certificate_provider_enum_1 = require("../../providers/enums/certificate-provider.enum");
const certificate_provider_interface_1 = require("../../providers/interfaces/certificate-provider.interface");
const reconciliation_status_enum_1 = require("../../infrastructure/shared/enums/reconciliation-status.enum");
let WildcardCertificateEntity = class WildcardCertificateEntity {
};
exports.WildcardCertificateEntity = WildcardCertificateEntity;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
    __metadata("design:type", String)
], WildcardCertificateEntity.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'uuid' }),
    __metadata("design:type", String)
], WildcardCertificateEntity.prototype, "clusterId", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => cluster_entity_1.ClusterEntity, { onDelete: 'CASCADE' }),
    (0, typeorm_1.JoinColumn)({ name: 'clusterId' }),
    __metadata("design:type", cluster_entity_1.ClusterEntity)
], WildcardCertificateEntity.prototype, "cluster", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'uuid' }),
    __metadata("design:type", String)
], WildcardCertificateEntity.prototype, "dnsZoneId", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => dns_zone_entity_1.DnsZoneEntity, { eager: true }),
    (0, typeorm_1.JoinColumn)({ name: 'dnsZoneId' }),
    __metadata("design:type", dns_zone_entity_1.DnsZoneEntity)
], WildcardCertificateEntity.prototype, "dnsZone", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar' }),
    __metadata("design:type", String)
], WildcardCertificateEntity.prototype, "scope", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar' }),
    __metadata("design:type", String)
], WildcardCertificateEntity.prototype, "masterNamespace", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar' }),
    __metadata("design:type", String)
], WildcardCertificateEntity.prototype, "masterSecretName", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar' }),
    __metadata("design:type", String)
], WildcardCertificateEntity.prototype, "masterCertName", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar' }),
    __metadata("design:type", String)
], WildcardCertificateEntity.prototype, "issuerName", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'enum', enum: certificate_provider_enum_1.CertificateProvider }),
    __metadata("design:type", String)
], WildcardCertificateEntity.prototype, "certificateProvider", void 0);
__decorate([
    (0, typeorm_1.Column)({
        type: 'enum',
        enum: certificate_provider_interface_1.CertificateStatus,
        default: certificate_provider_interface_1.CertificateStatus.PENDING,
    }),
    __metadata("design:type", String)
], WildcardCertificateEntity.prototype, "status", void 0);
__decorate([
    (0, typeorm_1.Column)({
        type: 'enum',
        enum: reconciliation_status_enum_1.ReconciliationStatus,
        default: reconciliation_status_enum_1.ReconciliationStatus.PENDING,
    }),
    __metadata("design:type", String)
], WildcardCertificateEntity.prototype, "reconciliationStatus", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'timestamptz', nullable: true }),
    __metadata("design:type", Date)
], WildcardCertificateEntity.prototype, "notAfter", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'timestamptz', nullable: true }),
    __metadata("design:type", Date)
], WildcardCertificateEntity.prototype, "renewalTime", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'timestamptz', nullable: true }),
    __metadata("design:type", Date)
], WildcardCertificateEntity.prototype, "lastReconciliationAt", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'text', nullable: true }),
    __metadata("design:type", String)
], WildcardCertificateEntity.prototype, "errorMessage", void 0);
__decorate([
    (0, typeorm_1.CreateDateColumn)({ type: 'timestamptz' }),
    __metadata("design:type", Date)
], WildcardCertificateEntity.prototype, "createdAt", void 0);
__decorate([
    (0, typeorm_1.UpdateDateColumn)({ type: 'timestamptz' }),
    __metadata("design:type", Date)
], WildcardCertificateEntity.prototype, "updatedAt", void 0);
exports.WildcardCertificateEntity = WildcardCertificateEntity = __decorate([
    (0, typeorm_1.Entity)('wildcard_certificates'),
    (0, typeorm_1.Index)(['clusterId', 'scope'], { unique: true })
], WildcardCertificateEntity);
