"""The brand-web kit ships the expected assets and a usable accessor."""

from __future__ import annotations

import pytest

from mgf.brand_web import __version__, static_dir


def test_version_present() -> None:
    assert __version__


@pytest.mark.smoke
def test_static_dir_exists() -> None:
    assert static_dir().is_dir()


@pytest.mark.smoke
@pytest.mark.parametrize(
    "name",
    ["tokens.css", "base.css", "components.css", "instruments.css", "fonts.css", "README.md"],
)
def test_core_files_present(name: str) -> None:
    assert (static_dir() / name).is_file()


def test_six_woff2_fonts_ship() -> None:
    fonts = sorted((static_dir() / "fonts").glob("*.woff2"))
    assert len(fonts) == 6, [f.name for f in fonts]


def test_logo_and_pattern_assets_ship() -> None:
    assert (static_dir() / "logo" / "magogi-favicon.svg").is_file()
    assert list((static_dir() / "pattern").glob("*.svg"))


def test_tokens_define_brand_palette() -> None:
    txt = (static_dir() / "tokens.css").read_text(encoding="utf-8")
    assert "--mgf-indigo" in txt
    assert "--mgf-gold" in txt
    assert "--mgf-teal" in txt


def test_tokens_define_instrument_states() -> None:
    """0.2.0 adds the functional busy/derived state tokens (D-BRAND-ACCENT)."""
    txt = (static_dir() / "tokens.css").read_text(encoding="utf-8")
    assert "--state-busy" in txt
    assert "--state-derived" in txt


def test_instruments_layer_ships_component_families() -> None:
    """The operator-instrument layer defines its headline component classes."""
    txt = (static_dir() / "instruments.css").read_text(encoding="utf-8")
    for cls in (".status-chip", ".status-indicator", ".progress", ".console", ".live-pane"):
        assert cls in txt, cls
