"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.TransportRouteSchema = exports.TransportRoute = void 0;
const mongoose_1 = require("@nestjs/mongoose");
const base_entity_1 = require("../../common/entities/base.entity");
let LateFineSlab = class LateFineSlab {
    startDay;
    endDay;
    amount;
};
__decorate([
    (0, mongoose_1.Prop)({ required: true, min: 1 }),
    __metadata("design:type", Number)
], LateFineSlab.prototype, "startDay", void 0);
__decorate([
    (0, mongoose_1.Prop)({ required: true, min: 1 }),
    __metadata("design:type", Number)
], LateFineSlab.prototype, "endDay", void 0);
__decorate([
    (0, mongoose_1.Prop)({ required: true, min: 0 }),
    __metadata("design:type", Number)
], LateFineSlab.prototype, "amount", void 0);
LateFineSlab = __decorate([
    (0, mongoose_1.Schema)({ _id: false })
], LateFineSlab);
const LateFineSlabSchema = mongoose_1.SchemaFactory.createForClass(LateFineSlab);
let LateFineRule = class LateFineRule {
    enabled;
    type;
    amountPerDay;
    percentage;
    slabs;
};
__decorate([
    (0, mongoose_1.Prop)({ default: false }),
    __metadata("design:type", Boolean)
], LateFineRule.prototype, "enabled", void 0);
__decorate([
    (0, mongoose_1.Prop)({ enum: ['percentage', 'per_day', 'day_wise_slab'], default: 'per_day' }),
    __metadata("design:type", String)
], LateFineRule.prototype, "type", void 0);
__decorate([
    (0, mongoose_1.Prop)({ default: 0, min: 0 }),
    __metadata("design:type", Number)
], LateFineRule.prototype, "amountPerDay", void 0);
__decorate([
    (0, mongoose_1.Prop)({ default: 0, min: 0 }),
    __metadata("design:type", Number)
], LateFineRule.prototype, "percentage", void 0);
__decorate([
    (0, mongoose_1.Prop)({ type: [LateFineSlabSchema], default: [] }),
    __metadata("design:type", Array)
], LateFineRule.prototype, "slabs", void 0);
LateFineRule = __decorate([
    (0, mongoose_1.Schema)({ _id: false })
], LateFineRule);
const LateFineRuleSchema = mongoose_1.SchemaFactory.createForClass(LateFineRule);
let TransportRoute = class TransportRoute extends base_entity_1.BaseEntity {
    name;
    description;
    academicYearId;
    monthlyFee;
    stops;
    vehicleNumber;
    driverName;
    driverPhone;
    dueDay;
    lateFine;
    isActive;
};
exports.TransportRoute = TransportRoute;
__decorate([
    (0, mongoose_1.Prop)({ required: true, trim: true }),
    __metadata("design:type", String)
], TransportRoute.prototype, "name", void 0);
__decorate([
    (0, mongoose_1.Prop)({ trim: true }),
    __metadata("design:type", String)
], TransportRoute.prototype, "description", void 0);
__decorate([
    (0, mongoose_1.Prop)({ required: true }),
    __metadata("design:type", String)
], TransportRoute.prototype, "academicYearId", void 0);
__decorate([
    (0, mongoose_1.Prop)({ required: true, min: 0 }),
    __metadata("design:type", Number)
], TransportRoute.prototype, "monthlyFee", void 0);
__decorate([
    (0, mongoose_1.Prop)({ type: [String], default: [] }),
    __metadata("design:type", Array)
], TransportRoute.prototype, "stops", void 0);
__decorate([
    (0, mongoose_1.Prop)({ trim: true }),
    __metadata("design:type", String)
], TransportRoute.prototype, "vehicleNumber", void 0);
__decorate([
    (0, mongoose_1.Prop)({ trim: true }),
    __metadata("design:type", String)
], TransportRoute.prototype, "driverName", void 0);
__decorate([
    (0, mongoose_1.Prop)({ trim: true }),
    __metadata("design:type", String)
], TransportRoute.prototype, "driverPhone", void 0);
__decorate([
    (0, mongoose_1.Prop)({ required: true, min: 1, max: 31, default: 10 }),
    __metadata("design:type", Number)
], TransportRoute.prototype, "dueDay", void 0);
__decorate([
    (0, mongoose_1.Prop)({ type: LateFineRuleSchema, default: () => ({ enabled: false, type: 'per_day', amountPerDay: 0, percentage: 0, slabs: [] }) }),
    __metadata("design:type", LateFineRule)
], TransportRoute.prototype, "lateFine", void 0);
__decorate([
    (0, mongoose_1.Prop)({ default: true }),
    __metadata("design:type", Boolean)
], TransportRoute.prototype, "isActive", void 0);
exports.TransportRoute = TransportRoute = __decorate([
    (0, mongoose_1.Schema)({ timestamps: true })
], TransportRoute);
exports.TransportRouteSchema = mongoose_1.SchemaFactory.createForClass(TransportRoute);
exports.TransportRouteSchema.index({ academicYearId: 1 });
exports.TransportRouteSchema.index({ name: 1, academicYearId: 1 }, { unique: true });
exports.TransportRouteSchema.index({ isActive: 1 });
exports.TransportRouteSchema.set('toJSON', { versionKey: false });
exports.TransportRouteSchema.set('toObject', { versionKey: false });
//# sourceMappingURL=transport-route.schema.js.map