"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LoanBrokerModel = exports.LoanBrokerSchema = exports.LoanBrokerValidationSchema = void 0;
const mongoose_1 = __importDefault(require("mongoose"));
const joi_1 = __importDefault(require("joi"));
const _models_1 = require("./_models");
exports.LoanBrokerValidationSchema = joi_1.default.object({
    _id: joi_1.default.string().allow(null),
    order: joi_1.default.number(),
    active: joi_1.default.boolean().required(),
    name: joi_1.default.string().required(),
    emails: joi_1.default.array(),
});
exports.LoanBrokerSchema = new mongoose_1.default.Schema({
    order: {
        type: Number,
        required: true,
    },
    active: {
        type: Boolean,
        required: true,
    },
    name: {
        type: String,
        required: true,
        trim: true,
    },
    emails: [{
            email: {
                type: String,
                required: true,
                trim: true,
            },
            title: {
                type: String,
                required: true,
                trim: true,
            },
            isActive: {
                type: Boolean,
                required: true,
            },
        }],
    __v: { type: Number, select: false },
}, { timestamps: true });
exports.LoanBrokerModel = mongoose_1.default.model(_models_1.MODEL_NAMES.loanBrokers, exports.LoanBrokerSchema);
