const Sequelize = require('sequelize');
var db = require("../database/db.js");

const CapacitacionProgramada = db.sequelize.define('CAPACITACION_PROGRAMADA', {
    ID_CAPACITACION_PROGRAMADA: {
        primaryKey: true,
        type: Sequelize.BIGINT,
        allowNull: false,
        autoIncrement: true
    },
    ANIO: {
        type: Sequelize.INTEGER,
        allowNull: false
    },
    MES: {
        type: Sequelize.INTEGER,
        allowNull: false
    },
    FECHA_PROGRAMADA: {
        type: Sequelize.DATEONLY,
        allowNull: true
    },
    TEMA: {
        type: Sequelize.STRING(200),
        allowNull: false
    },
    OBJETIVO: {
        type: Sequelize.STRING(500),
        allowNull: true
    },
    AREA_RESPONSABLE: {
        type: Sequelize.STRING(150),
        allowNull: false
    },
    RESPONSABLE: {
        type: Sequelize.STRING(150),
        allowNull: false
    },
    MODALIDAD: {
        type: Sequelize.STRING(50),
        allowNull: true
    },
    TIPO: {
        type: Sequelize.STRING(50),
        allowNull: true
    },
    DURACION_HORAS: {
        type: Sequelize.DECIMAL(6, 2),
        allowNull: true,
        defaultValue: 1
    },
    CUPO: {
        type: Sequelize.INTEGER,
        allowNull: true,
        defaultValue: 1
    },
    PRESUPUESTO: {
        type: Sequelize.DECIMAL(12, 2),
        allowNull: true,
        defaultValue: 0
    },
    ESTADO: {
        type: Sequelize.STRING(30),
        allowNull: false,
        defaultValue: 'Programada'
    },
    DEPARTAMENTO: {
        type: Sequelize.STRING(150),
        allowNull: true
    },
    TIPO_CAPACITACION: {
        type: Sequelize.STRING(50),
        allowNull: true
    },
    FECHA_EJECUCION: {
        type: Sequelize.DATEONLY,
        allowNull: true
    },
    COSTO_UNITARIO: {
        type: Sequelize.DECIMAL(12, 2),
        allowNull: true,
        defaultValue: 0
    },
    CUMPLIMIENTO: {
        type: Sequelize.STRING(50),
        allowNull: true
    },
    OBSERVACION: {
        type: Sequelize.STRING(500),
        allowNull: true
    },
    FECHA_REGISTRO: {
        type: Sequelize.DATE,
        allowNull: false,
        defaultValue: Sequelize.NOW
    }
}, {
    timestamps: false,
    freezeTableName: true,
    id: false
});

module.exports = CapacitacionProgramada;
