"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReceivableAvailabilityItemModel = exports.ReceivableAvailabilityItemSchema = void 0;
const mongoose_1 = __importDefault(require("mongoose"));
const _models_1 = require("./_models");
const mongooseLeanId = require('../plugins/id.plugin');
exports.ReceivableAvailabilityItemSchema = new mongoose_1.default.Schema({
    availabilityId: {
        type: mongoose_1.default.Schema.Types.ObjectId,
        ref: _models_1.MODEL_NAMES.ARAvailabilities,
        required: true,
    },
    order: {
        type: Number,
        required: true,
    },
    invoiceId: {
        type: mongoose_1.default.Schema.Types.ObjectId,
        ref: _models_1.MODEL_NAMES.receivableItems,
        required: true,
    },
    bucketCurrent: {
        type: Number,
        required: false,
    },
    bucket30: {
        type: Number,
        required: false,
    },
    bucket60: {
        type: Number,
        required: false,
    },
    actualDays: {
        type: Number,
        required: false,
    },
    permittedDays: {
        type: Number,
        required: false,
    },
    permitted60: {
        type: Number,
        required: false,
    },
    permittedOver: {
        type: Number,
        required: false,
    },
    grossAR: {
        type: Number,
        required: false,
    },
    creditNotes: {
        type: Number,
        required: false,
    },
    preliminaryEligibleBalance: {
        type: Number,
        required: false,
    },
    permittedCustomerConcentration: {
        type: Number,
        required: false,
    },
    customerConcentration: {
        type: Number,
        required: false,
    },
    deductionPercent: {
        type: Number,
        required: false,
    },
    deduction: {
        type: Number,
        required: false,
    },
    balanceAfterDeduction: {
        type: Number,
        required: false,
    },
    partiallyPaidDifference: {
        type: Boolean,
        required: false,
    },
    partiallyPaidDeduction: {
        type: Number,
        required: false,
    },
    balanceAfterPartially: {
        type: Number,
        required: false,
    },
    excludedCustomer: {
        type: Boolean,
        required: false,
    },
    excludedCustomerDeduction: {
        type: Number,
        required: false,
    },
    balanceAfterExclusion: {
        type: Number,
        required: false,
    },
    customerGroupId: {
        type: mongoose_1.default.Schema.Types.ObjectId,
        ref: _models_1.MODEL_NAMES.customerGroups,
        required: false,
    },
    contra: {
        type: Number,
        required: false,
    },
    contraDeduction: {
        type: Number,
        required: false,
    },
    balanceAfterContra: {
        type: Number,
        required: false,
    },
    crossAge: {
        type: Number,
        required: false,
    },
    crossAgeDeduction: {
        type: Number,
        required: false,
    },
    balanceAfterCrossAge: {
        type: Number,
        required: false,
    },
    waivedDeduction: {
        type: Number,
        required: false,
    },
    finalResult: {
        type: Number,
        required: false,
    },
    insuredComponent: {
        type: Number,
        required: false,
    },
    uninsuredComponent: {
        type: Number,
        required: false,
    },
    __v: { type: Number, select: false },
}, { timestamps: true });
exports.ReceivableAvailabilityItemSchema.plugin(mongooseLeanId);
exports.ReceivableAvailabilityItemModel = mongoose_1.default.model(_models_1.MODEL_NAMES.ARAvailabilityItems, exports.ReceivableAvailabilityItemSchema);
