"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LoanProduct = exports.LoanProductSchema = void 0;
const mongoose_1 = __importDefault(require("mongoose"));
const _models_1 = require("./_models");
exports.LoanProductSchema = new mongoose_1.default.Schema({
    borrowerId: {
        type: mongoose_1.default.Schema.Types.ObjectId,
        ref: _models_1.MODEL_NAMES.borrowers,
        required: true,
    },
    facilityId: {
        type: mongoose_1.default.Schema.Types.ObjectId,
        ref: _models_1.MODEL_NAMES.facilities,
    },
    order: {
        type: Number,
        required: true,
    },
    active: {
        type: Boolean,
        required: true,
    },
    code: {
        type: String,
        trim: true,
        required: true,
    },
    masterCode: {
        type: String,
        trim: false,
    },
    name: {
        type: String,
        trim: true,
        required: true,
    },
    type: {
        type: String,
        required: true,
        trim: true,
    },
    startDate: {
        type: Date,
        required: true,
    },
    maturityDate: {
        type: Date,
        required: true,
    },
    payoffDate: {
        type: Date,
    },
    commitment: {
        type: Number,
        required: true,
    },
    isBalanceActual: {
        type: Boolean,
        required: true,
        default: true,
    },
    isFloatedBalanceActual: {
        type: Boolean,
        required: true,
        default: true,
    },
    isParticipant: {
        type: Boolean,
        required: false,
    },
    masterLoanProductId: {
        type: mongoose_1.default.Schema.Types.ObjectId,
        ref: _models_1.MODEL_NAMES.loanProducts,
        default: null,
    },
    minPercent: {
        type: Number,
        required: false,
    },
    maxPercent: {
        type: Number,
        required: false,
    },
    prepaymentDate: {
        type: Date,
    },
    prepaymentTerms: {
        type: String,
        trim: true,
    },
    settlementCode: {
        type: String,
        trim: true,
    },
    isDefaultPaymentOrder: {
        type: Boolean,
        required: true,
    },
    deactivationDate: {
        type: Date,
    },
    __v: { type: Number, select: false },
}, { timestamps: true });
exports.LoanProduct = mongoose_1.default.model(_models_1.MODEL_NAMES.loanProducts, exports.LoanProductSchema);
