"""Tests for theme schema."""


class TestThemeMetadata:
    def test_create_basic(self):
        from local_deep_research.web.themes.schema import ThemeMetadata

        theme = ThemeMetadata(
            id="test",
            label="Test Theme",
            icon="fa-test",
            group="core",
        )
        assert theme.id == "test"
        assert theme.label == "Test Theme"
        assert theme.icon == "fa-test"
        assert theme.group == "core"

    def test_default_type(self):
        from local_deep_research.web.themes.schema import ThemeMetadata

        theme = ThemeMetadata(
            id="test",
            label="Test",
            icon="fa-test",
            group="core",
        )
        assert theme.type == "dark"

    def test_to_dict(self):
        from local_deep_research.web.themes.schema import ThemeMetadata

        theme = ThemeMetadata(
            id="test",
            label="Test Theme",
            icon="fa-test",
            group="core",
            type="light",
        )
        d = theme.to_dict()
        assert d["label"] == "Test Theme"
        assert d["icon"] == "fa-test"
        assert d["group"] == "core"
        assert d["type"] == "light"

    def test_with_description(self):
        from local_deep_research.web.themes.schema import ThemeMetadata

        theme = ThemeMetadata(
            id="test",
            label="Test",
            icon="fa-test",
            group="core",
            description="A test theme",
        )
        assert theme.description == "A test theme"

    def test_with_author(self):
        from local_deep_research.web.themes.schema import ThemeMetadata

        theme = ThemeMetadata(
            id="test",
            label="Test",
            icon="fa-test",
            group="core",
            author="Test Author",
        )
        assert theme.author == "Test Author"


class TestConstants:
    def test_required_variables_exists(self):
        from local_deep_research.web.themes.schema import REQUIRED_VARIABLES

        assert isinstance(REQUIRED_VARIABLES, list)
        assert len(REQUIRED_VARIABLES) > 0
        assert "--bg-primary" in REQUIRED_VARIABLES
        assert "--text-primary" in REQUIRED_VARIABLES

    def test_required_rgb_variants_exists(self):
        from local_deep_research.web.themes.schema import REQUIRED_RGB_VARIANTS

        assert isinstance(REQUIRED_RGB_VARIANTS, list)
        assert len(REQUIRED_RGB_VARIANTS) > 0
        assert "--bg-primary-rgb" in REQUIRED_RGB_VARIANTS

    def test_group_labels_exists(self):
        from local_deep_research.web.themes.schema import GROUP_LABELS

        assert isinstance(GROUP_LABELS, dict)
        assert "core" in GROUP_LABELS
        assert "nature" in GROUP_LABELS
        assert "dev" in GROUP_LABELS
