"use strict";
/**
 * BitacoraObra Entity
 * Registro diario de bitacora de obra
 *
 * @module Progress
 * @table construction.bitacora_obra
 * @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.BitacoraObra = 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 fraccionamiento_entity_1 = require("../../construction/entities/fraccionamiento.entity");
let BitacoraObra = class BitacoraObra {
    id;
    tenantId;
    fraccionamientoId;
    entryDate;
    entryNumber;
    weather;
    temperatureMax;
    temperatureMin;
    workersCount;
    description;
    observations;
    incidents;
    registeredById;
    createdAt;
    createdById;
    updatedAt;
    updatedById;
    deletedAt;
    deletedById;
    // Relations
    tenant;
    fraccionamiento;
    registeredBy;
    createdBy;
};
exports.BitacoraObra = BitacoraObra;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
    __metadata("design:type", String)
], BitacoraObra.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }),
    __metadata("design:type", String)
], BitacoraObra.prototype, "tenantId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'fraccionamiento_id', type: 'uuid' }),
    __metadata("design:type", String)
], BitacoraObra.prototype, "fraccionamientoId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'entry_date', type: 'date' }),
    __metadata("design:type", Date)
], BitacoraObra.prototype, "entryDate", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'entry_number', type: 'integer' }),
    __metadata("design:type", Number)
], BitacoraObra.prototype, "entryNumber", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar', length: 50, nullable: true }),
    __metadata("design:type", Object)
], BitacoraObra.prototype, "weather", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'temperature_max', type: 'decimal', precision: 4, scale: 1, nullable: true }),
    __metadata("design:type", Object)
], BitacoraObra.prototype, "temperatureMax", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'temperature_min', type: 'decimal', precision: 4, scale: 1, nullable: true }),
    __metadata("design:type", Object)
], BitacoraObra.prototype, "temperatureMin", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'workers_count', type: 'integer', default: 0 }),
    __metadata("design:type", Number)
], BitacoraObra.prototype, "workersCount", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'text' }),
    __metadata("design:type", String)
], BitacoraObra.prototype, "description", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'text', nullable: true }),
    __metadata("design:type", Object)
], BitacoraObra.prototype, "observations", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'text', nullable: true }),
    __metadata("design:type", Object)
], BitacoraObra.prototype, "incidents", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'registered_by', type: 'uuid' }),
    __metadata("design:type", String)
], BitacoraObra.prototype, "registeredById", void 0);
__decorate([
    (0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
    __metadata("design:type", Date)
], BitacoraObra.prototype, "createdAt", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }),
    __metadata("design:type", Object)
], BitacoraObra.prototype, "createdById", void 0);
__decorate([
    (0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz', nullable: true }),
    __metadata("design:type", Object)
], BitacoraObra.prototype, "updatedAt", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'updated_by', type: 'uuid', nullable: true }),
    __metadata("design:type", Object)
], BitacoraObra.prototype, "updatedById", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'deleted_at', type: 'timestamptz', nullable: true }),
    __metadata("design:type", Object)
], BitacoraObra.prototype, "deletedAt", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'deleted_by', type: 'uuid', nullable: true }),
    __metadata("design:type", Object)
], BitacoraObra.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)
], BitacoraObra.prototype, "tenant", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => fraccionamiento_entity_1.Fraccionamiento),
    (0, typeorm_1.JoinColumn)({ name: 'fraccionamiento_id' }),
    __metadata("design:type", fraccionamiento_entity_1.Fraccionamiento)
], BitacoraObra.prototype, "fraccionamiento", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => user_entity_1.User),
    (0, typeorm_1.JoinColumn)({ name: 'registered_by' }),
    __metadata("design:type", user_entity_1.User)
], BitacoraObra.prototype, "registeredBy", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => user_entity_1.User),
    (0, typeorm_1.JoinColumn)({ name: 'created_by' }),
    __metadata("design:type", Object)
], BitacoraObra.prototype, "createdBy", void 0);
exports.BitacoraObra = BitacoraObra = __decorate([
    (0, typeorm_1.Entity)({ schema: 'construction', name: 'bitacora_obra' }),
    (0, typeorm_1.Index)(['fraccionamientoId', 'entryNumber'], { unique: true }),
    (0, typeorm_1.Index)(['tenantId']),
    (0, typeorm_1.Index)(['fraccionamientoId'])
], BitacoraObra);
//# sourceMappingURL=bitacora-obra.entity.js.map