"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProcessTemplate = exports.ProcessTemplateStatus = 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 ProcessTemplateStatus;
(function (ProcessTemplateStatus) {
    ProcessTemplateStatus["DRAFT"] = "DRAFT";
    ProcessTemplateStatus["RELEASED"] = "RELEASED";
})(ProcessTemplateStatus = exports.ProcessTemplateStatus || (exports.ProcessTemplateStatus = {}));
(0, type_graphql_1.registerEnumType)(ProcessTemplateStatus, {
    name: 'ProcessTemplateStatus',
    description: 'state enumeration of a processTemplate'
});
let ProcessTemplate = class ProcessTemplate {
};
tslib_1.__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
    (0, type_graphql_1.Field)(type => type_graphql_1.ID),
    tslib_1.__metadata("design:type", String)
], ProcessTemplate.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)
], ProcessTemplate.prototype, "domain", void 0);
tslib_1.__decorate([
    (0, typeorm_1.RelationId)((processTemplate) => processTemplate.domain),
    tslib_1.__metadata("design:type", String)
], ProcessTemplate.prototype, "domainId", void 0);
tslib_1.__decorate([
    (0, typeorm_1.Column)(),
    (0, type_graphql_1.Field)({ nullable: true }),
    tslib_1.__metadata("design:type", String)
], ProcessTemplate.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)
], ProcessTemplate.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)
], ProcessTemplate.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)
], ProcessTemplate.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)
], ProcessTemplate.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)
], ProcessTemplate.prototype, "thumbnail", void 0);
tslib_1.__decorate([
    (0, typeorm_1.CreateDateColumn)(),
    (0, type_graphql_1.Field)({ nullable: true }),
    tslib_1.__metadata("design:type", Date)
], ProcessTemplate.prototype, "createdAt", void 0);
tslib_1.__decorate([
    (0, typeorm_1.UpdateDateColumn)(),
    (0, type_graphql_1.Field)({ nullable: true }),
    tslib_1.__metadata("design:type", Date)
], ProcessTemplate.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)
], ProcessTemplate.prototype, "creator", void 0);
tslib_1.__decorate([
    (0, typeorm_1.RelationId)((processTemplate) => processTemplate.creator),
    tslib_1.__metadata("design:type", String)
], ProcessTemplate.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)
], ProcessTemplate.prototype, "updater", void 0);
tslib_1.__decorate([
    (0, typeorm_1.RelationId)((processTemplate) => processTemplate.updater),
    tslib_1.__metadata("design:type", String)
], ProcessTemplate.prototype, "updaterId", void 0);
ProcessTemplate = tslib_1.__decorate([
    (0, typeorm_1.Entity)(),
    (0, typeorm_1.Index)('ix_process_template_0', (processTemplate) => [processTemplate.domain, processTemplate.name], {
        unique: true
    }),
    (0, type_graphql_1.ObjectType)({ description: 'Entity for ProcessTemplate' })
], ProcessTemplate);
exports.ProcessTemplate = ProcessTemplate;
//# sourceMappingURL=process-template.js.map