from __future__ import annotations

from dataclasses import dataclass
from enum import Enum
from typing import Any


class Side(str, Enum):
    BUY = "buy"
    SELL = "sell"
    HOLD = "hold"


@dataclass(frozen=True)
class Candle:
    time: int
    open: float
    high: float
    low: float
    close: float
    vwap: float
    volume: float
    count: int


@dataclass(frozen=True)
class Signal:
    side: Side
    reason: str
    confidence: float = 0.0
    metadata: dict[str, Any] | None = None

    @classmethod
    def hold(cls, reason: str = "No trade setup") -> "Signal":
        return cls(Side.HOLD, reason, 0.0, {})
