"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BankIntegrationAccount = exports.BankIntegrationAccountSchema = void 0;
const mongoose_1 = __importDefault(require("mongoose"));
const _models_1 = require("./_models");
exports.BankIntegrationAccountSchema = new mongoose_1.default.Schema({
    integrationId: {
        type: mongoose_1.default.Schema.Types.ObjectId,
        ref: _models_1.MODEL_NAMES.bankIntegrations,
    },
    externalAccountId: {
        type: String,
    },
    name: {
        type: String,
    },
    accountNumber: {
        type: String,
    },
    accountType: {
        type: String,
    },
    currency: {
        type: String,
    },
    rawPayload: {
        type: String,
    },
    lastSyncAt: {
        type: Date,
    },
    currentBalance: {
        type: Number,
    },
}, { timestamps: true });
exports.BankIntegrationAccountSchema.index({ integrationId: 1, externalAccountId: 1 }, { unique: true });
exports.BankIntegrationAccount = mongoose_1.default.model(_models_1.MODEL_NAMES.bankIntegrationAccounts, exports.BankIntegrationAccountSchema);
