"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BorrowerSettingsModel = exports.BorrowerSettingsSchema = exports.dataSchema = exports.dataAvailabilitySchema = void 0;
const mongoose_1 = __importDefault(require("mongoose"));
const _models_1 = require("./_models");
exports.dataAvailabilitySchema = new mongoose_1.default.Schema({
    receivables: {
        type: Boolean,
        default: false,
    },
    inventories: {
        type: Boolean,
        default: false,
    },
}, { _id: false, timestamps: false, versionKey: false });
exports.dataSchema = new mongoose_1.default.Schema({
    options: [{
            type: mongoose_1.default.Schema.Types.ObjectId,
            ref: _models_1.MODEL_NAMES.borrowerData,
        }],
    receivables: [{
            type: mongoose_1.default.Schema.Types.ObjectId,
            ref: _models_1.MODEL_NAMES.borrowerDataReceivables,
        }],
    inventories: [{
            type: mongoose_1.default.Schema.Types.ObjectId,
            ref: _models_1.MODEL_NAMES.borrowerDataInventories,
        }],
    terms: [{
            type: mongoose_1.default.Schema.Types.ObjectId,
            ref: _models_1.MODEL_NAMES.borrowerDataTerms,
        }],
    bootCollaterals: [{
            type: mongoose_1.default.Schema.Types.ObjectId,
            ref: _models_1.MODEL_NAMES.borrowerDataBootCollaterals,
        }],
    contacts: [{
            type: mongoose_1.default.Schema.Types.ObjectId,
            ref: _models_1.MODEL_NAMES.borrowerDataContacts,
        }],
    guarantees: [{
            type: mongoose_1.default.Schema.Types.ObjectId,
            ref: _models_1.MODEL_NAMES.borrowerDataGuarantees,
        }],
    locations: [{
            type: mongoose_1.default.Schema.Types.ObjectId,
            ref: _models_1.MODEL_NAMES.borrowerDataLocations,
        }],
    banks: [{
            type: mongoose_1.default.Schema.Types.ObjectId,
            ref: _models_1.MODEL_NAMES.borrowerDataBanks,
        }],
    insurance: [{
            type: mongoose_1.default.Schema.Types.ObjectId,
            ref: _models_1.MODEL_NAMES.borrowerDataInsurances,
        }],
}, { _id: false, timestamps: false, versionKey: false });
exports.BorrowerSettingsSchema = new mongoose_1.default.Schema({
    borrower: {
        type: mongoose_1.default.Schema.Types.ObjectId,
        ref: _models_1.MODEL_NAMES.borrowers,
        required: true,
    },
    queries: {
        required: false,
        type: Object,
        default: {},
    },
    dataTypes: {
        required: false,
        type: Object,
        default: {},
    },
    dataAvailability: exports.dataAvailabilitySchema,
    data: exports.dataSchema,
    __v: { type: Number, select: false },
}, { timestamps: true });
exports.BorrowerSettingsModel = mongoose_1.default.model(_models_1.MODEL_NAMES.borrowerSettings, exports.BorrowerSettingsSchema);
