"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DesignPackage = exports.DesignPackageStatus = void 0;
const tslib_1 = require("tslib");
const typeorm_1 = require("typeorm");
const type_graphql_1 = require("type-graphql");
const shell_1 = require("@things-factory/shell");
const auth_base_1 = require("@things-factory/auth-base");
const env_1 = require("@things-factory/env");
const ORMCONFIG = env_1.config.get('ormconfig', {});
const DATABASE_TYPE = ORMCONFIG.type;
var DesignPackageStatus;
(function (DesignPackageStatus) {
    DesignPackageStatus["DRAFT"] = "DRAFT";
    DesignPackageStatus["RELEASED"] = "RELEASED";
})(DesignPackageStatus || (exports.DesignPackageStatus = DesignPackageStatus = {}));
(0, type_graphql_1.registerEnumType)(DesignPackageStatus, {
    name: 'DesignPackageStatus',
    description: 'state enumeration of a designPackage'
});
let DesignPackage = class DesignPackage {
};
exports.DesignPackage = DesignPackage;
tslib_1.__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
    (0, type_graphql_1.Field)(type => type_graphql_1.ID),
    tslib_1.__metadata("design:type", String)
], DesignPackage.prototype, "id", void 0);
tslib_1.__decorate([
    (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
    (0, type_graphql_1.Field)({ nullable: true }),
    tslib_1.__metadata("design:type", shell_1.Domain)
], DesignPackage.prototype, "domain", void 0);
tslib_1.__decorate([
    (0, typeorm_1.RelationId)((designPackage) => designPackage.domain),
    tslib_1.__metadata("design:type", String)
], DesignPackage.prototype, "domainId", void 0);
tslib_1.__decorate([
    (0, typeorm_1.Column)(),
    (0, type_graphql_1.Field)({ nullable: true }),
    tslib_1.__metadata("design:type", String)
], DesignPackage.prototype, "name", void 0);
tslib_1.__decorate([
    (0, typeorm_1.Column)({ nullable: true }),
    (0, type_graphql_1.Field)({ nullable: true }),
    tslib_1.__metadata("design:type", String)
], DesignPackage.prototype, "description", void 0);
tslib_1.__decorate([
    (0, typeorm_1.Column)('simple-json', { nullable: true, default: null }),
    (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
    tslib_1.__metadata("design:type", Array)
], DesignPackage.prototype, "tags", void 0);
tslib_1.__decorate([
    (0, typeorm_1.Column)({ nullable: true, default: 'private' }),
    (0, type_graphql_1.Field)({ nullable: true }),
    tslib_1.__metadata("design:type", String)
], DesignPackage.prototype, "visibility", void 0);
tslib_1.__decorate([
    (0, typeorm_1.Column)({
        nullable: true,
        type: DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
            ? 'longtext'
            : DATABASE_TYPE == 'oracle'
                ? 'clob'
                : 'varchar'
    }),
    (0, type_graphql_1.Field)({ nullable: true }),
    tslib_1.__metadata("design:type", String)
], DesignPackage.prototype, "model", void 0);
tslib_1.__decorate([
    (0, typeorm_1.Column)({
        nullable: true,
        type: DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
            ? 'longtext'
            : DATABASE_TYPE == 'oracle'
                ? 'clob'
                : 'varchar'
    }),
    (0, type_graphql_1.Field)({ nullable: true }),
    tslib_1.__metadata("design:type", String)
], DesignPackage.prototype, "thumbnail", void 0);
tslib_1.__decorate([
    (0, typeorm_1.CreateDateColumn)(),
    (0, type_graphql_1.Field)({ nullable: true }),
    tslib_1.__metadata("design:type", Date)
], DesignPackage.prototype, "createdAt", void 0);
tslib_1.__decorate([
    (0, typeorm_1.UpdateDateColumn)(),
    (0, type_graphql_1.Field)({ nullable: true }),
    tslib_1.__metadata("design:type", Date)
], DesignPackage.prototype, "updatedAt", void 0);
tslib_1.__decorate([
    (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
    (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
    tslib_1.__metadata("design:type", auth_base_1.User)
], DesignPackage.prototype, "creator", void 0);
tslib_1.__decorate([
    (0, typeorm_1.RelationId)((designPackage) => designPackage.creator),
    tslib_1.__metadata("design:type", String)
], DesignPackage.prototype, "creatorId", void 0);
tslib_1.__decorate([
    (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
    (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
    tslib_1.__metadata("design:type", auth_base_1.User)
], DesignPackage.prototype, "updater", void 0);
tslib_1.__decorate([
    (0, typeorm_1.RelationId)((designPackage) => designPackage.updater),
    tslib_1.__metadata("design:type", String)
], DesignPackage.prototype, "updaterId", void 0);
exports.DesignPackage = DesignPackage = tslib_1.__decorate([
    (0, typeorm_1.Entity)(),
    (0, typeorm_1.Index)('ix_design_package_0', (designPackage) => [designPackage.domain, designPackage.name], {
        unique: true
    }),
    (0, type_graphql_1.ObjectType)({ description: 'Entity for DesignPackage' })
], DesignPackage);
//# sourceMappingURL=design-package.js.map