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);
};
import User from "./User";
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
import ColumnLength from "../../Types/Database/ColumnLength";
import ColumnType from "../../Types/Database/ColumnType";
import TableColumn from "../../Types/Database/TableColumn";
import TableColumnType from "../../Types/Database/TableColumnType";
import TableMetadata from "../../Types/Database/TableMetadata";
import IconProp from "../../Types/Icon/IconProp";
import ObjectID from "../../Types/ObjectID";
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
let AcmeCertificate = class AcmeCertificate extends BaseModel {
    constructor() {
        super(...arguments);
        this.domain = undefined;
        this.certificate = undefined;
        this.certificateKey = undefined;
        this.issuedAt = undefined;
        this.expiresAt = undefined;
        this.deletedByUser = undefined;
        this.deletedByUserId = undefined;
    }
};
__decorate([
    Index(),
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({ type: TableColumnType.LongText }),
    Column({
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        nullable: false,
        unique: false,
    }),
    __metadata("design:type", String)
], AcmeCertificate.prototype, "domain", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({ type: TableColumnType.VeryLongText }),
    Column({
        type: ColumnType.VeryLongText,
        nullable: false,
        unique: false,
    }),
    __metadata("design:type", String)
], AcmeCertificate.prototype, "certificate", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({ type: TableColumnType.VeryLongText }),
    Column({
        type: ColumnType.VeryLongText,
        nullable: false,
        unique: false,
    }),
    __metadata("design:type", String)
], AcmeCertificate.prototype, "certificateKey", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({ type: TableColumnType.Date }),
    Column({
        type: ColumnType.Date,
        nullable: false,
        unique: false,
    }),
    __metadata("design:type", Date)
], AcmeCertificate.prototype, "issuedAt", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({ type: TableColumnType.Date }),
    Column({
        type: ColumnType.Date,
        nullable: false,
        unique: false,
    }),
    __metadata("design:type", Date)
], AcmeCertificate.prototype, "expiresAt", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "deletedByUserId",
        type: TableColumnType.Entity,
        title: "Deleted by User",
        modelType: User,
        description: "Relation to User who deleted this object (if this object was deleted by a User)",
    }),
    ManyToOne(() => {
        return User;
    }, {
        cascade: false,
        eager: false,
        nullable: true,
        onDelete: "SET NULL",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "deletedByUserId" }),
    __metadata("design:type", User)
], AcmeCertificate.prototype, "deletedByUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.ObjectID,
        title: "Deleted by User ID",
        description: "User ID who deleted this object (if this object was deleted by a User)",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], AcmeCertificate.prototype, "deletedByUserId", void 0);
AcmeCertificate = __decorate([
    TableAccessControl({
        create: [],
        read: [],
        delete: [],
        update: [],
    }),
    TableMetadata({
        tableName: "AcmeCertificate",
        singularName: "Acme Certificate",
        pluralName: "Acme Certificate",
        icon: IconProp.Lock,
        tableDescription: "Lets Encrypt Certificates",
    }),
    Entity({
        name: "AcmeCertificate",
    })
], AcmeCertificate);
export default AcmeCertificate;
//# sourceMappingURL=AcmeCertificate.js.map