"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MockReconciliationEngine = void 0;
class MockReconciliationEngine {
    async reconcileTripleState(input) {
        const breaks = [];
        const hybxSet = new Set(input.hybxRefs);
        const fineractSet = new Set(input.fineractRefs);
        const chainSet = new Set(input.chainRefs);
        for (const ref of input.hybxRefs) {
            if (!fineractSet.has(ref)) {
                breaks.push({
                    breakId: `brk-fineract-${ref}`,
                    type: 'missing_event',
                    source: 'fineract',
                    referenceId: ref,
                    detectedAt: new Date().toISOString(),
                });
            }
            if (!chainSet.has(ref)) {
                breaks.push({
                    breakId: `brk-chain-${ref}`,
                    type: 'missing_event',
                    source: 'chain',
                    referenceId: ref,
                    detectedAt: new Date().toISOString(),
                });
            }
        }
        for (const ref of input.fineractRefs) {
            if (!hybxSet.has(ref)) {
                breaks.push({
                    breakId: `brk-hybx-${ref}`,
                    type: 'missing_event',
                    source: 'hybx',
                    referenceId: ref,
                    detectedAt: new Date().toISOString(),
                });
            }
        }
        return {
            snapshotId: `recon-${Date.now()}`,
            tenantId: input.tenantId,
            entityId: input.entityId,
            asOf: new Date().toISOString(),
            hybxEventCount: input.hybxRefs.length,
            fineractPostingCount: input.fineractRefs.length,
            chainSettlementCount: input.chainRefs.length,
            breaks,
            status: breaks.length === 0 ? 'matched' : 'breaks_found',
        };
    }
}
exports.MockReconciliationEngine = MockReconciliationEngine;
