"use strict"; /** * ContractAddendum Entity * Addendas y modificaciones a contratos * * @module Contracts * @table contracts.contract_addendums */ 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.ContractAddendum = 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 contract_entity_1 = require("./contract.entity"); let ContractAddendum = class ContractAddendum { id; tenantId; contractId; addendumNumber; addendumType; title; description; effectiveDate; // Changes newEndDate; amountChange; newContractAmount; scopeChanges; // Status status; approvedAt; approvedById; rejectionReason; // Document documentUrl; notes; createdAt; createdById; updatedAt; updatedById; // Relations tenant; contract; createdBy; approvedBy; }; exports.ContractAddendum = ContractAddendum; __decorate([ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'), __metadata("design:type", String) ], ContractAddendum.prototype, "id", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }), __metadata("design:type", String) ], ContractAddendum.prototype, "tenantId", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'contract_id', type: 'uuid' }), __metadata("design:type", String) ], ContractAddendum.prototype, "contractId", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'addendum_number', type: 'varchar', length: 50 }), __metadata("design:type", String) ], ContractAddendum.prototype, "addendumNumber", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'addendum_type', type: 'varchar', length: 30 }), __metadata("design:type", String) ], ContractAddendum.prototype, "addendumType", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'varchar', length: 255 }), __metadata("design:type", String) ], ContractAddendum.prototype, "title", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'text' }), __metadata("design:type", String) ], ContractAddendum.prototype, "description", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'effective_date', type: 'date' }), __metadata("design:type", Date) ], ContractAddendum.prototype, "effectiveDate", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'new_end_date', type: 'date', nullable: true }), __metadata("design:type", Date) ], ContractAddendum.prototype, "newEndDate", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'amount_change', type: 'decimal', precision: 16, scale: 2, default: 0 }), __metadata("design:type", Number) ], ContractAddendum.prototype, "amountChange", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'new_contract_amount', type: 'decimal', precision: 16, scale: 2, nullable: true }), __metadata("design:type", Number) ], ContractAddendum.prototype, "newContractAmount", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'scope_changes', type: 'text', nullable: true }), __metadata("design:type", String) ], ContractAddendum.prototype, "scopeChanges", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'varchar', length: 20, default: 'draft' }), __metadata("design:type", String) ], ContractAddendum.prototype, "status", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'approved_at', type: 'timestamptz', nullable: true }), __metadata("design:type", Date) ], ContractAddendum.prototype, "approvedAt", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'approved_by', type: 'uuid', nullable: true }), __metadata("design:type", String) ], ContractAddendum.prototype, "approvedById", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'rejection_reason', type: 'text', nullable: true }), __metadata("design:type", String) ], ContractAddendum.prototype, "rejectionReason", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'document_url', type: 'varchar', length: 500, nullable: true }), __metadata("design:type", String) ], ContractAddendum.prototype, "documentUrl", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'text', nullable: true }), __metadata("design:type", String) ], ContractAddendum.prototype, "notes", void 0); __decorate([ (0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }), __metadata("design:type", Date) ], ContractAddendum.prototype, "createdAt", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }), __metadata("design:type", String) ], ContractAddendum.prototype, "createdById", void 0); __decorate([ (0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz' }), __metadata("design:type", Date) ], ContractAddendum.prototype, "updatedAt", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'updated_by', type: 'uuid', nullable: true }), __metadata("design:type", String) ], ContractAddendum.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) ], ContractAddendum.prototype, "tenant", void 0); __decorate([ (0, typeorm_1.ManyToOne)(() => contract_entity_1.Contract, (c) => c.addendums, { onDelete: 'CASCADE' }), (0, typeorm_1.JoinColumn)({ name: 'contract_id' }), __metadata("design:type", contract_entity_1.Contract) ], ContractAddendum.prototype, "contract", 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) ], ContractAddendum.prototype, "createdBy", void 0); __decorate([ (0, typeorm_1.ManyToOne)(() => user_entity_1.User), (0, typeorm_1.JoinColumn)({ name: 'approved_by' }), __metadata("design:type", user_entity_1.User) ], ContractAddendum.prototype, "approvedBy", void 0); exports.ContractAddendum = ContractAddendum = __decorate([ (0, typeorm_1.Entity)({ schema: 'contracts', name: 'contract_addendums' }), (0, typeorm_1.Index)(['tenantId', 'addendumNumber'], { unique: true }) ], ContractAddendum); //# sourceMappingURL=contract-addendum.entity.js.map