"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UploadedBankTransaction = exports.UploadedBankTransactionSchema = void 0;
const mongoose_1 = __importDefault(require("mongoose"));
const _models_1 = require("./_models");
const SplitTransactionSchema = new mongoose_1.default.Schema({
    reference: {
        type: String,
        required: true,
    },
    referenceId: {
        type: mongoose_1.default.Schema.Types.ObjectId,
        ref: _models_1.MODEL_NAMES.cashAllocationReferences,
        required: true,
    },
    memo: {
        type: String,
        required: false,
    },
    amount: {
        type: Number,
        required: true,
    },
});
exports.UploadedBankTransactionSchema = new mongoose_1.default.Schema({
    date: {
        type: Date,
        required: true,
    },
    accountNumber: {
        type: String,
        required: false,
        trim: true,
    },
    amount: {
        type: Number,
        required: true,
    },
    transactionType: {
        type: String,
        required: false,
        trim: true,
    },
    reference: {
        type: String,
        required: true,
        trim: true,
    },
    detail1: {
        type: String,
        required: false,
        trim: true,
    },
    detail2: {
        type: String,
        required: false,
        trim: true,
    },
    detail3: {
        type: String,
        required: false,
        trim: true,
    },
    isConverted: {
        type: Boolean,
        required: false,
    },
    loanTransactionIds: [{
            type: mongoose_1.default.Schema.Types.ObjectId,
            ref: _models_1.MODEL_NAMES.loanTransactions,
            required: false,
        }],
    splitTransactions: [SplitTransactionSchema],
    bankIntegrationTransactionId: {
        type: mongoose_1.default.Schema.Types.ObjectId,
        ref: _models_1.MODEL_NAMES.bankIntegrationTransactions,
        required: false,
    },
}, { timestamps: { createdAt: true, updatedAt: false } });
exports.UploadedBankTransaction = mongoose_1.default.model(_models_1.MODEL_NAMES.uploadedBankTransactions, exports.UploadedBankTransactionSchema);
