"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.DashboardQuestion = void 0;
const openapi = require("@nestjs/swagger");
const common_entity_1 = require("./common.entity");
const typeorm_1 = require("typeorm");
const typeorm_db_helper_1 = require("../helpers/typeorm-db-helper");
const dashboard_entity_1 = require("./dashboard.entity");
const dashboard_question_sql_dataset_config_entity_1 = require("./dashboard-question-sql-dataset-config.entity");
let DashboardQuestion = class DashboardQuestion extends common_entity_1.CommonEntity {
    static _OPENAPI_METADATA_FACTORY() {
        return { name: { required: true, type: () => String }, sourceType: { required: true, type: () => String }, visualisedAs: { required: true, type: () => String }, providerName: { required: true, type: () => String }, dashboard: { required: true, type: () => require("./dashboard.entity").Dashboard }, questionSqlDatasetConfigs: { required: true, type: () => [require("./dashboard-question-sql-dataset-config.entity").DashboardQuestionSqlDatasetConfig] }, chartOptions: { required: true, type: () => Object }, labelSql: { required: true, type: () => String }, kpiSql: { required: true, type: () => String }, sequenceNumber: { required: true, type: () => Number }, externalId: { required: true, type: () => String } };
    }
};
exports.DashboardQuestion = DashboardQuestion;
__decorate([
    (0, typeorm_1.Index)(),
    (0, typeorm_1.Column)({ type: "varchar" }),
    __metadata("design:type", String)
], DashboardQuestion.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Index)(),
    (0, typeorm_1.Column)({}),
    __metadata("design:type", String)
], DashboardQuestion.prototype, "sourceType", void 0);
__decorate([
    (0, typeorm_1.Index)(),
    (0, typeorm_1.Column)({}),
    __metadata("design:type", String)
], DashboardQuestion.prototype, "visualisedAs", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: "varchar", nullable: true }),
    __metadata("design:type", String)
], DashboardQuestion.prototype, "providerName", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => dashboard_entity_1.Dashboard, { nullable: true }),
    (0, typeorm_1.JoinColumn)(),
    __metadata("design:type", dashboard_entity_1.Dashboard)
], DashboardQuestion.prototype, "dashboard", void 0);
__decorate([
    (0, typeorm_1.OneToMany)(() => dashboard_question_sql_dataset_config_entity_1.DashboardQuestionSqlDatasetConfig, dashboardQuestionSqlDatasetConfig => dashboardQuestionSqlDatasetConfig.question, { cascade: true }),
    __metadata("design:type", Array)
], DashboardQuestion.prototype, "questionSqlDatasetConfigs", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: "simple-json", nullable: true, ...(0, typeorm_db_helper_1.getColumnType)('simpleJsonLargeText') }),
    __metadata("design:type", Object)
], DashboardQuestion.prototype, "chartOptions", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, ...(0, typeorm_db_helper_1.getColumnType)('longText') }),
    __metadata("design:type", String)
], DashboardQuestion.prototype, "labelSql", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, ...(0, typeorm_db_helper_1.getColumnType)('longText') }),
    __metadata("design:type", String)
], DashboardQuestion.prototype, "kpiSql", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: "integer", nullable: true }),
    __metadata("design:type", Number)
], DashboardQuestion.prototype, "sequenceNumber", void 0);
__decorate([
    (0, typeorm_1.Index)({ unique: true }),
    (0, typeorm_1.Column)({ type: "varchar", nullable: false }),
    __metadata("design:type", String)
], DashboardQuestion.prototype, "externalId", void 0);
exports.DashboardQuestion = DashboardQuestion = __decorate([
    (0, typeorm_1.Entity)("ss_dashboard_question")
], DashboardQuestion);
//# sourceMappingURL=dashboard-question.entity.js.map