/**
 * Expense Scenario A: Local Currency (ILS) Receipt Expense
 *
 * This scenario represents a simple expense paid in local currency (ILS) with a receipt.
 * It demonstrates the basic happy path for expense recording and ledger generation.
 *
 * Flow:
 * 1. Admin business purchases from Local Supplier Ltd
 * 2. Transaction recorded: -500 ILS (negative = expense/outflow)
 * 3. Receipt document provided matching the transaction
 * 4. Expected ledger: debit expense category, credit bank account
 *
 * Prerequisites:
 * - Admin business entity exists (from seed)
 * - General expense tax category exists (from seed)
 */
import { createBusiness, createCharge, createDocument, createTransaction, createTaxCategory, createFinancialAccount, } from '../../factories';
import { makeUUID } from '../../../demo-fixtures/helpers/deterministic-uuid.js';
import { Currency, CountryCode } from '../../../shared/enums.js';
const ADMIN_ID = makeUUID('business', 'admin-business-scenario-a');
/**
 * Expense Scenario A: ILS Receipt Expense
 *
 * @description
 * A local supplier provides a service, admin pays 500 ILS, receives a receipt.
 * This is the simplest expense case with matching transaction and document.
 *
 * @example
 * ```typescript
 * import { expenseScenarioA } from './fixtures/expenses/expense-scenario-a';
 * import { insertFixture } from './helpers/fixture-loader';
 *
 * await withTestTransaction(pool, async (client) => {
 *   await seedAdminCore(client); // Ensure admin context exists
 *   const idMap = await insertFixture(client, expenseScenarioA);
 *
 *   // Now test ledger generation
 *   const chargeId = idMap.get('charge-office-supplies');
 *   // ... trigger ledger generation and assert
 * });
 * ```
 */
export const expenseScenarioA = {
    businesses: {
        businesses: [
            // Admin business (owner of the expense)
            createBusiness({
                id: ADMIN_ID,
                name: 'Accountancy Management',
                country: CountryCode.Israel,
            }),
            // Supplier business
            createBusiness({
                id: makeUUID('business', 'supplier-local-ltd'),
                name: 'Local Supplier Ltd',
                country: CountryCode.Israel,
                exemptDealer: false,
                isReceiptEnough: true, // Can provide receipts for small purchases
                ownerId: ADMIN_ID,
            }),
        ],
    },
    taxCategories: {
        taxCategories: [
            createTaxCategory({
                id: makeUUID('tax-category', 'expense-general'),
                name: 'General Expenses',
                ownerId: ADMIN_ID,
            }),
            createTaxCategory({
                id: makeUUID('tax-category', 'bank-account-tax-category'),
                name: 'Bank Account',
                ownerId: ADMIN_ID,
            }),
        ],
    },
    accounts: {
        accounts: [
            createFinancialAccount({
                accountNumber: 'BANK-ACCOUNT-001',
                type: 'BANK_ACCOUNT',
                ownerId: ADMIN_ID,
            }),
        ],
    },
    accountTaxCategories: {
        mappings: [
            {
                accountNumber: 'BANK-ACCOUNT-001',
                currency: Currency.Ils,
                taxCategoryId: makeUUID('tax-category', 'bank-account-tax-category'),
                ownerId: ADMIN_ID,
            },
        ],
    },
    charges: {
        charges: [
            createCharge({
                owner_id: ADMIN_ID,
                tax_category_id: makeUUID('tax-category', 'expense-general'),
                user_description: 'Office supplies purchase',
            }, {
                id: makeUUID('charge', 'charge-office-supplies'),
            }),
        ],
    },
    transactions: {
        transactions: [
            createTransaction({
                charge_id: makeUUID('charge', 'charge-office-supplies'),
                business_id: makeUUID('business', 'supplier-local-ltd'),
                amount: '-500.00', // Negative = expense/outflow
                currency: Currency.Ils,
                event_date: '2024-01-15',
                is_fee: false,
                owner_id: ADMIN_ID,
            }, {
                id: makeUUID('transaction', 'transaction-supplies-payment'),
                account_id: 'BANK-ACCOUNT-001', // Will be resolved to UUID by loader
                source_description: 'Office supplies - Local Supplier Ltd',
                debit_date: '2024-01-15',
                current_balance: '0', // Placeholder - not critical for test
                owner_id: ADMIN_ID,
            }),
        ],
    },
    documents: {
        documents: [
            createDocument({
                charge_id: makeUUID('charge', 'charge-office-supplies'),
                creditor_id: makeUUID('business', 'supplier-local-ltd'), // Supplier is creditor
                debtor_id: makeUUID('business', 'admin-business-scenario-a'), // Admin is debtor (owes money)
                type: 'RECEIPT',
                total_amount: 500.0, // Matches transaction amount (positive in document)
                currency_code: Currency.Ils,
                date: '2024-01-15', // Receipt date matches transaction
                owner_id: ADMIN_ID,
            }, {
                id: makeUUID('document', 'document-supplies-receipt'),
                serial_number: 'RCP-2024-001',
                vat_amount: null, // For simplicity, no VAT breakdown on receipt
                owner_id: ADMIN_ID,
            }),
        ],
    },
    expectations: {
        ledger: [
            {
                chargeId: makeUUID('charge', 'charge-office-supplies'),
                recordCount: 2, // Debit expense + credit bank
                debitEntities: [makeUUID('tax-category', 'expense-general')],
                creditEntities: [makeUUID('tax-category', 'bank-account-tax-category')],
                totalDebitLocal: 500.0,
                totalCreditLocal: 500.0,
                balanced: true,
                ownerId: ADMIN_ID,
            },
        ],
    },
};
//# sourceMappingURL=expense-scenario-a.js.map