from __future__ import annotations

import enum
from dataclasses import dataclass


class TestingMode(enum.Enum):
    BEHAVIOR = "behavior"
    PERFORMANCE = "performance"


@dataclass
class TestGenContextData:
    source_code_being_tested: str
    qualified_name: str


@dataclass
class CostTracker:
    total: float = 0.0
    calls: int = 0

    def add(self, cost: float) -> None:
        self.total += cost
        self.calls += 1


class LLMOutputParseError(Exception):
    """Exception for LLM output parsing failures with raw output context."""

    def __init__(self, message: str, raw_llm_output: str, code: str | None = None) -> None:
        super().__init__(message)
        self.raw_llm_output = raw_llm_output
        self.code = code
