import type { LLMProvider, ProviderId } from '../types';
import { ollama } from './ollama';
import { claude } from './claude';
import { openai, openaiCompatible } from './openai';
import { gemini } from './gemini';

const ALL: Record<ProviderId, LLMProvider> = {
  claude,
  openai,
  'openai-compatible': openaiCompatible,
  gemini,
  ollama,
};

export function getProvider(id: string): LLMProvider | null {
  return (ALL as Record<string, LLMProvider | undefined>)[id] ?? null;
}

/** Stable list for UI dropdowns. Order matches the Settings select. */
export const PROVIDER_ORDER: ProviderId[] = [
  'claude',
  'openai',
  'openai-compatible',
  'gemini',
  'ollama',
];

export const PROVIDERS = ALL;
