export interface BoostBotSettings {
  // General
  bot_name: string
  welcome_message: string
  is_active: boolean
  onboarding_completed?: boolean
  wizard_progress?: Record<string, boolean>
  floating_wizard_enabled?: boolean
  
  // =========================================================================
  // BYOK FUNCTIONALITY - FOR FUTURE DELETION
  // These fields are kept for backward compatibility with the backend response
  // but are always empty/false. The backend sets them to empty in get_settings().
  // =========================================================================
  ai_provider?: 'claude' | 'openai' // BYOK - FOR FUTURE DELETION
  api_key_set: boolean // BYOK - FOR FUTURE DELETION (always false)
  api_key?: string // BYOK - FOR FUTURE DELETION (always empty)
  claude_model: string // BYOK - FOR FUTURE DELETION
  openai_api_key_set?: boolean // BYOK - FOR FUTURE DELETION (always false)
  openai_api_key?: string // BYOK - FOR FUTURE DELETION (always empty)
  openai_model?: string // BYOK - FOR FUTURE DELETION
  // END BYOK FUNCTIONALITY

  // Week 26: Credits backend (no BYOK)
  backend_base_url?: string
  backend_site_id?: string
  backend_site_api_key_set?: boolean
  backend_site_api_key?: string // Masked
  
  // Appearance
  primary_color: string
  accent_color: string
  position: 'bottom-right' | 'bottom-left'
  show_on_mobile: boolean

  // Mobile Layout Settings (vw/vh based)
  // Note: side margin is auto-calculated from width: (100 - width) / 2
  mobile_layout_width_vw?: number      // Default: 94 (94% of viewport width)
  mobile_layout_height_vh?: number     // Default: 75 (75% of viewport height)
  mobile_layout_margin_top_vh?: number // Default: 20 (20vh from top for headers)
  mobile_layout_margin_bottom_vh?: number // Default: 5 (5vh from bottom)
  
  // Behavior
  auto_open_delay: number
  show_on_pages: 'all' | 'homepage' | 'custom'
  custom_pages: string[]
  
  // License
  license_status: LicenseStatus
  is_pro: boolean
  settings_frozen: boolean
  
  // Usage
  usage: UsageStats

  // Week 28: Character caps
  visitor_input_char_limit_enabled?: boolean
  visitor_input_char_limit?: number
  bot_output_char_limit_global?: number

  // Page transition triggers (when user navigates to page with different bot)
  page_transition_triggers_enabled?: boolean

  // Trace logs feature archived — see boostbot/_archive/trace-logs/

  // Week 27.7: ServiceCatalog overlay (manual edits)
  service_catalog_overrides_json?: string
  service_catalog_overrides_version?: number

  // Global rules & forbidden topics (apply to all bots)
  global_default_welcome_text?: string
  global_rules?: string
  global_forbidden_topics?: string

  // Auto re-indexing
  auto_deep_index_enabled?: boolean
  stale_index_days?: number

  // Low-credits alert
  low_credits_threshold?: number
  low_credits_email_enabled?: boolean

  // Per-visitor message rate limiting (Week 33)
  visitor_message_limit_enabled?: boolean
  visitor_messages_per_hour?: number
  visitor_messages_per_day?: number
  visitor_cooldown_enabled?: boolean
  spam_alert_enabled?: boolean
  spam_alert_email_enabled?: boolean

  // Multilingual
  primary_language?: string
}

export type LicenseStatus = 'free' | 'pro' | 'expired'

export interface UsageStats {
  messages: number
  conversations: number
  monthly_limit: number
  reset_date: string
}

export interface LicenseInfo {
  status: LicenseStatus
  is_pro: boolean
  dev_mode?: boolean // DEV ONLY - Remove before production!
  settings_frozen: boolean
  upgrade_url: string
  support_email: string
}

export interface FeatureInfo {
  id: string
  name: string
  description: string
  is_pro: boolean
  enabled: boolean
}

export interface FeaturesResponse {
  success: boolean
  data: {
    is_pro: boolean
    enabled: Record<string, FeatureInfo>
    disabled: Record<string, FeatureInfo>
  }
}

export interface SettingsResponse {
  success: boolean
  data: BoostBotSettings
}



