"""Tests for agent content validation primitives."""

import pytest

pytest.importorskip("duckdb")


class TestValidateMotionCoverage:
    def test_returns_coverage_gaps(self, tmp_duckdb_path):
        from agent_tools.content import validate_motion_coverage

        result = validate_motion_coverage(tmp_duckdb_path, start_date="2024-01-01", end_date="2024-12-31")
        assert isinstance(result, dict)
        assert "gaps" in result
        assert "coverage_rate" in result or "error" in result


class TestValidateLaymanExplanations:
    def test_returns_quality_report(self, tmp_duckdb_path):
        from agent_tools.content import validate_layman_explanations

        result = validate_layman_explanations(tmp_duckdb_path, sample_size=5)
        assert isinstance(result, dict)
        assert "sample_size" in result
        assert "coverage" in result or "error" in result


class TestCheckEmbeddingQuality:
    def test_returns_coverage_stats(self, tmp_duckdb_path):
        from agent_tools.content import check_embedding_quality

        result = check_embedding_quality(tmp_duckdb_path, window_id="current_parliament")
        assert isinstance(result, dict)
        assert "coverage" in result or "error" in result
        assert "healthy" not in result
