"""Test temporal classification — fresh/recent/historical boundaries."""

import pytest
from capabilities.harvest import _compute_temporal_category
from datetime import date, timedelta


class TestTemporalClassification:
    """Test temporal category computation at boundaries."""
    
    def test_fresh_boundary_13_days(self):
        """13 days ago should be fresh."""
        today = date(2026, 5, 20)
        filing_date = today - timedelta(days=13)
        cat = _compute_temporal_category(filing_date.isoformat(), today)
        assert cat == "fresh"
    
    def test_fresh_boundary_14_days(self):
        """14 days ago should be fresh (inclusive)."""
        today = date(2026, 5, 20)
        filing_date = today - timedelta(days=14)
        cat = _compute_temporal_category(filing_date.isoformat(), today)
        assert cat == "fresh"
    
    def test_recent_boundary_15_days(self):
        """15 days ago should be recent."""
        today = date(2026, 5, 20)
        filing_date = today - timedelta(days=15)
        cat = _compute_temporal_category(filing_date.isoformat(), today)
        assert cat == "recent"
    
    def test_recent_boundary_89_days(self):
        """89 days ago should be recent."""
        today = date(2026, 5, 20)
        filing_date = today - timedelta(days=89)
        cat = _compute_temporal_category(filing_date.isoformat(), today)
        assert cat == "recent"
    
    def test_historical_boundary_90_days(self):
        """90 days ago should be historical."""
        today = date(2026, 5, 20)
        filing_date = today - timedelta(days=90)
        cat = _compute_temporal_category(filing_date.isoformat(), today)
        assert cat == "historical"
    
    def test_historical_100_days(self):
        """100 days ago should be historical."""
        today = date(2026, 5, 20)
        filing_date = today - timedelta(days=100)
        cat = _compute_temporal_category(filing_date.isoformat(), today)
        assert cat == "historical"