-- AI-Provider-Konfiguration fuer den Card-Scanner und kuenftige
-- AI-gestuetzte Features.
-- ====================================================================
-- Statt nur ANTHROPIC_API_KEY in der ENV: pro Mandant via Admin-UI
-- konfigurierbar. Drei Provider unterstuetzt:
--   - anthropic   (Claude — Default)
--   - openai      (GPT)
--   - openrouter  (OpenAI-compat API, Multi-Vendor)
--
-- ai_active_provider gibt an welcher Provider gerade verwendet wird.
-- Keys + Modelle werden pro Provider separat gespeichert (Multi-
-- Provider-Setup parallel moeglich, switching per Toggle).

alter table public.site_settings
  add column if not exists ai_active_provider text not null default 'anthropic'
    check (ai_active_provider in ('anthropic', 'openai', 'openrouter')),
  add column if not exists ai_anthropic_key text,
  add column if not exists ai_anthropic_model text default 'claude-sonnet-4-6',
  add column if not exists ai_openai_key text,
  add column if not exists ai_openai_model text default 'gpt-4o-mini',
  add column if not exists ai_openrouter_key text,
  add column if not exists ai_openrouter_model text default 'anthropic/claude-sonnet-4.6';
