"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLoanChargeForProduct = void 0;
const mongoose_1 = __importDefault(require("mongoose"));
const LoanCharges_model_1 = require("../models/LoanCharges.model");
const loan_products_db_1 = require("./loan-products.db");
const getLoanChargeForProduct = async (productId) => {
    return LoanCharges_model_1.LoanCharge.aggregate([
        {
            $match: {
                'productId': new mongoose_1.default.Types.ObjectId(productId),
                'deletedAt': { $exists: false },
            },
        }, {
            $sort: {
                'order': 1,
            },
        }, {
            $unset: loan_products_db_1.fieldsToUnset,
        },
    ]);
};
exports.getLoanChargeForProduct = getLoanChargeForProduct;
