"use strict";
/**
 * IncidenteInvolucrado Entity
 * Personas involucradas en incidentes
 *
 * @module HSE
 * @table hse.incidente_involucrados
 * @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.IncidenteInvolucrado = void 0;
const typeorm_1 = require("typeorm");
const incidente_entity_1 = require("./incidente.entity");
const employee_entity_1 = require("../../hr/entities/employee.entity");
let IncidenteInvolucrado = class IncidenteInvolucrado {
    id;
    incidenteId;
    employeeId;
    rol;
    descripcionLesion;
    parteCuerpo;
    diasIncapacidad;
    createdAt;
    // Relations
    incidente;
    employee;
};
exports.IncidenteInvolucrado = IncidenteInvolucrado;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
    __metadata("design:type", String)
], IncidenteInvolucrado.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'incidente_id', type: 'uuid' }),
    __metadata("design:type", String)
], IncidenteInvolucrado.prototype, "incidenteId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'employee_id', type: 'uuid' }),
    __metadata("design:type", String)
], IncidenteInvolucrado.prototype, "employeeId", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'enum', enum: ['lesionado', 'testigo', 'responsable'] }),
    __metadata("design:type", String)
], IncidenteInvolucrado.prototype, "rol", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'descripcion_lesion', type: 'text', nullable: true }),
    __metadata("design:type", String)
], IncidenteInvolucrado.prototype, "descripcionLesion", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'parte_cuerpo', type: 'varchar', length: 100, nullable: true }),
    __metadata("design:type", String)
], IncidenteInvolucrado.prototype, "parteCuerpo", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'dias_incapacidad', type: 'integer', default: 0 }),
    __metadata("design:type", Number)
], IncidenteInvolucrado.prototype, "diasIncapacidad", void 0);
__decorate([
    (0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
    __metadata("design:type", Date)
], IncidenteInvolucrado.prototype, "createdAt", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => incidente_entity_1.Incidente, (i) => i.involucrados, { onDelete: 'CASCADE' }),
    (0, typeorm_1.JoinColumn)({ name: 'incidente_id' }),
    __metadata("design:type", incidente_entity_1.Incidente)
], IncidenteInvolucrado.prototype, "incidente", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => employee_entity_1.Employee),
    (0, typeorm_1.JoinColumn)({ name: 'employee_id' }),
    __metadata("design:type", employee_entity_1.Employee)
], IncidenteInvolucrado.prototype, "employee", void 0);
exports.IncidenteInvolucrado = IncidenteInvolucrado = __decorate([
    (0, typeorm_1.Entity)({ schema: 'hse', name: 'incidente_involucrados' })
], IncidenteInvolucrado);
//# sourceMappingURL=incidente-involucrado.entity.js.map