"""
Tests for utilities/enums.py

Tests cover:
- KnowledgeAccumulationApproach enum
- SearchMode enum
"""

import pytest


class TestKnowledgeAccumulationApproach:
    """Tests for KnowledgeAccumulationApproach enum."""

    def test_question_value(self):
        """Test QUESTION enum value."""
        from local_deep_research.utilities.enums import (
            KnowledgeAccumulationApproach,
        )

        assert KnowledgeAccumulationApproach.QUESTION.value == "QUESTION"

    def test_iteration_value(self):
        """Test ITERATION enum value."""
        from local_deep_research.utilities.enums import (
            KnowledgeAccumulationApproach,
        )

        assert KnowledgeAccumulationApproach.ITERATION.value == "ITERATION"

    def test_no_knowledge_value(self):
        """Test NO_KNOWLEDGE enum value."""
        from local_deep_research.utilities.enums import (
            KnowledgeAccumulationApproach,
        )

        assert (
            KnowledgeAccumulationApproach.NO_KNOWLEDGE.value == "NO_KNOWLEDGE"
        )

    def test_max_nr_of_characters_value(self):
        """Test MAX_NR_OF_CHARACTERS enum value."""
        from local_deep_research.utilities.enums import (
            KnowledgeAccumulationApproach,
        )

        assert (
            KnowledgeAccumulationApproach.MAX_NR_OF_CHARACTERS.value
            == "MAX_NR_OF_CHARACTERS"
        )

    def test_all_values_exist(self):
        """Test all expected values exist in enum."""
        from local_deep_research.utilities.enums import (
            KnowledgeAccumulationApproach,
        )

        assert len(KnowledgeAccumulationApproach) == 4


class TestSearchMode:
    """Tests for SearchMode enum."""

    def test_all_value(self):
        """Test ALL enum value."""
        from local_deep_research.utilities.enums import SearchMode

        assert SearchMode.ALL.value == "all"

    def test_scientific_value(self):
        """Test SCIENTIFIC enum value."""
        from local_deep_research.utilities.enums import SearchMode

        assert SearchMode.SCIENTIFIC.value == "scientific"

    def test_all_values_exist(self):
        """Test all expected values exist in enum."""
        from local_deep_research.utilities.enums import SearchMode

        assert len(SearchMode) == 2

    def test_search_mode_from_string(self):
        """Test creating SearchMode from string value."""
        from local_deep_research.utilities.enums import SearchMode

        assert SearchMode("all") == SearchMode.ALL
        assert SearchMode("scientific") == SearchMode.SCIENTIFIC

    def test_search_mode_invalid_value_raises(self):
        """Test that invalid value raises ValueError."""
        from local_deep_research.utilities.enums import SearchMode

        with pytest.raises(ValueError):
            SearchMode("invalid")
