"use strict";
/**
 * HistoricoPuntos Entity
 * Histórico de puntos de crédito INFONAVIT
 *
 * @module Infonavit
 * @table infonavit.historico_puntos
 */
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.HistoricoPuntos = 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 derechohabiente_entity_1 = require("./derechohabiente.entity");
let HistoricoPuntos = class HistoricoPuntos {
    id;
    tenantId;
    derechohabienteId;
    recordDate;
    previousPoints;
    newPoints;
    pointsChange;
    movementType;
    source;
    notes;
    createdAt;
    createdById;
    // Relations
    tenant;
    derechohabiente;
    createdBy;
};
exports.HistoricoPuntos = HistoricoPuntos;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
    __metadata("design:type", String)
], HistoricoPuntos.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }),
    __metadata("design:type", String)
], HistoricoPuntos.prototype, "tenantId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'derechohabiente_id', type: 'uuid' }),
    __metadata("design:type", String)
], HistoricoPuntos.prototype, "derechohabienteId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'record_date', type: 'date' }),
    __metadata("design:type", Date)
], HistoricoPuntos.prototype, "recordDate", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'previous_points', type: 'integer' }),
    __metadata("design:type", Number)
], HistoricoPuntos.prototype, "previousPoints", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'new_points', type: 'integer' }),
    __metadata("design:type", Number)
], HistoricoPuntos.prototype, "newPoints", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'points_change', type: 'integer' }),
    __metadata("design:type", Number)
], HistoricoPuntos.prototype, "pointsChange", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'movement_type', type: 'varchar', length: 20 }),
    __metadata("design:type", String)
], HistoricoPuntos.prototype, "movementType", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
    __metadata("design:type", String)
], HistoricoPuntos.prototype, "source", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'text', nullable: true }),
    __metadata("design:type", String)
], HistoricoPuntos.prototype, "notes", void 0);
__decorate([
    (0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
    __metadata("design:type", Date)
], HistoricoPuntos.prototype, "createdAt", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }),
    __metadata("design:type", String)
], HistoricoPuntos.prototype, "createdById", 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)
], HistoricoPuntos.prototype, "tenant", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => derechohabiente_entity_1.Derechohabiente, (d) => d.historicoPuntos, { onDelete: 'CASCADE' }),
    (0, typeorm_1.JoinColumn)({ name: 'derechohabiente_id' }),
    __metadata("design:type", derechohabiente_entity_1.Derechohabiente)
], HistoricoPuntos.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)
], HistoricoPuntos.prototype, "createdBy", void 0);
exports.HistoricoPuntos = HistoricoPuntos = __decorate([
    (0, typeorm_1.Entity)({ schema: 'infonavit', name: 'historico_puntos' }),
    (0, typeorm_1.Index)(['tenantId', 'derechohabienteId', 'recordDate'])
], HistoricoPuntos);
//# sourceMappingURL=historico-puntos.entity.js.map