"use strict"; 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.Fiado = exports.FiadoStatus = void 0; const typeorm_1 = require("typeorm"); const customer_entity_1 = require("./customer.entity"); const fiado_payment_entity_1 = require("./fiado-payment.entity"); var FiadoStatus; (function (FiadoStatus) { FiadoStatus["PENDING"] = "pending"; FiadoStatus["PARTIAL"] = "partial"; FiadoStatus["PAID"] = "paid"; FiadoStatus["CANCELLED"] = "cancelled"; })(FiadoStatus || (exports.FiadoStatus = FiadoStatus = {})); let Fiado = class Fiado { }; exports.Fiado = Fiado; __decorate([ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'), __metadata("design:type", String) ], Fiado.prototype, "id", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'tenant_id' }), __metadata("design:type", String) ], Fiado.prototype, "tenantId", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'customer_id' }), __metadata("design:type", String) ], Fiado.prototype, "customerId", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'sale_id', nullable: true }), __metadata("design:type", String) ], Fiado.prototype, "saleId", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'decimal', precision: 10, scale: 2 }), __metadata("design:type", Number) ], Fiado.prototype, "amount", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'paid_amount', type: 'decimal', precision: 10, scale: 2, default: 0 }), __metadata("design:type", Number) ], Fiado.prototype, "paidAmount", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'remaining_amount', type: 'decimal', precision: 10, scale: 2 }), __metadata("design:type", Number) ], Fiado.prototype, "remainingAmount", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'text', nullable: true }), __metadata("design:type", String) ], Fiado.prototype, "description", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'varchar', length: 20, default: FiadoStatus.PENDING, }), __metadata("design:type", String) ], Fiado.prototype, "status", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'due_date', type: 'date', nullable: true }), __metadata("design:type", Date) ], Fiado.prototype, "dueDate", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'paid_at', type: 'timestamptz', nullable: true }), __metadata("design:type", Date) ], Fiado.prototype, "paidAt", void 0); __decorate([ (0, typeorm_1.CreateDateColumn)({ name: 'created_at' }), __metadata("design:type", Date) ], Fiado.prototype, "createdAt", void 0); __decorate([ (0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }), __metadata("design:type", Date) ], Fiado.prototype, "updatedAt", void 0); __decorate([ (0, typeorm_1.ManyToOne)(() => customer_entity_1.Customer, (customer) => customer.fiados), (0, typeorm_1.JoinColumn)({ name: 'customer_id' }), __metadata("design:type", customer_entity_1.Customer) ], Fiado.prototype, "customer", void 0); __decorate([ (0, typeorm_1.OneToMany)(() => fiado_payment_entity_1.FiadoPayment, (payment) => payment.fiado), __metadata("design:type", Array) ], Fiado.prototype, "payments", void 0); exports.Fiado = Fiado = __decorate([ (0, typeorm_1.Entity)({ schema: 'customers', name: 'fiados' }) ], Fiado); //# sourceMappingURL=fiado.entity.js.map