"""
Base configuration class for league-specific game rules.

Provides abstract interface that all league configs must implement.

Author: Claude
Date: 2025-10-28
"""

from abc import ABC, abstractmethod

from pydantic import BaseModel, Field


class BaseGameConfig(BaseModel, ABC):
    """
    Abstract base configuration for all leagues.

    Defines common game rules and requires league-specific implementations
    to provide result chart names, API endpoints, and feature flags.
    """

    league_id: str = Field(..., description="League identifier ('sba' or 'pd')")
    version: str = Field(
        default="1.0.0", description="Config version for compatibility"
    )

    # Basic baseball rules (same across leagues)
    innings: int = Field(default=9, description="Standard innings per game")
    outs_per_inning: int = Field(default=3, description="Outs required per half-inning")

    @abstractmethod
    def get_result_chart_name(self) -> str:
        """
        Get name of result chart to use for this league.

        Returns:
            Chart name identifier (e.g., 'sba_standard_v1')
        """
        pass

    @abstractmethod
    def supports_auto_mode(self) -> bool:
        """
        Whether this league supports auto-resolution of outcomes.

        Auto mode uses digitized player ratings to automatically generate
        outcomes without human input. This is only available for leagues
        with fully digitized card data.

        Returns:
            True if auto mode is supported, False otherwise
        """
        pass

    @abstractmethod
    def get_api_base_url(self) -> str:
        """
        Get base URL for league's external API.

        Returns:
            Base URL for roster/player data API
        """
        pass

    class Config:
        """Pydantic configuration."""

        frozen = True  # Immutable config - prevents accidental modification
