"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TermLoanModel = exports.TermLoanSchema = exports.TERM_LOAN_FIELDS = exports.ETermLoanStatus = void 0;
const mongoose_1 = __importDefault(require("mongoose"));
const _models_1 = require("./_models");
var ETermLoanStatus;
(function (ETermLoanStatus) {
    ETermLoanStatus["NEW"] = "NEW";
    ETermLoanStatus["CALCULATED"] = "CALCULATED";
    ETermLoanStatus["CALCULATING"] = "CALCULATING";
    ETermLoanStatus["ERROR"] = "ERROR";
    ETermLoanStatus["EXPECTED"] = "EXPECTED";
})(ETermLoanStatus || (exports.ETermLoanStatus = ETermLoanStatus = {}));
exports.TERM_LOAN_FIELDS = [
    '_id',
    'productId',
    'loanStartDate',
    'initialBalance',
    'interestRate',
    'adminRate',
    'primeRate',
    'actual',
    'isMismatched',
    'lastCalculated',
    'calculationStatus',
];
exports.TermLoanSchema = new mongoose_1.default.Schema({
    productId: {
        type: mongoose_1.default.Schema.Types.ObjectId,
        ref: _models_1.MODEL_NAMES.loanProducts,
        required: true,
    },
    loanStartDate: {
        type: Date,
        required: true,
    },
    initialBalance: {
        type: Number,
        required: true,
    },
    interestRate: {
        type: Number,
        required: true,
    },
    adminRate: {
        type: Number,
        required: true,
    },
    primeRate: {
        type: Number,
        required: true,
    },
    actual: {
        type: Boolean,
        required: true,
    },
    isMismatched: {
        type: Boolean,
        required: true,
    },
    lastCalculated: {
        type: Date,
        required: true,
    },
    calculationStatus: {
        type: String,
        required: true,
    },
    __v: { type: Number, select: false },
}, { timestamps: true });
exports.TermLoanModel = mongoose_1.default.model(_models_1.MODEL_NAMES.termLoan, exports.TermLoanSchema);
