/**
 * Violation domain events — discriminated union.
 *
 *   * + warn_requested        → unchanged state (audit + email side effects only)
 *   ACTIVE|VETERAN + freeze_requested  → FROZEN
 *   FROZEN + unfreeze_requested        → ACTIVE
 *   ACTIVE|VETERAN|FROZEN + ban_requested → BANNED  (+ pause all active deals)
 *
 *   BANNED + (warn|freeze|ban|unfreeze)   → rejected
 *
 * Pure module: no imports from @/server/db, do-client, outbox-producer, payments, fetch.
 */

/** Deliberate domain subset: states that the violation state machine operates on.
 *  PENDING_PROCESSOR and REJECTED are intentionally excluded — vendors in those
 *  states cannot receive freeze/ban/warn transitions via this machine. */
export type VendorAccountState = 'PENDING_FIRST_APPROVAL' | 'ACTIVE' | 'VETERAN' | 'FROZEN' | 'BANNED';

export type ViolationEvent =
  | {
      kind: 'warn_requested';
      adminId: string;
      vendorId: string;
      note: string;
      at: Date;
    }
  | {
      kind: 'freeze_requested';
      adminId: string;
      vendorId: string;
      reason: string;
      durationDays: number | null;
      at: Date;
    }
  | {
      kind: 'unfreeze_requested';
      adminId: string;
      vendorId: string;
      at: Date;
    }
  | {
      kind: 'ban_requested';
      adminId: string;
      vendorId: string;
      reason: string;
      at: Date;
    };
