"""Data models for electron-angle-patcher."""

from __future__ import annotations

import enum
from dataclasses import dataclass, field
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from pathlib import Path


class AngleVariant(enum.Enum):
    """ANGLE rendering backend variants."""

    DEFAULT = "0"  # Default ANGLE behavior
    OPENGL = "1"   # Force OpenGL
    METAL = "2"    # Force Metal


class PatchResult(enum.Enum):
    """Result of a patching operation."""

    SUCCESS = "success"
    ALREADY_PATCHED = "already_patched"
    NOT_FOUND = "not_found"
    PERMISSION_DENIED = "permission_denied"
    ERROR = "error"


@dataclass(frozen=True, slots=True)
class AppInfo:
    """Information about a discovered application."""

    name: str
    state_file: Path
    already_patched: bool = False


@dataclass
class PatchSummary:
    """Summary of patching operations."""

    successful: list[str] = field(default_factory=list)
    already_patched: list[str] = field(default_factory=list)
    not_found: list[str] = field(default_factory=list)
    failed: list[str] = field(default_factory=list)

    @property
    def total(self) -> int:
        """Total number of apps processed."""
        return len(self.successful) + len(self.already_patched) + len(self.not_found) + len(self.failed)
