"""
Shared pytest fixtures.

Centralizes test setup so individual test files stay focused on
assertions, not boilerplate. Tests run against an isolated, mocked
environment — no real model files, database, or Redis required to run
the unit test suite, which is what makes it fast enough to run on
every commit.
"""

import numpy as np
import pytest


@pytest.fixture
def sample_feature_vector() -> np.ndarray:
    """A realistic 12-element feature vector matching FEATURE_COLUMNS order."""
    return np.array([
        120.0,  # rainfall_mm
        32.0,   # temp_c
        80.0,   # humidity
        0,      # season_index (kharif)
        0.2,    # rainfall_anomaly
        110.0,  # rainfall_ma3
        100.0,  # rainfall_lag1
        1200.0, # water_req_mm
        20.0,   # min_temp_c
        35.0,   # max_temp_c
        0.0,    # drought_tolerant
        120.0,  # growth_days
    ])


@pytest.fixture
def sample_crops_lookup() -> dict:
    return {
        "rice": {
            "water_req_mm": 1200, "min_temp_c": 20, "max_temp_c": 35,
            "growth_days": 120, "drought_tolerant": False,
        },
        "maize": {
            "water_req_mm": 500, "min_temp_c": 18, "max_temp_c": 32,
            "growth_days": 90, "drought_tolerant": True,
        },
    }


@pytest.fixture
def sample_districts_lookup() -> dict:
    return {
        "thanjavur": {"state": "tamil nadu", "lat": 10.787, "lon": 79.137},
        "madurai": {"state": "tamil nadu", "lat": 9.925, "lon": 78.119},
    }
