"use strict"; /** * AsignacionVivienda Entity * Asignaciones de vivienda a derechohabientes * * @module Infonavit * @table infonavit.asignaciones_vivienda */ 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.AsignacionVivienda = 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 oferta_vivienda_entity_1 = require("./oferta-vivienda.entity"); const derechohabiente_entity_1 = require("./derechohabiente.entity"); let AsignacionVivienda = class AsignacionVivienda { id; tenantId; ofertaId; derechohabienteId; assignmentNumber; assignmentDate; approvalDate; formalizationDate; deliveryDate; creditAmount; subsidyAmount; downPayment; status; notaryName; notaryNumber; deedNumber; deedDate; notes; createdAt; createdById; updatedAt; updatedById; // Computed property get totalAmount() { return Number(this.creditAmount) + Number(this.subsidyAmount) + Number(this.downPayment); } // Relations tenant; oferta; derechohabiente; createdBy; }; exports.AsignacionVivienda = AsignacionVivienda; __decorate([ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'), __metadata("design:type", String) ], AsignacionVivienda.prototype, "id", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }), __metadata("design:type", String) ], AsignacionVivienda.prototype, "tenantId", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'oferta_id', type: 'uuid' }), __metadata("design:type", String) ], AsignacionVivienda.prototype, "ofertaId", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'derechohabiente_id', type: 'uuid' }), __metadata("design:type", String) ], AsignacionVivienda.prototype, "derechohabienteId", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'assignment_number', type: 'varchar', length: 50 }), __metadata("design:type", String) ], AsignacionVivienda.prototype, "assignmentNumber", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'assignment_date', type: 'date' }), __metadata("design:type", Date) ], AsignacionVivienda.prototype, "assignmentDate", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'approval_date', type: 'date', nullable: true }), __metadata("design:type", Date) ], AsignacionVivienda.prototype, "approvalDate", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'formalization_date', type: 'date', nullable: true }), __metadata("design:type", Date) ], AsignacionVivienda.prototype, "formalizationDate", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'delivery_date', type: 'date', nullable: true }), __metadata("design:type", Date) ], AsignacionVivienda.prototype, "deliveryDate", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'credit_amount', type: 'decimal', precision: 14, scale: 2 }), __metadata("design:type", Number) ], AsignacionVivienda.prototype, "creditAmount", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'subsidy_amount', type: 'decimal', precision: 14, scale: 2, default: 0 }), __metadata("design:type", Number) ], AsignacionVivienda.prototype, "subsidyAmount", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'down_payment', type: 'decimal', precision: 14, scale: 2, default: 0 }), __metadata("design:type", Number) ], AsignacionVivienda.prototype, "downPayment", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'varchar', length: 20, default: 'pending' }), __metadata("design:type", String) ], AsignacionVivienda.prototype, "status", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'notary_name', type: 'varchar', length: 200, nullable: true }), __metadata("design:type", String) ], AsignacionVivienda.prototype, "notaryName", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'notary_number', type: 'varchar', length: 20, nullable: true }), __metadata("design:type", String) ], AsignacionVivienda.prototype, "notaryNumber", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'deed_number', type: 'varchar', length: 50, nullable: true }), __metadata("design:type", String) ], AsignacionVivienda.prototype, "deedNumber", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'deed_date', type: 'date', nullable: true }), __metadata("design:type", Date) ], AsignacionVivienda.prototype, "deedDate", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'text', nullable: true }), __metadata("design:type", String) ], AsignacionVivienda.prototype, "notes", void 0); __decorate([ (0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }), __metadata("design:type", Date) ], AsignacionVivienda.prototype, "createdAt", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }), __metadata("design:type", String) ], AsignacionVivienda.prototype, "createdById", void 0); __decorate([ (0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz' }), __metadata("design:type", Date) ], AsignacionVivienda.prototype, "updatedAt", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'updated_by', type: 'uuid', nullable: true }), __metadata("design:type", String) ], AsignacionVivienda.prototype, "updatedById", 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) ], AsignacionVivienda.prototype, "tenant", void 0); __decorate([ (0, typeorm_1.ManyToOne)(() => oferta_vivienda_entity_1.OfertaVivienda, (o) => o.asignaciones, { onDelete: 'CASCADE' }), (0, typeorm_1.JoinColumn)({ name: 'oferta_id' }), __metadata("design:type", oferta_vivienda_entity_1.OfertaVivienda) ], AsignacionVivienda.prototype, "oferta", void 0); __decorate([ (0, typeorm_1.ManyToOne)(() => derechohabiente_entity_1.Derechohabiente, (d) => d.asignaciones), (0, typeorm_1.JoinColumn)({ name: 'derechohabiente_id' }), __metadata("design:type", derechohabiente_entity_1.Derechohabiente) ], AsignacionVivienda.prototype, "derechohabiente", void 0); __decorate([ (0, typeorm_1.ManyToOne)(() => user_entity_1.User), (0, typeorm_1.JoinColumn)({ name: 'created_by' }), __metadata("design:type", user_entity_1.User) ], AsignacionVivienda.prototype, "createdBy", void 0); exports.AsignacionVivienda = AsignacionVivienda = __decorate([ (0, typeorm_1.Entity)({ schema: 'infonavit', name: 'asignaciones_vivienda' }), (0, typeorm_1.Index)(['tenantId', 'assignmentNumber'], { unique: true }) ], AsignacionVivienda); //# sourceMappingURL=asignacion-vivienda.entity.js.map