"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CRMProspectSource = exports.CRMProspectSourceSchema = exports.CRMProspectSourceValidationSchema = exports.EProspectSourceType = void 0;
const mongoose_1 = __importDefault(require("mongoose"));
const joi_1 = __importDefault(require("joi"));
const _models_1 = require("./_models");
var EProspectSourceType;
(function (EProspectSourceType) {
    EProspectSourceType["LENDER"] = "LENDER";
    EProspectSourceType["BROKER"] = "BROKER";
    EProspectSourceType["DIRECT"] = "DIRECT";
    EProspectSourceType["INVESTMENT_BANK"] = "INVESTMENT_BANK";
    EProspectSourceType["CONSULTANT"] = "CONSULTANT";
    EProspectSourceType["ATTORNEY"] = "ATTORNEY";
    EProspectSourceType["EQUITY"] = "EQUITY";
    EProspectSourceType["PROFESSIONAL_ORGANIZATION"] = "PROFESSIONAL_ORGANIZATION";
    EProspectSourceType["INSURANCE_AGENCY"] = "INSURANCE_AGENCY";
    EProspectSourceType["OTHER"] = "OTHER";
})(EProspectSourceType || (exports.EProspectSourceType = EProspectSourceType = {}));
exports.CRMProspectSourceValidationSchema = joi_1.default.object({
    _id: joi_1.default.string(),
    name: joi_1.default.string().required(),
    contactPerson: joi_1.default.string().allow('', null).required(),
    emails: joi_1.default.string().allow('', null).required(),
    order: joi_1.default.number().required().allow(null),
    type: joi_1.default.string().valid(...Object.values(EProspectSourceType), null).required(),
});
exports.CRMProspectSourceSchema = new mongoose_1.default.Schema({
    name: {
        type: String,
        required: true,
    },
    contactPerson: {
        type: String,
        required: false,
        default: '',
    },
    emails: {
        type: String,
        required: false,
        default: '',
    },
    order: {
        type: Number,
        required: true,
    },
    type: {
        type: String,
        enum: [...Object.values(EProspectSourceType), null],
        default: null,
        required: false,
    },
}, {
    timestamps: { createdAt: true, updatedAt: true },
    versionKey: false,
});
exports.CRMProspectSource = mongoose_1.default.model(_models_1.MODEL_NAMES.CRMProspectSources, exports.CRMProspectSourceSchema);
