import type {
  AmlScreeningProvider,
  AmlScreeningRequest,
  SanctionsScreeningProvider,
  SanctionsScreeningRequest,
  ScreeningDecision,
  TravelRulePayload,
  TravelRuleTransmitter,
} from './screening-providers';

export class MockAmlScreeningProvider implements AmlScreeningProvider {
  async screen(request: AmlScreeningRequest): Promise<ScreeningDecision> {
    const amount = Number(request.amount);
    if (request.entityId.startsWith('blocked-')) return 'block';
    if (amount >= 1_000_000) return 'review';
    return 'clear';
  }
}

export class MockSanctionsScreeningProvider implements SanctionsScreeningProvider {
  async screen(request: SanctionsScreeningRequest): Promise<ScreeningDecision> {
    const hit = request.names.some((n) => /sanction|blocked/i.test(n));
    return hit ? 'block' : 'clear';
  }
}

export class MockTravelRuleTransmitter implements TravelRuleTransmitter {
  async transmit(payload: TravelRulePayload): Promise<{ referenceId: string }> {
    const ref = `TR-${payload.originatorVaspId}-${Date.now()}`;
    return { referenceId: ref };
  }
}
