// Circular FX Laundering Pattern

import { WAPLPattern } from '../types';

export const circularFXPattern: WAPLPattern = {
  id: 'CIRCULAR_FX',
  patternCode: 'CIRCULAR_FX',
  name: 'Circular FX Laundering',
  description: 'Detects circular FX trades where same currency pair is traded in reverse with similar amounts',
  patternDefinition: `
    pattern CIRCULAR_FX:
      if occurs(
        FX_trade[X].pair == FX_trade[Y].pair.reverse &&
        abs(FX_trade[X].amount - FX_trade[Y].amount) < tolerance &&
        entity_link(X.entity, Y.entity) == true
      ) raise_alert("Circular FX pattern detected")
  `,
  severity: 'HIGH',
  status: 'ACTIVE',
};

