"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JISInfotextsModel = void 0;
const JISInfotextSeverityLevelEnum_1 = require("../../../helpers/jis/JISInfotextSeverityLevelEnum");
const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
class JISInfotextsModel extends sequelize_1.Model {
}
exports.JISInfotextsModel = JISInfotextsModel;
JISInfotextsModel.tableName = "jis_infotexts";
JISInfotextsModel.attributeModel = {
    id: {
        primaryKey: true,
        allowNull: false,
        type: sequelize_1.DataTypes.UUID,
    },
    severity_level: {
        type: sequelize_1.DataTypes.ENUM(...Object.values(JISInfotextSeverityLevelEnum_1.JISInfotextSeverityLevel)),
        allowNull: false,
    },
    display_type: {
        type: sequelize_1.DataTypes.STRING(255),
        allowNull: false,
    },
    active_period_start: {
        type: sequelize_1.DataTypes.DATE,
        allowNull: false,
    },
    active_period_end: {
        type: sequelize_1.DataTypes.DATE,
    },
    description_text: {
        type: sequelize_1.DataTypes.JSONB,
        allowNull: false,
    },
    created_timestamp: {
        type: sequelize_1.DataTypes.DATE,
        allowNull: false,
    },
    updated_timestamp: {
        type: sequelize_1.DataTypes.DATE,
        allowNull: false,
    },
    created_at: {
        type: sequelize_1.DataTypes.DATE,
        allowNull: false,
    },
    updated_at: {
        type: sequelize_1.DataTypes.DATE,
        allowNull: false,
    },
};
JISInfotextsModel.jsonSchema = {
    type: "array",
    items: {
        type: "object",
        properties: {
            id: { type: "string" },
            severity_level: { type: "string", enum: Object.values(JISInfotextSeverityLevelEnum_1.JISInfotextSeverityLevel) },
            display_type: { type: "string", enum: ["GENERAL", "INLINE"] },
            active_period_start: { type: "object", required: ["toISOString"] },
            active_period_end: {
                oneOf: [
                    { type: "object", required: ["toISOString"] },
                    { type: "null", nullable: true },
                ],
            },
            description_text: { $ref: "#/definitions/Translation" },
            created_timestamp: { type: "object", required: ["toISOString"] },
            updated_timestamp: { type: "object", required: ["toISOString"] },
        },
        additionalProperties: false,
        required: [
            "id",
            "severity_level",
            "display_type",
            "active_period_start",
            "description_text",
            "created_timestamp",
            "updated_timestamp",
        ],
    },
    definitions: {
        Translation: {
            type: "object",
            properties: {
                cs: { type: "string" },
                en: { oneOf: [{ type: "string" }, { type: "null", nullable: true }] },
            },
            additionalProperties: false,
            required: ["cs"],
        },
    },
};
//# sourceMappingURL=JISInfotextsModel.js.map