"""HIT-EA連携処理で共有する定数。"""

from __future__ import annotations

MT_ENCODING = "utf-16 LE"

DEFAULT_GPT_MODEL = "gpt-5.5"
DEFAULT_REASONING_EFFORT = "low"
VALID_REASONING_EFFORTS = frozenset({"none", "low", "medium", "high", "xhigh"})
DEFAULT_TEXT_VERBOSITY = "low"
VALID_TEXT_VERBOSITIES = frozenset({"low", "medium", "high"})
DEBUG_PRINT = True
ENTRY_RESPONSE_SCHEMA_VERSION = 1

ATR_PERIOD = 14
ATR_BASELINE_PERIOD = 20
HIGH_VOL_MULTIPLIER = 1.20
ABNORMAL_VOL_MULTIPLIER = 2.00
ABNORMAL_RANGE_MULTIPLIER = 2.50
MIN_VOL_BARS = ATR_PERIOD + 1

USE_IMBALANCE_FILTER = True
IMBALANCE_AVG_BODY_PERIOD = 20
IMBALANCE_SENSITIVITY = 2.5
IMBALANCE_MIN_AVG_BODY_SIZE = 0.01

ENTRY_MAX_DISTANCE_LIMIT_EATR_MULTIPLIER = 1.00
ENTRY_MAX_DISTANCE_STOP_EATR_MULTIPLIER = 1.50
ENTRY_MAX_DISTANCE_MIN_PRICE = 5.0
MIN_ENTRY_REWARD_RISK_RATIO = 1.20

CANDLE_TREND = 72
CANDLE_SHORT = 36
CANDLE_LONG = 72

INSTRUMENT = "GOLD"
TREND_TIMEFRAME = "H4"
ENTRY_TIMEFRAME = "H1"

TARGET_SIZE = 13
ENTRY_RESPONSE_SCHEMA_VERSION = 1
TECHNICAL_ERROR_STOP = 6

TREND_MAX_OUTPUT_TOKENS = 128
TREND_DEBUG_MAX_OUTPUT_TOKENS = 512
ENTRY_MAX_OUTPUT_TOKENS = 512
ENTRY_DEBUG_MAX_OUTPUT_TOKENS = 1200

MARKET_STATE_LABELS: dict[int, str] = {
    0: "LOW_VOL_RANGE",
    1: "HIGH_VOL_RANGE",
    2: "LOW_VOL_UP",
    3: "HIGH_VOL_UP",
    4: "LOW_VOL_DOWN",
    5: "HIGH_VOL_DOWN",
    6: "TECHNICAL_ERROR_STOP",
}

VALID_MARKET_STATES = frozenset(MARKET_STATE_LABELS)
