"""Shared test fixtures for ACE-F test suite."""
from __future__ import annotations

import json
from pathlib import Path

import pytest

FIXTURES_DIR = Path(__file__).parent / "fixtures"


def load_fixture(name: str) -> dict:
    return json.loads((FIXTURES_DIR / name).read_text())


@pytest.fixture
def filing_search_fixture() -> dict:
    return load_fixture("filing_search.json")


@pytest.fixture
def exhibit_content_fixture() -> dict:
    return load_fixture("exhibit_content.json")


@pytest.fixture
def price_data_fixture() -> dict:
    return load_fixture("price_data.json")


@pytest.fixture
def financial_data_fixture() -> dict:
    return load_fixture("financial_data.json")


@pytest.fixture
def short_volume_fixture() -> dict:
    return load_fixture("short_volume.json")


@pytest.fixture
def fred_observations_fixture() -> dict:
    return load_fixture("fred_observations.json")


@pytest.fixture
def sample_exhibit_text() -> str:
    data = load_fixture("exhibit_content.json")
    return data["content"]


@pytest.fixture
def sample_parser_output() -> dict:
    return {
        "schema_version": "1.0.0",
        "document_id": "DOC::sec::ISSUER::0000320193::2026-01-29::0000320193-26-000001",
        "parser_kind": "rule",
        "event_type": "earnings_release",
        "event_direction": "bullish",
        "event_date": "2026-01-29",
        "filing_time_bucket": "post_market",
        "headline": "Apple Inc. Reports First Quarter Results",
        "summary": "Apple today announced financial results for its fiscal 2026 Q1.",
        "guidance": {
            "status": "raised",
            "scope": "unknown",
            "notes": "Guidance raised for Q2"
        },
        "signals": {
            "demand_strength": "strong",
            "pricing_power": "present",
            "backlog_or_bookings": "present",
            "customer_expansion": "present",
            "margin_quality": "improving"
        },
        "risk_flags": {
            "oneoff_item": False,
            "tax_benefit": False,
            "valuation_gain": False,
            "non_gaap_heavy": True,
            "financing_related": False,
            "legal_or_regulatory_overhang": False
        },
        "evidence": [],
        "confidence": {
            "overall": 0.78,
            "event_type": 0.9,
            "event_direction": 0.75,
            "guidance": 0.8,
            "risk_flags": 0.9
        },
        "warnings": []
    }
