"""LLM Model model."""

from __future__ import annotations

from typing import Optional

from netorca_sdk.v2.base import BaseModel


class LLMModel(BaseModel):
    """
    LLM Model configuration.

    Represents a configured LLM (Large Language Model) in NetOrca.

    Attributes:
        id: Model ID
        name: Model name
        provider: LLM provider (e.g., openai, anthropic)
        model_id: Provider's model identifier
        api_key: API key (masked)
        is_active: Whether the model is active
    """

    @property
    def name(self) -> Optional[str]:
        """Get model name."""
        return self.data.get("name")

    @property
    def provider(self) -> Optional[str]:
        """Get LLM provider."""
        return self.data.get("provider")

    @property
    def model_id(self) -> Optional[str]:
        """Get provider model ID."""
        return self.data.get("model_id")

    @property
    def is_active(self) -> bool:
        """Check if model is active."""
        return self.data.get("is_active", False)

    @property
    def api_endpoint(self) -> Optional[str]:
        """Get API endpoint."""
        return self.data.get("api_endpoint")

    @property
    def temperature(self) -> Optional[float]:
        """Get temperature setting."""
        return self.data.get("temperature")

    @property
    def max_tokens(self) -> Optional[int]:
        """Get max tokens setting."""
        return self.data.get("max_tokens")

    def __repr__(self) -> str:
        return f"LLMModel(id={self.id}, name='{self.name}', provider='{self.provider}')"
