from pathlib import Path
from dotenv import load_dotenv
import os

BASE_DIR = Path(__file__).resolve().parents[2]
ENV_PATH = BASE_DIR / ".env"
load_dotenv(ENV_PATH)

# Paths
DATA_DIR = BASE_DIR / "backend" / "data"
LOG_DIR = BASE_DIR / "backend" / "logs"
LOG_DIR.mkdir(parents=True, exist_ok=True)
DATA_DIR.mkdir(parents=True, exist_ok=True)

# Env
ENV = os.getenv("ENV", "dev")
LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO")

# Telegram
TELEGRAM_BOT_TOKEN = os.getenv("TELEGRAM_BOT_TOKEN", "")
TELEGRAM_CHAT_ID = os.getenv("TELEGRAM_CHAT_ID", "")

# Thresholds (defaults; werden via Settings editierbar)
SCORE_MIN = float(os.getenv("SCORE_MIN", 88))
RVOL_MIN = float(os.getenv("RVOL_MIN", 1.3))
CRV_MIN = float(os.getenv("CRV_MIN", 1.5))
ATR_MIN = float(os.getenv("ATR_MIN", 2))
ATR_MAX = float(os.getenv("ATR_MAX", 8))

LIVE_INTERVAL_MIN = int(os.getenv("LIVE_INTERVAL_MIN", 5))
COOLDOWN_MIN = int(os.getenv("COOLDOWN_MIN", 60))
