"use strict";
/**
 * ProgramaActividad Entity
 * Actividades del programa de obra (WBS)
 *
 * @module Progress
 * @table construction.programa_actividades
 * @ddl schemas/01-construction-schema-ddl.sql
 */
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.ProgramaActividad = void 0;
const typeorm_1 = require("typeorm");
const tenant_entity_1 = require("../../core/entities/tenant.entity");
const user_entity_1 = require("../../core/entities/user.entity");
const concepto_entity_1 = require("../../budgets/entities/concepto.entity");
const programa_obra_entity_1 = require("./programa-obra.entity");
let ProgramaActividad = class ProgramaActividad {
    id;
    tenantId;
    programaId;
    conceptoId;
    parentId;
    name;
    sequence;
    plannedStart;
    plannedEnd;
    plannedQuantity;
    plannedWeight;
    wbsCode;
    createdAt;
    createdById;
    updatedAt;
    updatedById;
    deletedAt;
    deletedById;
    // Relations
    tenant;
    programa;
    concepto;
    parent;
    children;
    createdBy;
};
exports.ProgramaActividad = ProgramaActividad;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
    __metadata("design:type", String)
], ProgramaActividad.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }),
    __metadata("design:type", String)
], ProgramaActividad.prototype, "tenantId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'programa_id', type: 'uuid' }),
    __metadata("design:type", String)
], ProgramaActividad.prototype, "programaId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'concepto_id', type: 'uuid', nullable: true }),
    __metadata("design:type", Object)
], ProgramaActividad.prototype, "conceptoId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'parent_id', type: 'uuid', nullable: true }),
    __metadata("design:type", Object)
], ProgramaActividad.prototype, "parentId", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
    __metadata("design:type", String)
], ProgramaActividad.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'integer', default: 0 }),
    __metadata("design:type", Number)
], ProgramaActividad.prototype, "sequence", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'planned_start', type: 'date', nullable: true }),
    __metadata("design:type", Object)
], ProgramaActividad.prototype, "plannedStart", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'planned_end', type: 'date', nullable: true }),
    __metadata("design:type", Object)
], ProgramaActividad.prototype, "plannedEnd", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'planned_quantity', type: 'decimal', precision: 12, scale: 4, default: 0 }),
    __metadata("design:type", Number)
], ProgramaActividad.prototype, "plannedQuantity", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'planned_weight', type: 'decimal', precision: 8, scale: 4, default: 0 }),
    __metadata("design:type", Number)
], ProgramaActividad.prototype, "plannedWeight", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'wbs_code', type: 'varchar', length: 50, nullable: true }),
    __metadata("design:type", Object)
], ProgramaActividad.prototype, "wbsCode", void 0);
__decorate([
    (0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
    __metadata("design:type", Date)
], ProgramaActividad.prototype, "createdAt", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }),
    __metadata("design:type", Object)
], ProgramaActividad.prototype, "createdById", void 0);
__decorate([
    (0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz', nullable: true }),
    __metadata("design:type", Object)
], ProgramaActividad.prototype, "updatedAt", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'updated_by', type: 'uuid', nullable: true }),
    __metadata("design:type", Object)
], ProgramaActividad.prototype, "updatedById", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'deleted_at', type: 'timestamptz', nullable: true }),
    __metadata("design:type", Object)
], ProgramaActividad.prototype, "deletedAt", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'deleted_by', type: 'uuid', nullable: true }),
    __metadata("design:type", Object)
], ProgramaActividad.prototype, "deletedById", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => tenant_entity_1.Tenant),
    (0, typeorm_1.JoinColumn)({ name: 'tenant_id' }),
    __metadata("design:type", tenant_entity_1.Tenant)
], ProgramaActividad.prototype, "tenant", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => programa_obra_entity_1.ProgramaObra, (p) => p.actividades),
    (0, typeorm_1.JoinColumn)({ name: 'programa_id' }),
    __metadata("design:type", programa_obra_entity_1.ProgramaObra)
], ProgramaActividad.prototype, "programa", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => concepto_entity_1.Concepto, { nullable: true }),
    (0, typeorm_1.JoinColumn)({ name: 'concepto_id' }),
    __metadata("design:type", Object)
], ProgramaActividad.prototype, "concepto", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => ProgramaActividad, (a) => a.children, { nullable: true }),
    (0, typeorm_1.JoinColumn)({ name: 'parent_id' }),
    __metadata("design:type", Object)
], ProgramaActividad.prototype, "parent", void 0);
__decorate([
    (0, typeorm_1.OneToMany)(() => ProgramaActividad, (a) => a.parent),
    __metadata("design:type", Array)
], ProgramaActividad.prototype, "children", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => user_entity_1.User),
    (0, typeorm_1.JoinColumn)({ name: 'created_by' }),
    __metadata("design:type", Object)
], ProgramaActividad.prototype, "createdBy", void 0);
exports.ProgramaActividad = ProgramaActividad = __decorate([
    (0, typeorm_1.Entity)({ schema: 'construction', name: 'programa_actividades' }),
    (0, typeorm_1.Index)(['tenantId']),
    (0, typeorm_1.Index)(['programaId'])
], ProgramaActividad);
//# sourceMappingURL=programa-actividad.entity.js.map