export interface LedgerRecord {
    id: string;
    owner_id: string | null;
    charge_id: string;
    debit_entity1: string | null;
    debit_foreign_amount1: string | null;
    debit_local_amount1: string | null;
    debit_entity2: string | null;
    debit_foreign_amount2: string | null;
    debit_local_amount2: string | null;
    credit_entity1: string | null;
    credit_foreign_amount1: string | null;
    credit_local_amount1: string | null;
    credit_entity2: string | null;
    credit_foreign_amount2: string | null;
    credit_local_amount2: string | null;
    currency: string;
    invoice_date: Date;
    value_date: Date;
    description: string | null;
    reference1: string | null;
    created_at: Date;
    updated_at: Date;
    locked: boolean;
}
export interface EntityTotals {
    debit: number;
    credit: number;
    net: number;
}
export declare function numberVal(v: string | null | undefined): number;
export declare function expectClose(actual: number, expected: number, tolerance?: number, msg?: string): void;
/** Assert every record is internally balanced (sum debit == sum credit) within tolerance */
export declare function assertInternalBalance(records: LedgerRecord[], tolerance?: number): void;
/** Assert no orphaned amounts (amount requires entity) and null usage for unused entity slots */
export declare function assertNoOrphanedAmounts(record: LedgerRecord, idx?: number): void;
/** Assert all records satisfy orphan rules */
export declare function assertNoOrphans(records: LedgerRecord[]): void;
/** Assert all amounts non-negative */
export declare function assertPositiveAmounts(records: LedgerRecord[]): void;
/** Aggregate totals per entity (debit vs credit) */
export declare function aggregateTotalsByEntity(records: LedgerRecord[]): Record<string, EntityTotals>;
/** Assert owner consistency */
export declare function assertOwner(records: LedgerRecord[], ownerId: string): void;
/** Assert all records point to given charge */
export declare function assertChargeLinkage(records: LedgerRecord[], chargeId: string): void;
/** Assert audit fields validity */
export declare function assertAuditTrail(records: LedgerRecord[], now?: Date, maxFutureSkewMs?: number): void;
/** Assert foreign currency amounts and implied exchange rate */
export declare function assertForeignCurrency(records: LedgerRecord[], opts: {
    expectedCurrency: string;
    expectedForeignAmount?: number;
    expectedRate?: number;
    toleranceRate?: number;
}): void;
/** Assert absence of foreign currency data for local-only scenarios */
export declare function assertNoForeignCurrency(records: LedgerRecord[], expectedLocalCurrency: string): void;
/** Assert entity assignments match expected sets */
export declare function assertEntityAssignments(records: LedgerRecord[], expected: {
    expectedDebitEntities: string[];
    expectedCreditEntities: string[];
    allowSecondary?: boolean;
}): void;
/** Business logic: expense accounts must appear only on debit side; bank/cash on credit */
export declare function assertExpenseScenarioLogic(records: LedgerRecord[], opts: {
    expenseEntityIds: string[];
    cashOrBankEntityIds: string[];
}): void;
/** Combined high-level assertion for typical simple local expense scenario */
export declare function assertSimpleLocalExpenseScenario(records: LedgerRecord[], params: {
    chargeId: string;
    ownerId: string;
    expenseEntity: string;
    bankEntity: string;
    expectedCurrency: string;
    expectedTotal: number;
}): void;
/** Combined high-level assertion for foreign currency expense scenario */
export declare function assertForeignExpenseScenario(records: LedgerRecord[], params: {
    chargeId: string;
    ownerId: string;
    expenseEntity: string;
    bankEntity: string;
    expectedCurrency: string;
    expectedForeignAmount: number;
    expectedRate: number;
    expectedLocalTotal: number;
    toleranceRate?: number;
}): void;
