"""ante_strategy_sdk — the single definition home for ante's strategy-facing surface.

Record types (``Side``, ``Order``, ``TradeEvent``, ...), the no-lookahead ``Indicators`` API, and
the ``AgentContext`` Protocol all live here, and nowhere else. The engine's own
``ante.types``/``ante.indicators`` modules are pure re-export shims over this package.

Why this matters: the engine dispatches on **enum identity and isinstance** (``order.side is
Side.BUY``, ``isinstance(event, TradeEvent)`` — see ``ante.engine``), not on structural/duck
typing. A strategy that imported a *duplicate* definition of ``Side`` or ``TradeEvent`` (e.g. from
a stale copy) would produce objects that satisfy neither identity check — the engine would accept
every order, match nothing, and silently produce zero fills, with no exception raised anywhere.
Keeping exactly one definition home, imported by both the engine and every strategy bundle, is
what makes that impossible.

Zero runtime dependencies (stdlib only): a strategy bundle's pinned venv needs only this package
to satisfy its type/context contract with the engine.
"""

from __future__ import annotations

import importlib.resources
from decimal import Decimal

from ante_strategy_sdk.context import AgentContext
from ante_strategy_sdk.datafeeds import DataFeedProvider, FeedUnavailable, NullDataFeedProvider
from ante_strategy_sdk.indicators import INDICATOR_API_VERSION, Indicators
from ante_strategy_sdk.types import (
    ConditionId,
    EventType,
    FeedDecisionEvent,
    Fill,
    LiquidityMode,
    Market,
    MarketEvent,
    Order,
    OrderedEvent,
    OrderType,
    Position,
    PriceEvent,
    ResolutionEvent,
    Side,
    TimeInForce,
    TokenId,
    TradeEvent,
)

# Single source of truth for the version: the packaged VERSION data file (kept in lockstep with
# sdk/pyproject.toml by tests/test_version_guard.py). Deliberately NOT importlib.metadata.version()
# -- the same rule as src/ante/__init__.py: this package must resolve its version when imported
# from a bare source tree on PYTHONPATH (no installed dist-info), and a stale dist-info must never
# silently supply a wrong version to be baked into an immutable bundle digest.
__version__ = (
    importlib.resources.files("ante_strategy_sdk").joinpath("VERSION").read_text().strip()
)

__all__ = [
    "INDICATOR_API_VERSION",
    "AgentContext",
    "ConditionId",
    "DataFeedProvider",
    "Decimal",
    "EventType",
    "FeedDecisionEvent",
    "FeedUnavailable",
    "Fill",
    "Indicators",
    "LiquidityMode",
    "Market",
    "MarketEvent",
    "NullDataFeedProvider",
    "Order",
    "OrderType",
    "OrderedEvent",
    "Position",
    "PriceEvent",
    "ResolutionEvent",
    "Side",
    "TimeInForce",
    "TokenId",
    "TradeEvent",
]
