import { FC } from 'react';

export interface ChatWidgetProps {
  darkMode?: boolean;
  primaryColor?: string;
  position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
  companyName?: string;
  companyLogo?: string | null;
  welcomeMessage?: string;
  apiBaseUrl?: string;
  organizationId?: string;
  quickQuestions?: string[];
  quickQuestionsLayout?: 'vertical' | 'horizontal';
  textColor?: string;
  agentMessageBubbleColor?: string;
  userMessageBoxColor?: string;
  assistantTextColor?: string;
  userTextColor?: string;
  fontFamily?: string;
  fontSize?: string;
  defaultLanguage?: string;
  autoOpen?: boolean;
  openDelay?: number;
  locale?: string;
  headerTextBold?: boolean;
  headerTextItalic?: boolean;
  enableVoiceInteraction?: boolean;
  disclaimerText?: string;
  disclaimerPosition?: 'top' | 'footer';
  showPoweredBy?: boolean;
  conciergeName?: string;
  className?: string;
  onboardingQuestions?: Array<{
    askToType: string;
    fieldType: 'phone' | 'fullName' | 'email';
    required: boolean;
  }>;
  collectionPrompt?: string;
  allowedDomains?: string[];
  onboardingEnabled?: boolean;
  inactivityTimeoutValue?: number;
  inactivityTimeoutUnit?: 'MINUTES' | 'HOURS' | 'DAYS';
}

declare const ChatWidget: FC<ChatWidgetProps>;

export default ChatWidget;

export interface VanillaConfig extends ChatWidgetProps {
  apiUrl?: string;
  apiKey?: string;
  sessionUrl?: string;
  userId?: string;
  userName?: string;
  userEmail?: string;
  onOpen?: () => void;
  onClose?: () => void;
}

export interface VanillaAPI {
  init(config?: VanillaConfig): Promise<VanillaAPI>;
  updateConfig(config: Partial<VanillaConfig>): VanillaAPI;
  open(): VanillaAPI;
  close(): VanillaAPI;
  toggleTheme(): VanillaAPI;
  destroy(): VanillaAPI;
  getConfig(): VanillaConfig;
}

declare global {
  interface Window {
    ChatWidget: VanillaAPI;
    ChatWidgetConfig?: VanillaConfig;
  }
}
