"""Abstract release provider interface for version checking."""

from dataclasses import dataclass
from typing import Protocol


@dataclass(frozen=True)
class ReleaseInfo:
    """Version-provider-agnostic release metadata."""

    version: str  # e.g. "1.1.0" (no "v" prefix)
    url: str  # release page URL
    prerelease: bool


class ReleaseProvider(Protocol):
    """Abstract interface for fetching the latest release.

    Implement this protocol to support different hosting platforms
    (Gitea, GitHub, GitLab, etc.).
    """

    async def get_latest_release(self) -> ReleaseInfo | None:
        """Fetch the latest stable release.

        Returns:
            ReleaseInfo if a release was found, None on failure.
        """
        ...
