"""Reference-only implementation for the ETH Breakout Playbook.

This file is intentionally simple and is not production trading software.
"""

from __future__ import annotations

from typing import Any, Dict, List


CONFIRMATION_LOW = 2385
CONFIRMATION_HIGH = 2400
UPSIDE_ZONE = [2550, 2650]


def evaluate_eth_breakout(
    price: float,
    close_4h: float,
    liquidity_sweep: bool,
    btc_regime: str,
) -> Dict[str, Any]:
    if btc_regime == "risk_off":
        return {
            "state": "failed_breakout_risk",
            "confidence": 0.68,
            "reason": "BTC regime filter is risk_off.",
        }

    if close_4h >= CONFIRMATION_LOW and not liquidity_sweep:
        return {
            "state": "confirmed_breakout",
            "upside_zone": UPSIDE_ZONE,
            "confidence": 0.80,
            "reason": "ETH is accepted above the confirmation shelf.",
        }

    if CONFIRMATION_LOW <= price <= CONFIRMATION_HIGH:
        return {
            "state": "decision_zone",
            "confidence": 0.55,
            "reason": "ETH is still negotiating the confirmation shelf.",
        }

    return {
        "state": "failed_breakout_risk",
        "confidence": 0.72,
        "reason": "ETH lost the key shelf or showed failed-breakout behavior.",
    }


def batch_evaluate(rows: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
    outputs: List[Dict[str, Any]] = []
    for row in rows:
        outputs.append(
            evaluate_eth_breakout(
                price=float(row["price"]),
                close_4h=float(row["close_4h"]),
                liquidity_sweep=bool(row["liquidity_sweep"]),
                btc_regime=str(row["btc_regime"]),
            )
        )
    return outputs
