"""
SST Testing Framework - Test utilities powered by the Single Source of Truth.

This module provides pytest fixtures and utilities for writing tests that
pull values from the YAML SST, ensuring tests stay in sync with the
actual system configuration.

CORE PHILOSOPHY:
    Tests exist to FIND BUGS, not to confirm code works.

    1. Test against the SPEC (YAML), not the implementation
    2. Write rejection tests FIRST (what should FAIL)
    3. Test boundaries (AT and BEYOND limits)
    4. Verify spec alignment (YAML ↔ Pydantic)

See: .claude/rules/adversarial-testing.md for the full philosophy.

Usage:
    # In conftest.py
    pytest_plugins = ["lightwave.schema.testing"]

    # Adversarial schema testing
    from lightwave.schema.testing import SchemaTester

    def test_user_schema():
        tester = SchemaTester(UserSchema, valid_instance={"email": "test@test.com"})
        report = tester.run_all()
        assert report.bugs_found == 0, report.summary()

    # Spec alignment testing
    from lightwave.schema.testing import assert_websocket_spec_aligned

    def test_websocket_spec():
        assert_websocket_spec_aligned()

    # Traditional SST-powered tests
    def test_login_page(sst_routes):
        login_url = sst_routes.get_url("login")
        assert login_url == "/login/"

    # Rejection test decorators
    from lightwave.schema.testing import rejection_test

    @rejection_test()
    def test_empty_email_rejected():
        UserSchema(email="")
"""

# Fixtures
# Adversarial Testing
from lightwave.schema.testing.adversarial import (
    AdversarialReport,
    AdversarialResult,
    BoundaryTestSuite,
    LiteralExhaustionTest,
    RejectionTestSuite,
    RoundTripTestSuite,
    adversarial_test,
    boundary_test,
    generate_rejection_tests,
    rejection_test,
)
from lightwave.schema.testing.fixtures import (
    all_blueprint_names,
    all_flow_names,
    all_layout_names,
    all_route_names,
    all_tenant_slugs,
    all_user_type_names,
    fresh_sst_registry,
    sst_blueprints,
    sst_layouts,
    sst_registry,
    sst_routes,
    sst_tenants,
    sst_user_flows,
    sst_user_types,
    sst_webhooks,
)

# Parametrize helpers
from lightwave.schema.testing.generators import (
    generate_all_flow_tests,
    generate_flow_test_class,
    sst_param_blueprints,
    sst_param_entry_points,
    sst_param_flow_steps,
    sst_param_layouts,
    sst_param_route_layout_pairs,
    sst_param_routes,
    sst_param_tenant_domains,
    sst_param_tenants,
    sst_param_user_flows,
    sst_param_user_types,
)

# Markers
from lightwave.schema.testing.markers import (
    flow_test,
    for_tenant,
    pytest_configure,
    requires_feature,
    requires_user_type,
    sst_spec,
    validate_against_sst,
)

# Schema Tester
from lightwave.schema.testing.schema_tester import (
    SchemaTester,
    SchemaTestReport,
    TestResult,
)

# Spec Alignment
from lightwave.schema.testing.spec_alignment import (
    AlignmentIssue,
    AlignmentReport,
    SpecAlignmentChecker,
    WebSocketSpecChecker,
    assert_spec_aligned,
    assert_websocket_spec_aligned,
)

# SST Validators - Type Safety Across Modules
from lightwave.schema.testing.sst_validator import (
    DjangoModelValidator,
    PydanticSchemaValidator,
    SSTValidator,
    ValidationError,
    ValidationReport,
    validate_django_model_choices,
    validate_pydantic_literal,
    validate_sst,
)

__all__ = [
    # Fixtures
    "sst_registry",
    "sst_routes",
    "sst_webhooks",
    "sst_tenants",
    "sst_layouts",
    "sst_blueprints",
    "sst_user_types",
    "sst_user_flows",
    "fresh_sst_registry",
    "all_route_names",
    "all_tenant_slugs",
    "all_layout_names",
    "all_blueprint_names",
    "all_user_type_names",
    "all_flow_names",
    # Parametrize helpers
    "sst_param_routes",
    "sst_param_tenants",
    "sst_param_layouts",
    "sst_param_blueprints",
    "sst_param_user_types",
    "sst_param_user_flows",
    "sst_param_entry_points",
    "sst_param_route_layout_pairs",
    "sst_param_flow_steps",
    "sst_param_tenant_domains",
    "generate_flow_test_class",
    "generate_all_flow_tests",
    # Markers
    "sst_spec",
    "flow_test",
    "requires_user_type",
    "requires_feature",
    "for_tenant",
    "validate_against_sst",
    "pytest_configure",
    # Adversarial Testing
    "AdversarialReport",
    "AdversarialResult",
    "BoundaryTestSuite",
    "LiteralExhaustionTest",
    "RejectionTestSuite",
    "RoundTripTestSuite",
    "adversarial_test",
    "boundary_test",
    "generate_rejection_tests",
    "rejection_test",
    # Schema Tester
    "SchemaTestReport",
    "SchemaTester",
    "TestResult",
    # Spec Alignment
    "AlignmentIssue",
    "AlignmentReport",
    "SpecAlignmentChecker",
    "WebSocketSpecChecker",
    "assert_spec_aligned",
    "assert_websocket_spec_aligned",
    # SST Validators
    "DjangoModelValidator",
    "PydanticSchemaValidator",
    "SSTValidator",
    "ValidationError",
    "ValidationReport",
    "validate_django_model_choices",
    "validate_pydantic_literal",
    "validate_sst",
]
