"""Feature flag configuration for the compatibility adapter.

The adapter is disabled by default and must be explicitly enabled for
replay, shadow, canary, or production modes.
"""

from __future__ import annotations

from enum import Enum


class AdapterMode(str, Enum):
    """Operating mode for the compatibility adapter.

    - disabled: adapter does not run (default)
    - replay_only: adapter runs during offline replay evaluation
    - shadow_only: adapter runs in shadow mode (no downstream effect)
    - canary: adapter outputs routed to a percentage of non-trading consumers
    - production: adapter outputs used for all consumers
    """

    DISABLED = "disabled"
    REPLAY_ONLY = "replay_only"
    SHADOW_ONLY = "shadow_only"
    CANARY = "canary"
    PRODUCTION = "production"


def is_adapter_enabled(mode: AdapterMode) -> bool:
    """Return True if the adapter should produce output in the given mode.

    Only replay, shadow, canary, and production modes enable output.
    The disabled mode prevents any adapter execution.
    """
    return mode != AdapterMode.DISABLED


# Default mode — adapter is OFF until explicitly activated
DEFAULT_ADAPTER_MODE: AdapterMode = AdapterMode.DISABLED
