"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MockComplianceDecisionEngine = void 0;
let auditCounter = 0;
function nextAuditId() {
    auditCounter += 1;
    return `audit-mock-${auditCounter}`;
}
class MockComplianceDecisionEngine {
    blockAmountThreshold;
    constructor(options) {
        this.blockAmountThreshold = options?.blockAmountThreshold ?? 1_000_000;
    }
    async evaluateTransaction(input) {
        const amount = Number(input.amount);
        const hints = input.riskHints ?? [];
        if (hints.includes('sanctions_hit')) {
            return {
                decision: 'block',
                risk_score: 100,
                reason_codes: ['SANCTIONS_HIT'],
                evidence_refs: ['mock-evidence-sanctions'],
                manual_review_required: true,
                audit_event_id: nextAuditId(),
            };
        }
        if (hints.includes('pep_match')) {
            return {
                decision: 'review',
                risk_score: 75,
                reason_codes: ['PEP_MATCH'],
                evidence_refs: ['mock-evidence-pep'],
                manual_review_required: true,
                audit_event_id: nextAuditId(),
            };
        }
        if (amount >= this.blockAmountThreshold) {
            return {
                decision: 'hold',
                risk_score: 60,
                reason_codes: ['AMOUNT_THRESHOLD'],
                evidence_refs: ['mock-evidence-threshold'],
                manual_review_required: true,
                audit_event_id: nextAuditId(),
            };
        }
        return {
            decision: 'allow',
            risk_score: 10,
            reason_codes: ['CLEAR'],
            evidence_refs: [],
            manual_review_required: false,
            audit_event_id: nextAuditId(),
        };
    }
    async evaluateEntity(entityId, tenantId) {
        if (entityId.startsWith('blocked-')) {
            return {
                decision: 'reject',
                risk_score: 90,
                reason_codes: ['ENTITY_BLOCKED'],
                evidence_refs: [`mock-entity-${tenantId}-${entityId}`],
                manual_review_required: true,
                audit_event_id: nextAuditId(),
            };
        }
        return {
            decision: 'allow',
            risk_score: 5,
            reason_codes: ['ENTITY_CLEAR'],
            evidence_refs: [],
            manual_review_required: false,
            audit_event_id: nextAuditId(),
        };
    }
    async evaluateCounterparty(counterpartyId, tenantId) {
        if (counterpartyId.includes('high-risk')) {
            return {
                decision: 'review',
                risk_score: 70,
                reason_codes: ['COUNTERPARTY_HIGH_RISK'],
                evidence_refs: [`mock-cp-${tenantId}`],
                manual_review_required: true,
                audit_event_id: nextAuditId(),
            };
        }
        return this.evaluateEntity(counterpartyId, tenantId);
    }
}
exports.MockComplianceDecisionEngine = MockComplianceDecisionEngine;
