"""Tests for CAP-023 (metrics collector) + CAP-024 (deck structure) (P6, REQ-198)."""

import os
import sys
from pathlib import Path

import pytest

ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(ROOT))


def test_cap_023_metrics_collector():
    """CAP-023: metrics collector runs and emits the expected schema."""
    from core.regression_verify import _check_cap_023_metrics_collector
    status, detail = _check_cap_023_metrics_collector()
    assert status in ("Verified", "Skipped"), f"CAP-023 {status}: {detail}"


def test_cap_024_deck_structure():
    """CAP-024: unified deck has correct structure (slide count, x3, benefits)."""
    from core.regression_verify import _check_cap_024_deck_structure
    status, detail = _check_cap_024_deck_structure()
    assert status in ("Verified", "Skipped"), f"CAP-024 {status}: {detail}"


def test_cap_024_deck_exists():
    """The unified deck source of truth exists."""
    deck_path = ROOT / "docs" / "presentations" / "nova-autonomous-cloud-delivery-marp.md"
    assert deck_path.exists(), "unified deck not found"


def test_cap_024_old_decks_retired():
    """The old decks are retired (D-130)."""
    old_decks = [
        ROOT / "docs" / "presentations" / "how-the-platform-works.md",
        ROOT / "docs" / "presentations" / "the-developer-experience.md",
    ]
    for deck in old_decks:
        assert not deck.exists(), f"old deck not retired: {deck}"