use crate::model::{ModelCapabilities, ModelDef, ModelStatus};
use crate::provider::{
    AuthKind, ProviderCapabilities, ProviderDef, ProviderProtocol, ProviderStatus,
};

pub const PROVIDER: ProviderDef = ProviderDef {
    id: "anthropic",
    display_name: "Anthropic",
    default_base_url: "https://api.anthropic.com",
    protocol: ProviderProtocol::AnthropicNative,
    auth: AuthKind::Bearer,
    status: ProviderStatus::Implemented,
    env_vars: &["ANTHROPIC_API_KEY"],
    litellm_prefix: "anthropic/",
    capabilities: ProviderCapabilities {
        chat_completions: true,
        streaming: true,
        tool_use: true,
        embeddings: false,
        vision: true,
        batch: true,
    },
};

// Model catalog mirrors LiteLLM's anthropic entries in
// model_prices_and_context_window.json. Keep aliases because LiteLLM accepts
// both dated and family names for Anthropic routing.
pub const MODELS: &[ModelDef] = &[
    ModelDef {
        id: "claude-fable-5",
        provider_id: "anthropic",
        context_window: 1_000_000,
        max_output_tokens: 128_000,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: true,
        },
        status: ModelStatus::Available,
    },
    ModelDef {
        id: "claude-opus-4-6",
        provider_id: "anthropic",
        context_window: 1_000_000,
        max_output_tokens: 128_000,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: true,
        },
        status: ModelStatus::Available,
    },
    ModelDef {
        id: "claude-opus-4-6-20260205",
        provider_id: "anthropic",
        context_window: 1_000_000,
        max_output_tokens: 128_000,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: true,
        },
        status: ModelStatus::Available,
    },
    ModelDef {
        id: "claude-opus-4-7",
        provider_id: "anthropic",
        context_window: 1_000_000,
        max_output_tokens: 128_000,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: true,
        },
        status: ModelStatus::Available,
    },
    ModelDef {
        id: "claude-opus-4-7-20260416",
        provider_id: "anthropic",
        context_window: 1_000_000,
        max_output_tokens: 128_000,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: true,
        },
        status: ModelStatus::Available,
    },
    ModelDef {
        id: "claude-sonnet-4-6",
        provider_id: "anthropic",
        context_window: 1_000_000,
        max_output_tokens: 64_000,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: true,
        },
        status: ModelStatus::Available,
    },
    ModelDef {
        id: "claude-haiku-4-5",
        provider_id: "anthropic",
        context_window: 200_000,
        max_output_tokens: 64_000,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: true,
        },
        status: ModelStatus::Available,
    },
    ModelDef {
        id: "claude-haiku-4-5-20251001",
        provider_id: "anthropic",
        context_window: 200_000,
        max_output_tokens: 64_000,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: true,
        },
        status: ModelStatus::Available,
    },
    ModelDef {
        id: "claude-opus-4-5",
        provider_id: "anthropic",
        context_window: 200_000,
        max_output_tokens: 64_000,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: true,
        },
        status: ModelStatus::Available,
    },
    ModelDef {
        id: "claude-opus-4-5-20251101",
        provider_id: "anthropic",
        context_window: 200_000,
        max_output_tokens: 64_000,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: true,
        },
        status: ModelStatus::Available,
    },
    ModelDef {
        id: "claude-sonnet-4-5",
        provider_id: "anthropic",
        context_window: 200_000,
        max_output_tokens: 64_000,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: true,
        },
        status: ModelStatus::Available,
    },
    ModelDef {
        id: "claude-sonnet-4-5-20250929",
        provider_id: "anthropic",
        context_window: 200_000,
        max_output_tokens: 64_000,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: true,
        },
        status: ModelStatus::Available,
    },
    ModelDef {
        id: "claude-opus-4-1",
        provider_id: "anthropic",
        context_window: 200_000,
        max_output_tokens: 32_000,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: true,
        },
        status: ModelStatus::Available,
    },
    ModelDef {
        id: "claude-opus-4-1-20250805",
        provider_id: "anthropic",
        context_window: 200_000,
        max_output_tokens: 32_000,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: true,
        },
        status: ModelStatus::Available,
    },
    // Deprecated Claude 4.0 aliases retained for LiteLLM config compatibility.
    ModelDef {
        id: "claude-4-sonnet-20250514",
        provider_id: "anthropic",
        context_window: 1_000_000,
        max_output_tokens: 64_000,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: true,
        },
        status: ModelStatus::Deprecated,
    },
    ModelDef {
        id: "claude-sonnet-4-20250514",
        provider_id: "anthropic",
        context_window: 1_000_000,
        max_output_tokens: 64_000,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: true,
        },
        status: ModelStatus::Deprecated,
    },
    ModelDef {
        id: "claude-4-opus-20250514",
        provider_id: "anthropic",
        context_window: 200_000,
        max_output_tokens: 32_000,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: true,
        },
        status: ModelStatus::Deprecated,
    },
    ModelDef {
        id: "claude-opus-4-20250514",
        provider_id: "anthropic",
        context_window: 200_000,
        max_output_tokens: 32_000,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: true,
        },
        status: ModelStatus::Deprecated,
    },
    // Older Claude 3.x models are retained because LiteLLM still advertises them.
    ModelDef {
        id: "claude-3-7-sonnet-20250219",
        provider_id: "anthropic",
        context_window: 200_000,
        max_output_tokens: 64_000,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: true,
        },
        status: ModelStatus::Deprecated,
    },
    ModelDef {
        id: "claude-3-haiku-20240307",
        provider_id: "anthropic",
        context_window: 200_000,
        max_output_tokens: 4_096,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: false,
        },
        status: ModelStatus::Deprecated,
    },
    ModelDef {
        id: "claude-3-opus-20240229",
        provider_id: "anthropic",
        context_window: 200_000,
        max_output_tokens: 4_096,
        capabilities: ModelCapabilities {
            streaming: true,
            tool_use: true,
            vision: true,
            extended_thinking: false,
        },
        status: ModelStatus::Deprecated,
    },
];
