"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.InventoryModel = exports.InventorySchema = void 0;
const mongoose_1 = __importDefault(require("mongoose"));
const _models_1 = require("./_models");
const mongooseLeanId = require('../plugins/id.plugin');
exports.InventorySchema = new mongoose_1.default.Schema({
    borrowerId: {
        type: String,
        trim: true,
        required: true,
    },
    bbcDate: {
        type: Date,
        required: true,
    },
    uploadUser: {
        type: String,
        trim: true,
    },
    fileHash: {
        type: String,
        trim: true,
    },
    fileName: {
        type: String,
        trim: true,
    },
    sheetName: {
        type: String,
        trim: true,
    },
    comment: {
        type: String,
        trim: true,
    },
    items: [
        {
            bbcDate: {
                type: Date,
                required: true,
            },
            skuDate: {
                type: Date,
                required: true,
            },
            category: {
                type: String,
                trim: true,
                required: true,
                default: 'NO CATEGORY',
            },
            sku: {
                type: String,
                trim: true,
                required: true,
            },
            lotNumber: {
                type: String,
                trim: true,
                required: false,
            },
            qty: {
                type: Number,
                required: true,
            },
            value: {
                type: Number,
                required: true,
            },
            expiryDate: {
                type: Date,
            },
            location: {
                type: String,
                trim: true,
            },
            unitCost: {
                type: Number,
            },
            skuDescription1: {
                type: String,
                trim: true,
            },
            skuDescription2: {
                type: String,
                trim: true,
            },
            skuDescription3: {
                type: String,
                trim: true,
            },
        },
    ],
    __v: { type: Number, select: false },
}, { timestamps: true });
exports.InventorySchema.plugin(mongooseLeanId);
exports.InventoryModel = mongoose_1.default.model(_models_1.MODEL_NAMES.inventories, exports.InventorySchema);
