"use strict";
/**
 * RegistroInfonavit Entity
 * Registro de proyectos ante INFONAVIT
 *
 * @module Infonavit
 * @table infonavit.registros_infonavit
 */
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.RegistroInfonavit = 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");
let RegistroInfonavit = class RegistroInfonavit {
    id;
    tenantId;
    fraccionamientoId;
    registrationNumber;
    registrationDate;
    approvalDate;
    developerCode;
    totalUnits;
    registeredUnits;
    assignedUnits;
    status;
    notes;
    createdAt;
    createdById;
    updatedAt;
    updatedById;
    deletedAt;
    deletedById;
    // Relations
    tenant;
    createdBy;
    ofertas;
};
exports.RegistroInfonavit = RegistroInfonavit;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
    __metadata("design:type", String)
], RegistroInfonavit.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }),
    __metadata("design:type", String)
], RegistroInfonavit.prototype, "tenantId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'fraccionamiento_id', type: 'uuid' }),
    __metadata("design:type", String)
], RegistroInfonavit.prototype, "fraccionamientoId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'registration_number', type: 'varchar', length: 50 }),
    __metadata("design:type", String)
], RegistroInfonavit.prototype, "registrationNumber", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'registration_date', type: 'date' }),
    __metadata("design:type", Date)
], RegistroInfonavit.prototype, "registrationDate", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'approval_date', type: 'date', nullable: true }),
    __metadata("design:type", Date)
], RegistroInfonavit.prototype, "approvalDate", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'developer_code', type: 'varchar', length: 30, nullable: true }),
    __metadata("design:type", String)
], RegistroInfonavit.prototype, "developerCode", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'total_units', type: 'integer' }),
    __metadata("design:type", Number)
], RegistroInfonavit.prototype, "totalUnits", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'registered_units', type: 'integer', default: 0 }),
    __metadata("design:type", Number)
], RegistroInfonavit.prototype, "registeredUnits", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'assigned_units', type: 'integer', default: 0 }),
    __metadata("design:type", Number)
], RegistroInfonavit.prototype, "assignedUnits", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar', length: 20, default: 'draft' }),
    __metadata("design:type", String)
], RegistroInfonavit.prototype, "status", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'text', nullable: true }),
    __metadata("design:type", String)
], RegistroInfonavit.prototype, "notes", void 0);
__decorate([
    (0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
    __metadata("design:type", Date)
], RegistroInfonavit.prototype, "createdAt", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }),
    __metadata("design:type", String)
], RegistroInfonavit.prototype, "createdById", void 0);
__decorate([
    (0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz' }),
    __metadata("design:type", Date)
], RegistroInfonavit.prototype, "updatedAt", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'updated_by', type: 'uuid', nullable: true }),
    __metadata("design:type", String)
], RegistroInfonavit.prototype, "updatedById", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'deleted_at', type: 'timestamptz', nullable: true }),
    __metadata("design:type", Date)
], RegistroInfonavit.prototype, "deletedAt", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'deleted_by', type: 'uuid', nullable: true }),
    __metadata("design:type", String)
], RegistroInfonavit.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)
], RegistroInfonavit.prototype, "tenant", 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)
], RegistroInfonavit.prototype, "createdBy", void 0);
__decorate([
    (0, typeorm_1.OneToMany)(() => oferta_vivienda_entity_1.OfertaVivienda, (oferta) => oferta.registro),
    __metadata("design:type", Array)
], RegistroInfonavit.prototype, "ofertas", void 0);
exports.RegistroInfonavit = RegistroInfonavit = __decorate([
    (0, typeorm_1.Entity)({ schema: 'infonavit', name: 'registros_infonavit' }),
    (0, typeorm_1.Index)(['tenantId', 'registrationNumber'], { unique: true })
], RegistroInfonavit);
//# sourceMappingURL=registro-infonavit.entity.js.map