"use strict"; /** * FondoGarantia Entity * Fondo de garantia acumulado por contrato * * @module Estimates * @table estimates.fondo_garantia * @ddl schemas/04-estimates-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.FondoGarantia = 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"); let FondoGarantia = class FondoGarantia { id; tenantId; contratoId; accumulatedAmount; releasedAmount; // Columna calculada (GENERATED ALWAYS AS) - solo lectura pendingAmount; releaseDate; releasedAt; releasedById; createdAt; createdById; updatedAt; updatedById; deletedAt; deletedById; // Relations tenant; releasedBy; createdBy; }; exports.FondoGarantia = FondoGarantia; __decorate([ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'), __metadata("design:type", String) ], FondoGarantia.prototype, "id", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }), __metadata("design:type", String) ], FondoGarantia.prototype, "tenantId", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'contrato_id', type: 'uuid' }), __metadata("design:type", String) ], FondoGarantia.prototype, "contratoId", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'accumulated_amount', type: 'decimal', precision: 16, scale: 2, default: 0 }), __metadata("design:type", Number) ], FondoGarantia.prototype, "accumulatedAmount", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'released_amount', type: 'decimal', precision: 16, scale: 2, default: 0 }), __metadata("design:type", Number) ], FondoGarantia.prototype, "releasedAmount", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'pending_amount', type: 'decimal', precision: 16, scale: 2, insert: false, update: false, }), __metadata("design:type", Number) ], FondoGarantia.prototype, "pendingAmount", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'release_date', type: 'date', nullable: true }), __metadata("design:type", Object) ], FondoGarantia.prototype, "releaseDate", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'released_at', type: 'timestamptz', nullable: true }), __metadata("design:type", Object) ], FondoGarantia.prototype, "releasedAt", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'released_by', type: 'uuid', nullable: true }), __metadata("design:type", Object) ], FondoGarantia.prototype, "releasedById", void 0); __decorate([ (0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }), __metadata("design:type", Date) ], FondoGarantia.prototype, "createdAt", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }), __metadata("design:type", Object) ], FondoGarantia.prototype, "createdById", void 0); __decorate([ (0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz', nullable: true }), __metadata("design:type", Object) ], FondoGarantia.prototype, "updatedAt", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'updated_by', type: 'uuid', nullable: true }), __metadata("design:type", Object) ], FondoGarantia.prototype, "updatedById", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'deleted_at', type: 'timestamptz', nullable: true }), __metadata("design:type", Object) ], FondoGarantia.prototype, "deletedAt", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'deleted_by', type: 'uuid', nullable: true }), __metadata("design:type", Object) ], FondoGarantia.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) ], FondoGarantia.prototype, "tenant", void 0); __decorate([ (0, typeorm_1.ManyToOne)(() => user_entity_1.User), (0, typeorm_1.JoinColumn)({ name: 'released_by' }), __metadata("design:type", Object) ], FondoGarantia.prototype, "releasedBy", void 0); __decorate([ (0, typeorm_1.ManyToOne)(() => user_entity_1.User), (0, typeorm_1.JoinColumn)({ name: 'created_by' }), __metadata("design:type", Object) ], FondoGarantia.prototype, "createdBy", void 0); exports.FondoGarantia = FondoGarantia = __decorate([ (0, typeorm_1.Entity)({ schema: 'estimates', name: 'fondo_garantia' }), (0, typeorm_1.Index)(['contratoId'], { unique: true }), (0, typeorm_1.Index)(['tenantId']) ], FondoGarantia); //# sourceMappingURL=fondo-garantia.entity.js.map