"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TermLoanCalculatedModel = exports.TermLoanCalculatedSchema = void 0;
const mongoose_1 = __importDefault(require("mongoose"));
const _models_1 = require("./_models");
exports.TermLoanCalculatedSchema = new mongoose_1.default.Schema({
    termLoanId: {
        type: mongoose_1.default.Schema.Types.ObjectId,
        ref: _models_1.MODEL_NAMES.termLoan,
        required: true,
    },
    relevantStatement: {
        type: String,
        required: true,
    },
    openingBalance: {
        type: Number,
        required: true,
    },
    monthlyInterest: {
        type: Number,
        required: true,
    },
    monthlyPrincipal: {
        type: Number,
        required: true,
    },
    closingBalance: {
        type: Number,
        required: true,
    },
    adminFee: {
        type: Number,
        required: true,
    },
    interestRate: {
        type: Number,
        required: true,
    },
    interestDaily: {
        type: Number,
        required: true,
    },
    gracePeriod: {
        type: Boolean,
        required: true,
    },
    amortization: {
        type: Boolean,
        required: true,
    },
    paymentDueDate: {
        type: Date,
        required: false,
    },
    payments: [
        {
            amount: {
                type: Number,
                required: true,
            },
            paymentId: {
                type: mongoose_1.default.Schema.Types.ObjectId,
                ref: _models_1.MODEL_NAMES.loanTransactions,
                required: true,
            },
        },
    ],
    disbursements: {
        type: Number,
        required: true,
    },
    dailyResults: [{
            day: {
                type: String,
                required: true,
            },
            interestRate: {
                type: Number,
                required: true,
            },
            interest: {
                type: Number,
                required: true,
            },
            paymentDate: {
                type: Boolean,
                required: true,
            },
        }],
    __v: { type: Number, select: false },
}, { timestamps: true });
exports.TermLoanCalculatedModel = mongoose_1.default.model(_models_1.MODEL_NAMES.termLoanCalculated, exports.TermLoanCalculatedSchema);
