/**
 * Voice Agent Phone Configuration Types
 */

export type PhoneConnectionType = 'twilio_native' | 'custom_sip';

export interface TwilioConfig {
  twilioPhoneNumber: string;
  twilioAccountSid: string;
  twilioAuthToken: string; // will be encrypted at rest
}

export interface SIPConfig {
  sipUri: string;
  sipUsername?: string;
  sipPassword?: string; // will be encrypted at rest
  sipRegistrar?: string;
  sipTransport?: 'udp' | 'tcp' | 'tls';
}

export interface PhoneConfig {
  connectionType: PhoneConnectionType;
  phoneNumber?: string;
  isActive: boolean;
  elevenlabsPhoneId?: string;
  twilio?: TwilioConfig;
  sip?: SIPConfig;
  metadata?: Record<string, unknown>;
}

export interface PhoneProvisionResult {
  success: boolean;
  phoneId?: string;
  sipEndpoint?: string; // e.g., sip:{agent_id}@sip.elevenlabs.io
  error?: string;
}

export interface PhoneTestResult {
  success: boolean;
  latencyMs?: number;
  sipStatus?: string;
  error?: string;
}
