"use strict";
/**
 * IncidenteAccion Entity
 * Acciones correctivas de incidentes
 *
 * @module HSE
 * @table hse.incidente_acciones
 * @ddl schemas/03-hse-schema-ddl.sql
 * @rf RF-MAA017-001
 */
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.IncidenteAccion = void 0;
const typeorm_1 = require("typeorm");
const incidente_entity_1 = require("./incidente.entity");
const employee_entity_1 = require("../../hr/entities/employee.entity");
let IncidenteAccion = class IncidenteAccion {
    id;
    incidenteId;
    descripcion;
    tipo;
    responsableId;
    fechaCompromiso;
    fechaCierre;
    estado;
    evidenciaUrl;
    observaciones;
    createdAt;
    updatedAt;
    // Relations
    incidente;
    responsable;
};
exports.IncidenteAccion = IncidenteAccion;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
    __metadata("design:type", String)
], IncidenteAccion.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'incidente_id', type: 'uuid' }),
    __metadata("design:type", String)
], IncidenteAccion.prototype, "incidenteId", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'text' }),
    __metadata("design:type", String)
], IncidenteAccion.prototype, "descripcion", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar', length: 50 }),
    __metadata("design:type", String)
], IncidenteAccion.prototype, "tipo", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'responsable_id', type: 'uuid', nullable: true }),
    __metadata("design:type", String)
], IncidenteAccion.prototype, "responsableId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'fecha_compromiso', type: 'date' }),
    __metadata("design:type", Date)
], IncidenteAccion.prototype, "fechaCompromiso", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'fecha_cierre', type: 'date', nullable: true }),
    __metadata("design:type", Date)
], IncidenteAccion.prototype, "fechaCierre", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar', length: 20, default: 'pendiente' }),
    __metadata("design:type", String)
], IncidenteAccion.prototype, "estado", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'evidencia_url', type: 'varchar', length: 500, nullable: true }),
    __metadata("design:type", String)
], IncidenteAccion.prototype, "evidenciaUrl", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'text', nullable: true }),
    __metadata("design:type", String)
], IncidenteAccion.prototype, "observaciones", void 0);
__decorate([
    (0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
    __metadata("design:type", Date)
], IncidenteAccion.prototype, "createdAt", void 0);
__decorate([
    (0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz' }),
    __metadata("design:type", Date)
], IncidenteAccion.prototype, "updatedAt", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => incidente_entity_1.Incidente, (i) => i.acciones, { onDelete: 'CASCADE' }),
    (0, typeorm_1.JoinColumn)({ name: 'incidente_id' }),
    __metadata("design:type", incidente_entity_1.Incidente)
], IncidenteAccion.prototype, "incidente", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => employee_entity_1.Employee),
    (0, typeorm_1.JoinColumn)({ name: 'responsable_id' }),
    __metadata("design:type", employee_entity_1.Employee)
], IncidenteAccion.prototype, "responsable", void 0);
exports.IncidenteAccion = IncidenteAccion = __decorate([
    (0, typeorm_1.Entity)({ schema: 'hse', name: 'incidente_acciones' })
], IncidenteAccion);
//# sourceMappingURL=incidente-accion.entity.js.map