"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Facility = exports.FacilitySchema = void 0;
const mongoose_1 = __importDefault(require("mongoose"));
const _models_1 = require("./_models");
exports.FacilitySchema = new mongoose_1.default.Schema({
    borrowerId: {
        type: mongoose_1.default.Schema.Types.ObjectId,
        ref: _models_1.MODEL_NAMES.borrowers,
        required: true,
    },
    uiId: {
        type: String,
        required: true,
    },
    name: {
        type: 'String',
        required: true,
    },
    order: {
        type: Number,
        required: true,
    },
    deletedAt: {
        type: Date,
    },
}, {
    timestamps: { createdAt: true, updatedAt: true },
    versionKey: false,
});
exports.FacilitySchema.index({ borrowerId: 1, name: 1 }, { unique: true });
exports.Facility = mongoose_1.default.model(_models_1.MODEL_NAMES.facilities, exports.FacilitySchema);
