export interface ZyphonClientOptions {
  baseUrl: string;
  apiKey: string;
  timeoutMs?: number;
}

export interface SendOptions {
  sync?: boolean;
  idempotencyKey?: string;
}

export interface SendResponse {
  message_id: string;
  request_id: string;
  status: 'delivered' | 'accepted' | 'failed';
  channel: 'email' | 'sms' | 'whatsapp';
  provider: string | null;
  failover: boolean;
  latency_ms: number;
  provider_response?: unknown;
}

export declare class ZyphonError extends Error {
  readonly code: string;
  readonly status: number;
  readonly details?: unknown;
  constructor(message: string, code: string, status: number, details?: unknown);
}

export declare class ZyphonClient {
  constructor(options: ZyphonClientOptions);
  send(
    payload: {
      channel: 'email' | 'sms' | 'whatsapp';
      recipient: string;
      content: {
        type?: 'text' | 'template';
        subject?: string;
        body?: string;
        html?: string;
        template_id?: string;
        params?: Record<string, string>;
      };
      metadata?: Record<string, unknown>;
    },
    options?: SendOptions
  ): Promise<SendResponse>;

  sendEmail(
    recipient: string,
    subject: string,
    body: string,
    options?: SendOptions & { html?: string; metadata?: Record<string, unknown> }
  ): Promise<SendResponse>;

  sendSms(
    recipient: string,
    body: string,
    options?: SendOptions & { metadata?: Record<string, unknown> }
  ): Promise<SendResponse>;

  sendWhatsApp(
    recipient: string,
    body: string,
    options?: SendOptions & { metadata?: Record<string, unknown> }
  ): Promise<SendResponse>;

  health(): Promise<{ status: string; uptime: number; timestamp: number }>;
}

