"use strict";
/**
 * Lote Entity
 * Lotes/Terrenos individuales
 *
 * @module Construction
 */
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.Lote = void 0;
const typeorm_1 = require("typeorm");
const manzana_entity_1 = require("./manzana.entity");
const prototipo_entity_1 = require("./prototipo.entity");
let Lote = class Lote {
    id;
    tenantId;
    manzanaId;
    prototipoId;
    code;
    officialNumber;
    areaM2;
    frontM;
    depthM;
    status;
    priceBase;
    priceFinal;
    buyerId;
    saleDate;
    deliveryDate;
    createdAt;
    createdBy;
    updatedAt;
    updatedBy;
    deletedAt;
    // Relations
    manzana;
    prototipo;
};
exports.Lote = Lote;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
    __metadata("design:type", String)
], Lote.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }),
    __metadata("design:type", String)
], Lote.prototype, "tenantId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'manzana_id', type: 'uuid' }),
    __metadata("design:type", String)
], Lote.prototype, "manzanaId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'prototipo_id', type: 'uuid', nullable: true }),
    __metadata("design:type", String)
], Lote.prototype, "prototipoId", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar', length: 30 }),
    __metadata("design:type", String)
], Lote.prototype, "code", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'official_number', type: 'varchar', length: 50, nullable: true }),
    __metadata("design:type", String)
], Lote.prototype, "officialNumber", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'area_m2', type: 'decimal', precision: 10, scale: 2, nullable: true }),
    __metadata("design:type", Number)
], Lote.prototype, "areaM2", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'front_m', type: 'decimal', precision: 8, scale: 2, nullable: true }),
    __metadata("design:type", Number)
], Lote.prototype, "frontM", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'depth_m', type: 'decimal', precision: 8, scale: 2, nullable: true }),
    __metadata("design:type", Number)
], Lote.prototype, "depthM", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar', length: 50, default: 'available' }),
    __metadata("design:type", String)
], Lote.prototype, "status", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'price_base', type: 'decimal', precision: 14, scale: 2, nullable: true }),
    __metadata("design:type", Number)
], Lote.prototype, "priceBase", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'price_final', type: 'decimal', precision: 14, scale: 2, nullable: true }),
    __metadata("design:type", Number)
], Lote.prototype, "priceFinal", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'buyer_id', type: 'uuid', nullable: true }),
    __metadata("design:type", String)
], Lote.prototype, "buyerId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'sale_date', type: 'date', nullable: true }),
    __metadata("design:type", Date)
], Lote.prototype, "saleDate", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'delivery_date', type: 'date', nullable: true }),
    __metadata("design:type", Date)
], Lote.prototype, "deliveryDate", void 0);
__decorate([
    (0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
    __metadata("design:type", Date)
], Lote.prototype, "createdAt", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }),
    __metadata("design:type", String)
], Lote.prototype, "createdBy", void 0);
__decorate([
    (0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz', nullable: true }),
    __metadata("design:type", Date)
], Lote.prototype, "updatedAt", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'updated_by', type: 'uuid', nullable: true }),
    __metadata("design:type", String)
], Lote.prototype, "updatedBy", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'deleted_at', type: 'timestamptz', nullable: true }),
    __metadata("design:type", Date)
], Lote.prototype, "deletedAt", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => manzana_entity_1.Manzana, (m) => m.lotes, { onDelete: 'CASCADE' }),
    (0, typeorm_1.JoinColumn)({ name: 'manzana_id' }),
    __metadata("design:type", manzana_entity_1.Manzana)
], Lote.prototype, "manzana", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => prototipo_entity_1.Prototipo),
    (0, typeorm_1.JoinColumn)({ name: 'prototipo_id' }),
    __metadata("design:type", prototipo_entity_1.Prototipo)
], Lote.prototype, "prototipo", void 0);
exports.Lote = Lote = __decorate([
    (0, typeorm_1.Entity)({ schema: 'construction', name: 'lotes' }),
    (0, typeorm_1.Index)(['manzanaId', 'code'], { unique: true })
], Lote);
//# sourceMappingURL=lote.entity.js.map