from __future__ import annotations

import logging
from typing import Literal

import attrs

log = logging.getLogger(__name__)


@attrs.frozen
class LLM:
    """
    A model definition with cost rates.
    """

    name: str
    model_type: Literal["openai", "anthropic"]
    input_cost: float | None = None
    cached_input_cost: float | None = None
    output_cost: float | None = None


OPENAI_GPT_4_1 = LLM(
    name="gpt-4.1",
    model_type="openai",
    input_cost=2.00,
    cached_input_cost=0.50,
    output_cost=8.00,
)

OPENAI_GPT_5_MINI = LLM(
    name="gpt-5-mini",
    model_type="openai",
    input_cost=0.25,
    cached_input_cost=0.03,
    output_cost=2.00,
)

ANTHROPIC_CLAUDE_SONNET_4_5 = LLM(
    name="us.anthropic.claude-sonnet-4-5-20250929-v1:0",
    model_type="anthropic",
    input_cost=3.00,
    output_cost=15.00,
)

ANTHROPIC_CLAUDE_HAIKU_4_5 = LLM(
    name="us.anthropic.claude-haiku-4-5-20251001-v1:0",
    model_type="anthropic",
    input_cost=1.00,
    output_cost=5.00,
)

EXECUTE_MODEL = OPENAI_GPT_5_MINI
OPTIMIZE_MODEL = OPENAI_GPT_5_MINI
RANKING_MODEL = OPENAI_GPT_5_MINI
REFINEMENT_MODEL = ANTHROPIC_CLAUDE_SONNET_4_5
EXPLANATIONS_MODEL = ANTHROPIC_CLAUDE_SONNET_4_5
OPTIMIZATION_REVIEW_MODEL = ANTHROPIC_CLAUDE_SONNET_4_5
CODE_REPAIR_MODEL = ANTHROPIC_CLAUDE_SONNET_4_5
ADAPTIVE_OPTIMIZE_MODEL = ANTHROPIC_CLAUDE_SONNET_4_5
