# pyright: reportMissingImports=false
"""6-mode completeness + classify priority order + edge cases."""
from __future__ import annotations

from utils.task_mode_classifier import TaskMode, classify


def test_all_six_mode_constants_exist():
    assert TaskMode.NORMAL == "NORMAL"
    assert TaskMode.READ_ONLY_WATCHER == "READ_ONLY_WATCHER"
    assert TaskMode.DIAGNOSIS == "DIAGNOSIS"
    assert TaskMode.CALLBACK_ONLY == "CALLBACK_ONLY"
    assert TaskMode.CLOSEOUT_MARKER_ONLY == "CLOSEOUT_MARKER_ONLY"
    assert TaskMode.UNKNOWN == "UNKNOWN"


def test_classify_priority_watcher_beats_callback():
    md = "this task is a read-only watcher and also callback only"
    assert classify("task-1", md) == TaskMode.READ_ONLY_WATCHER


def test_classify_priority_callback_beats_marker():
    md = "this is callback only and marker only at the same time"
    assert classify("task-1", md) == TaskMode.CALLBACK_ONLY


def test_classify_priority_marker_beats_diagnosis():
    md = "this is marker only and diagnosis only"
    assert classify("task-1", md) == TaskMode.CLOSEOUT_MARKER_ONLY


def test_classify_priority_diagnosis_beats_normal():
    md = "this is diagnosis only — body of the task"
    assert classify("task-1", md) == TaskMode.DIAGNOSIS


def test_classify_normal_default():
    md = "Plain task with code changes and tests."
    assert classify("task-1", md) == TaskMode.NORMAL


def test_classify_empty_content_is_unknown():
    assert classify("task-1", "") == TaskMode.UNKNOWN


def test_classify_empty_task_id_is_unknown():
    assert classify("", "some body with read-only watcher") == TaskMode.UNKNOWN
