"""Patcher interface for eval harness.

A patcher receives a prompt (plus a context directory path) and returns a single
unified diff that can be applied with `git apply`.
"""

from __future__ import annotations

from dataclasses import dataclass
from pathlib import Path
from typing import Any


@dataclass(frozen=True)
class PatchResult:
    diff: str | None
    meta: dict[str, object] | None = None


@dataclass(frozen=True)
class ContextRequestResult:
    request_json: dict[str, Any] | None
    raw_response: str | None = None
    meta: dict[str, object] | None = None


class Patcher:
    name: str

    def request_context(
        self,
        *,
        prompt: str,
        context_dir: Path,
        cwd: Path,
    ) -> ContextRequestResult | None:
        return None

    def propose_patch(self, *, prompt: str, context_dir: Path, cwd: Path) -> PatchResult:
        raise NotImplementedError
