from enum import Enum

from dataclasses import dataclass
from .._core import ProcessToolCallResultPy


class ProcessToolCallDecision(str, Enum):
    ALLOW = "allow"
    DENY = "deny"
    ERROR = (
        "error"  # Explicit error state is only constructed in Python, never in Rust.
    )


@dataclass
class ProcessToolCallResult:
    decision: ProcessToolCallDecision
    rules_matched_count: int
    reason: str

    @staticmethod
    def from_rust_binding(
        rust_binding: ProcessToolCallResultPy,
    ) -> "ProcessToolCallResult":
        return ProcessToolCallResult(
            decision=ProcessToolCallDecision(rust_binding.decision),
            rules_matched_count=rust_binding.rules_matched_count,
            reason=rust_binding.reason,
        )
