import { defineModel } from '../define.js'

type AliasModel = readonly [
  id: string,
  label: string,
  contextWindow: number,
  maxOutputTokens?: number,
]

const aliasCapabilities = {
  supportsVision: false,
  supportsStreaming: true,
  supportsFunctionCalling: true,
  supportsJsonMode: true,
  supportsReasoning: false,
  supportsPreciseTokenCount: false,
}

function aliasModel(
  id: string,
  label: string,
  contextWindow: number,
  maxOutputTokens?: number,
) {
  return defineModel({
    id,
    label,
    brandId: 'openai-compatible-alias',
    vendorId: 'openai',
    classification: ['chat', 'coding'],
    defaultModel: id,
    capabilities: aliasCapabilities,
    contextWindow,
    maxOutputTokens,
  })
}

const aliasModels: readonly AliasModel[] = [
  ['github:copilot', 'GitHub Copilot', 128_000, 16_384],
  ['github:copilot:claude-sonnet-4', 'GitHub Copilot Claude Sonnet 4', 216_000, 16_000],
  ['github:copilot:claude-haiku-4', 'GitHub Copilot Claude Haiku 4', 200_000, 64_000],
  ['github:copilot:claude-haiku-4.5', 'GitHub Copilot Claude Haiku 4.5', 144_000, 32_768],
  ['github:copilot:claude-sonnet-4.5', 'GitHub Copilot Claude Sonnet 4.5', 200_000, 32_000],
  ['github:copilot:claude-sonnet-4.6', 'GitHub Copilot Claude Sonnet 4.6', 200_000, 32_000],
  ['github:copilot:claude-opus-4', 'GitHub Copilot Claude Opus 4', 200_000, 32_000],
  ['github:copilot:claude-opus-4.6', 'GitHub Copilot Claude Opus 4.6', 200_000, 32_000],
  ['github:copilot:gpt-3.5-turbo', 'GitHub Copilot GPT-3.5 Turbo', 16_384, 4_096],
  ['github:copilot:gpt-4', 'GitHub Copilot GPT-4', 32_768, 4_096],
  ['github:copilot:gpt-4-0125-preview', 'GitHub Copilot GPT-4 0125 Preview', 128_000, 4_096],
  ['github:copilot:gpt-4-o-preview', 'GitHub Copilot GPT-4o Preview', 128_000, 4_096],
  ['github:copilot:gpt-4.1', 'GitHub Copilot GPT-4.1', 128_000, 16_384],
  ['github:copilot:gpt-4o', 'GitHub Copilot GPT-4o', 128_000, 4_096],
  ['github:copilot:gpt-4o-2024-08-06', 'GitHub Copilot GPT-4o 2024-08-06', 128_000, 16_384],
  ['github:copilot:gpt-4o-2024-11-20', 'GitHub Copilot GPT-4o 2024-11-20', 128_000, 16_384],
  ['github:copilot:gpt-4o-mini', 'GitHub Copilot GPT-4o Mini', 128_000, 4_096],
  ['github:copilot:gpt-5-mini', 'GitHub Copilot GPT-5 Mini', 264_000, 64_000],
  ['github:copilot:gpt-5.1', 'GitHub Copilot GPT-5.1', 264_000, 64_000],
  ['github:copilot:gpt-5.2', 'GitHub Copilot GPT-5.2', 400_000, 128_000],
  ['github:copilot:gpt-5.2-codex', 'GitHub Copilot GPT-5.2 Codex', 400_000, 128_000],
  ['github:copilot:gpt-5.3-codex', 'GitHub Copilot GPT-5.3 Codex', 400_000, 128_000],
  ['github:copilot:gpt-5.5', 'GitHub Copilot GPT-5.5', 400_000],
  ['github:copilot:gpt-5.5-mini', 'GitHub Copilot GPT-5.5 Mini', 400_000],
  ['github:copilot:gpt-5.4', 'GitHub Copilot GPT-5.4', 400_000, 128_000],
  ['github:copilot:gpt-5.4-mini', 'GitHub Copilot GPT-5.4 Mini', 400_000, 128_000],
  ['github:copilot:gemini-2.5-pro', 'GitHub Copilot Gemini 2.5 Pro', 128_000, 64_000],
  ['github:copilot:gemini-3-flash-preview', 'GitHub Copilot Gemini 3 Flash Preview', 128_000, 64_000],
  ['github:copilot:gemini-3.1-pro-preview', 'GitHub Copilot Gemini 3.1 Pro Preview', 200_000, 64_000],
  ['github:copilot:grok-code-fast-1', 'GitHub Copilot Grok Code Fast 1', 256_000, 64_000],
  ['github_copilot/claude-sonnet-4.6', 'GitHub Copilot Claude Sonnet 4.6', 200_000, 32_000],
  ['github_copilot/claude-opus-4.6', 'GitHub Copilot Claude Opus 4.6', 200_000, 32_000],
  ['github_copilot/claude-haiku-4.5', 'GitHub Copilot Claude Haiku 4.5', 144_000, 32_768],
  ['github_copilot/gpt-4.1', 'GitHub Copilot GPT-4.1', 128_000, 16_384],
  ['github_copilot/gpt-4o', 'GitHub Copilot GPT-4o', 128_000, 4_096],
  ['github_copilot/gpt-5-mini', 'GitHub Copilot GPT-5 Mini', 264_000, 64_000],
  ['github_copilot/gpt-5.5', 'GitHub Copilot GPT-5.5', 400_000],
  ['github_copilot/gpt-5.5-mini', 'GitHub Copilot GPT-5.5 Mini', 400_000],
  ['github_copilot/gpt-5.4', 'GitHub Copilot GPT-5.4', 400_000, 128_000],
  ['github_copilot/gpt-5.4-mini', 'GitHub Copilot GPT-5.4 Mini', 400_000, 128_000],
  ['github_copilot/gemini-2.5-pro', 'GitHub Copilot Gemini 2.5 Pro', 128_000, 64_000],
  ['github_copilot/gemini-3-flash', 'GitHub Copilot Gemini 3 Flash', 128_000, 64_000],
  ['github_copilot/grok-code-fast-1', 'GitHub Copilot Grok Code Fast 1', 256_000, 64_000],
  ['nvidia/llama-3.1-nemotron-ultra-253b-v1', 'NVIDIA Llama 3.1 Nemotron Ultra 253B', 128_000],
  ['nvidia/nemotron-mini-4b-instruct', 'NVIDIA Nemotron Mini 4B Instruct', 32_768, 8_192],
  ['google/gemma-2-27b-it', 'Google Gemma 2 27B IT', 8_192, 4_096],
  ['google/gemma-2-9b-it', 'Google Gemma 2 9B IT', 8_192],
  ['google/gemma-3-27b-it', 'Google Gemma 3 27B IT', 131_072, 16_384],
  ['google/gemma-3-12b-it', 'Google Gemma 3 12B IT', 131_072, 16_384],
  ['google/gemma-3-4b-it', 'Google Gemma 3 4B IT', 131_072],
  ['deepseek-ai/deepseek-r1', 'DeepSeek R1', 128_000, 32_768],
  ['deepseek-ai/deepseek-v3', 'DeepSeek V3', 128_000, 32_768],
  ['deepseek-ai/deepseek-v3.2', 'DeepSeek V3.2', 128_000, 32_768],
  ['qwen/qwen3-32b', 'Qwen 3 32B', 128_000, 32_768],
  ['qwen/qwen3-8b', 'Qwen 3 8B', 128_000],
  ['qwen/qwen2.5-7b-instruct', 'Qwen 2.5 7B Instruct', 32_768, 8_192],
  ['mistralai/mistral-large-3-675b-instruct-2512', 'Mistral Large 3 675B Instruct 2512', 256_000, 32_768],
  ['mistralai/mistral-large-2-instruct', 'Mistral Large 2 Instruct', 256_000],
  ['mistralai/mistral-small-3.1-24b-instruct-2503', 'Mistral Small 3.1 24B Instruct 2503', 32_768],
  ['mistralai/mixtral-8x7b-instruct-v0.1', 'Mixtral 8x7B Instruct v0.1', 32_768, 8_192],
  ['microsoft/phi-4-mini-instruct', 'Microsoft Phi 4 Mini Instruct', 16_384, 4_096],
  ['microsoft/phi-3.5-mini-instruct', 'Microsoft Phi 3.5 Mini Instruct', 16_384, 4_096],
  ['microsoft/phi-3-mini-128k-instruct', 'Microsoft Phi 3 Mini 128K Instruct', 128_000],
  ['ibm/granite-3.3-8b-instruct', 'IBM Granite 3.3 8B Instruct', 8_192, 4_096],
  ['ibm/granite-8b-code-instruct', 'IBM Granite 8B Code Instruct', 8_192],
  ['z-ai/glm5', 'Z.ai GLM-5', 200_000, 32_768],
  ['z-ai/glm4.7', 'Z.ai GLM-4.7', 128_000],
  ['moonshotai/kimi-k2.5', 'Moonshot Kimi K2.5', 200_000, 32_768],
  ['moonshotai/kimi-k2-instruct', 'Moonshot Kimi K2 Instruct', 128_000],
  ['databricks/dbrx-instruct', 'Databricks DBRX Instruct', 131_072, 32_768],
  ['ai21labs/jamba-1.5-large-instruct', 'AI21 Jamba 1.5 Large Instruct', 256_000, 32_768],
  ['ai21labs/jamba-1.5-mini-instruct', 'AI21 Jamba 1.5 Mini Instruct', 256_000],
  ['01-ai/yi-large', '01.AI Yi Large', 32_768, 8_192],
  ['qwen2.5-coder:32b', 'Qwen 2.5 Coder 32B', 32_768, 8_192],
  ['qwen2.5-coder:7b', 'Qwen 2.5 Coder 7B', 32_768, 8_192],
  ['deepseek-coder-v2:16b', 'DeepSeek Coder V2 16B', 163_840, 8_192],
  ['deepseek-r1:14b', 'DeepSeek R1 14B', 65_536, 8_192],
  ['phi4:14b', 'Phi 4 14B', 16_384, 4_096],
  ['gemma2:27b', 'Gemma 2 27B', 8_192, 4_096],
  ['codellama:13b', 'Code Llama 13B', 16_384, 4_096],
  ['qwen3:8b', 'Qwen 3 8B', 128_000, 8_192],
  ['qwen3-max-2026-01-23', 'Qwen 3 Max 2026-01-23', 262_144, 32_768],
]

export default aliasModels.map(([id, label, contextWindow, maxOutputTokens]) =>
  aliasModel(id, label, contextWindow, maxOutputTokens),
)
