import type { ProviderMeta, ProviderId } from './types';

export const PROVIDERS: Record<ProviderId, ProviderMeta> = {
  anthropic: {
    id: 'anthropic',
    name: 'Anthropic',
    defaultModel: 'claude-sonnet-4-20250514',
    models: [
      'claude-sonnet-4-20250514',
      'claude-opus-4-20250514',
      'claude-haiku-4-20250506',
    ],
    requiresApiKey: true,
    apiKeyPlaceholder: 'sk-ant-...',
    apiKeyHint: 'Get your key from console.anthropic.com',
  },
  openai: {
    id: 'openai',
    name: 'OpenAI',
    defaultModel: 'gpt-4o',
    models: ['gpt-4o', 'gpt-4o-mini', 'gpt-4.1', 'gpt-4.1-mini', 'gpt-4.1-nano', 'o3-mini'],
    requiresApiKey: true,
    apiKeyPlaceholder: 'sk-...',
    apiKeyHint: 'Get your key from platform.openai.com',
  },
  openai_codex: {
    id: 'openai_codex',
    name: 'OpenAI Codex',
    type: 'codex_oauth' as const,
    defaultModel: 'gpt-5',
    models: ['gpt-5', 'gpt-5-mini', 'gpt-5-nano', 'o4', 'o4-mini'],
    requiresApiKey: false,
    defaultBaseUrl: 'https://api.openai.com/v1',
    apiKeyPlaceholder: '',
    apiKeyHint: 'Sign in with your ChatGPT Plus or Pro subscription',
  },
  openrouter: {
    id: 'openrouter',
    name: 'OpenRouter',
    defaultModel: 'openrouter/free',
    models: [
      'openrouter/free',
      'anthropic/claude-sonnet-4',
      'anthropic/claude-haiku-4',
      'openai/gpt-4o',
      'google/gemini-2.5-pro',
      'mistralai/mistral-large-latest',
    ],
    requiresApiKey: true,
    defaultBaseUrl: 'https://openrouter.ai/api/v1',
    apiKeyPlaceholder: 'sk-or-...',
    apiKeyHint: 'Get your key from openrouter.ai/keys',
  },
  ollama: {
    id: 'ollama',
    name: 'Ollama (Local)',
    defaultModel: 'llama3.1',
    models: ['llama3.1', 'llama3.2', 'mistral', 'gemma2', 'qwen2.5', 'phi3'],
    requiresApiKey: false,
    defaultBaseUrl: 'http://localhost:11434/v1',
    apiKeyPlaceholder: '',
    apiKeyHint: 'No API key needed — runs locally via Ollama',
  },
  llama_cpp: {
    id: 'llama_cpp',
    name: 'llama.cpp (Local)',
    defaultModel: '',
    models: [],
    requiresApiKey: false,
    defaultBaseUrl: 'http://localhost:8080/v1',
    apiKeyPlaceholder: '',
    apiKeyHint:
      'No API key needed — scans the active llama-server model on localhost:8080',
  },
  mistral: {
    id: 'mistral',
    name: 'Mistral AI',
    defaultModel: 'mistral-large-latest',
    models: ['mistral-large-latest', 'mistral-medium-latest', 'mistral-small-latest', 'codestral-latest'],
    requiresApiKey: true,
    defaultBaseUrl: 'https://api.mistral.ai/v1',
    apiKeyPlaceholder: 'sk-...',
    apiKeyHint: 'Get your key from console.mistral.ai',
  },
  xai: {
    id: 'xai',
    name: 'xAI (Grok)',
    defaultModel: 'grok-3',
    models: ['grok-3', 'grok-3-mini', 'grok-2'],
    requiresApiKey: true,
    defaultBaseUrl: 'https://api.x.ai/v1',
    apiKeyPlaceholder: 'xai-...',
    apiKeyHint: 'Get your key from console.x.ai',
  },
  google: {
    id: 'google',
    name: 'Google Gemini',
    defaultModel: 'gemini-2.5-pro',
    models: ['gemini-2.5-pro', 'gemini-2.5-flash', 'gemini-2.0-flash'],
    requiresApiKey: true,
    defaultBaseUrl: 'https://generativelanguage.googleapis.com/v1beta/openai',
    apiKeyPlaceholder: 'AI...',
    apiKeyHint: 'Get your key from aistudio.google.com',
  },
  custom: {
    id: 'custom',
    name: 'Custom (OpenAI-Compatible)',
    defaultModel: '',
    models: [],
    requiresApiKey: false,
    defaultBaseUrl: 'http://localhost:8080/v1',
    apiKeyPlaceholder: 'Bearer token or API key',
    apiKeyHint: 'Optional — only if your endpoint requires authentication',
  },
};
