"""enums 反查与覆盖。"""

from __future__ import annotations

from linksoul_agentsdk.enums import (
    AgentCallbackType,
    AgentEventType,
    AgentPolicy,
    FlowMode,
    RobotState,
)


def test_agent_callback_type_of_known():
    assert AgentCallbackType.of("audio2llm") is AgentCallbackType.AUDIO_2_LLM
    assert AgentCallbackType.of("audio2tts") is AgentCallbackType.AUDIO_2_TTS
    assert AgentCallbackType.of("asr2llm") is AgentCallbackType.ASR_2_LLM
    assert AgentCallbackType.of("asr2tts") is AgentCallbackType.ASR_2_TTS
    assert AgentCallbackType.of("asrVideo2vlm") is AgentCallbackType.ASR_VIDEO_2_VLM
    assert AgentCallbackType.of("asrVideo2tts") is AgentCallbackType.ASR_VIDEO_2_TTS
    assert AgentCallbackType.of("audioVideo2vlm") is AgentCallbackType.AUDIO_VIDEO_2_VLM
    assert AgentCallbackType.of("audioVideo2tts") is AgentCallbackType.AUDIO_VIDEO_2_TTS
    # PUSH_LISTEN 仍在 enum 中但 v1.4.0 未对外开放 register_push_listen
    assert AgentCallbackType.of("pushListen") is AgentCallbackType.PUSH_LISTEN


def test_agent_callback_type_of_unknown_falls_back_to_illegal():
    assert AgentCallbackType.of("audio2asr") is AgentCallbackType.ILLEGAL
    assert AgentCallbackType.of("text2tts") is AgentCallbackType.ILLEGAL
    assert AgentCallbackType.of("audio2audio") is AgentCallbackType.ILLEGAL
    assert AgentCallbackType.of("stateListen") is AgentCallbackType.ILLEGAL
    assert AgentCallbackType.of("greet2vlm") is AgentCallbackType.ILLEGAL
    assert AgentCallbackType.of(None) is AgentCallbackType.ILLEGAL


def test_flow_mode():
    assert FlowMode.of("simple") is FlowMode.SIMPLE
    assert FlowMode.of("complex") is FlowMode.COMPLEX
    assert FlowMode.of("???") is FlowMode.ILLEGAL


def test_robot_state():
    assert RobotState.of("online") is RobotState.ONLINE
    assert RobotState.of("offline") is RobotState.OFFLINE


def test_agent_policy():
    assert AgentPolicy.of("passive") is AgentPolicy.PASSIVE
    assert AgentPolicy.of("active") is AgentPolicy.ACTIVE
    assert AgentPolicy.of("signal") is AgentPolicy.SIGNAL


def test_agent_event_type_known():
    assert (
        AgentEventType.of("agentsdk.audio_request.start")
        is AgentEventType.AGENTSDK_AUDIO_REQUEST_START
    )
    assert (
        AgentEventType.of("agentsdk.flow_start.request_ack")
        is AgentEventType.AGENTSDK_FLOW_START_REQUEST_ACK
    )


def test_agent_event_type_unknown_is_illegal():
    assert AgentEventType.of("nope") is AgentEventType.ILLEGAL
