"""Tests for runtime-checkable protocol contracts."""

from __future__ import annotations

from dr_langfuse.prompts.prompt_fetch_request import PromptFetchRequest
from dr_langfuse.prompts.prompt_payload import PromptPayload
from dr_langfuse.protocols import PromptProvider, TraceEmitter
from dr_langfuse.tracing.models import TraceAck, TraceEventRequest


class _PromptOnly:
    def fetch_prompt(self, request: PromptFetchRequest) -> PromptPayload:
        return PromptPayload(
            prompt_name=request.prompt_name,
            system_content="sys",
            task_content="task",
            label=request.label,
            version=request.version,
        )


class _TraceOnly:
    def emit_trace(self, event: TraceEventRequest) -> TraceAck:
        del event
        return TraceAck(accepted=True, trace_id="trace_123")


class _Empty:
    pass


def test_prompt_protocol_runtime_checkable() -> None:
    assert isinstance(_PromptOnly(), PromptProvider)


def test_trace_protocol_runtime_checkable() -> None:
    assert isinstance(_TraceOnly(), TraceEmitter)


def test_missing_method_is_not_prompt_provider() -> None:
    assert not isinstance(_Empty(), PromptProvider)


def test_missing_method_is_not_trace_emitter() -> None:
    assert not isinstance(_Empty(), TraceEmitter)
