import type { DemoLead } from '../schema';

export interface IntegrationContext {
  correlationId: string;
  idempotencyKey: string;
  signal: AbortSignal;
  environment: 'development' | 'test' | 'production';
  testScenario?: 'success' | 'duplicate' | 'timeout' | 'integration-error';
}

export type LeadDestinationResult =
  | { ok: true; externalId: string; acceptedAt: string; mode: 'local' }
  | {
      ok: false;
      category: 'duplicate' | 'integration' | 'timeout' | 'configuration';
      retryable: boolean;
      code: string;
    };

export interface LeadDestinationAdapter {
  readonly name: string;
  submitLead(lead: DemoLead, context: IntegrationContext): Promise<LeadDestinationResult>;
}
