"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.TransportAssignmentSchema = exports.TransportAssignment = void 0;
const mongoose_1 = require("@nestjs/mongoose");
const base_entity_1 = require("../../common/entities/base.entity");
let TransportAssignment = class TransportAssignment extends base_entity_1.BaseEntity {
    studentId;
    routeId;
    academicYearId;
    routeName;
    installment;
    amount;
    fineAmount;
    dueDate;
    status;
    paidAt;
    paymentMethod;
    receiptNumber;
    razorpayOrderId;
    razorpayPaymentId;
    razorpaySignature;
    collectedBy;
    notes;
    pickupPoint;
    isActive;
};
exports.TransportAssignment = TransportAssignment;
__decorate([
    (0, mongoose_1.Prop)({ required: true }),
    __metadata("design:type", String)
], TransportAssignment.prototype, "studentId", void 0);
__decorate([
    (0, mongoose_1.Prop)({ required: true }),
    __metadata("design:type", String)
], TransportAssignment.prototype, "routeId", void 0);
__decorate([
    (0, mongoose_1.Prop)({ required: true }),
    __metadata("design:type", String)
], TransportAssignment.prototype, "academicYearId", void 0);
__decorate([
    (0, mongoose_1.Prop)({ required: true, trim: true }),
    __metadata("design:type", String)
], TransportAssignment.prototype, "routeName", void 0);
__decorate([
    (0, mongoose_1.Prop)({ required: true, trim: true }),
    __metadata("design:type", String)
], TransportAssignment.prototype, "installment", void 0);
__decorate([
    (0, mongoose_1.Prop)({ required: true, min: 0 }),
    __metadata("design:type", Number)
], TransportAssignment.prototype, "amount", void 0);
__decorate([
    (0, mongoose_1.Prop)({ default: 0, min: 0 }),
    __metadata("design:type", Number)
], TransportAssignment.prototype, "fineAmount", void 0);
__decorate([
    (0, mongoose_1.Prop)({ required: true }),
    __metadata("design:type", Date)
], TransportAssignment.prototype, "dueDate", void 0);
__decorate([
    (0, mongoose_1.Prop)({ required: true, enum: ['pending', 'paid'], default: 'pending' }),
    __metadata("design:type", String)
], TransportAssignment.prototype, "status", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", Date)
], TransportAssignment.prototype, "paidAt", void 0);
__decorate([
    (0, mongoose_1.Prop)({ enum: ['razorpay', 'cash', 'cheque', 'bank_transfer'] }),
    __metadata("design:type", String)
], TransportAssignment.prototype, "paymentMethod", void 0);
__decorate([
    (0, mongoose_1.Prop)({ trim: true }),
    __metadata("design:type", String)
], TransportAssignment.prototype, "receiptNumber", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], TransportAssignment.prototype, "razorpayOrderId", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], TransportAssignment.prototype, "razorpayPaymentId", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], TransportAssignment.prototype, "razorpaySignature", void 0);
__decorate([
    (0, mongoose_1.Prop)(),
    __metadata("design:type", String)
], TransportAssignment.prototype, "collectedBy", void 0);
__decorate([
    (0, mongoose_1.Prop)({ trim: true }),
    __metadata("design:type", String)
], TransportAssignment.prototype, "notes", void 0);
__decorate([
    (0, mongoose_1.Prop)({ trim: true }),
    __metadata("design:type", String)
], TransportAssignment.prototype, "pickupPoint", void 0);
__decorate([
    (0, mongoose_1.Prop)({ default: true }),
    __metadata("design:type", Boolean)
], TransportAssignment.prototype, "isActive", void 0);
exports.TransportAssignment = TransportAssignment = __decorate([
    (0, mongoose_1.Schema)({ timestamps: true })
], TransportAssignment);
exports.TransportAssignmentSchema = mongoose_1.SchemaFactory.createForClass(TransportAssignment);
exports.TransportAssignmentSchema.index({ studentId: 1, academicYearId: 1 });
exports.TransportAssignmentSchema.index({ routeId: 1 });
exports.TransportAssignmentSchema.index({ academicYearId: 1, status: 1 });
exports.TransportAssignmentSchema.index({ status: 1, dueDate: 1 });
exports.TransportAssignmentSchema.index({ razorpayOrderId: 1 }, { unique: true, sparse: true });
exports.TransportAssignmentSchema.index({ receiptNumber: 1 }, { unique: true, sparse: true });
exports.TransportAssignmentSchema.index({ studentId: 1, routeId: 1, installment: 1 }, { unique: true });
exports.TransportAssignmentSchema.index({ studentId: 1, routeId: 1, isActive: 1 });
exports.TransportAssignmentSchema.set('toJSON', { versionKey: false });
exports.TransportAssignmentSchema.set('toObject', { versionKey: false });
//# sourceMappingURL=transport-assignment.schema.js.map