"""Application-wide constants and default settings."""

from pathlib import Path

APP_NAME = "Duck Preview"
APP_VERSION = "0.1.0"

# Default camera settings
DEFAULT_FPS = 30
DEFAULT_WIDTH = 1280
DEFAULT_HEIGHT = 720

# Telemetry
TELEMETRY_UPDATE_INTERVAL_MS = 500  # how often the metrics snapshot is refreshed

# Overlay
OVERLAY_BG_COLOR = (0, 0, 0, 160)   # RGBA
OVERLAY_TEXT_COLOR = (255, 255, 255, 255)
OVERLAY_FONT_SIZE = 13
OVERLAY_PADDING = 10
OVERLAY_MARGIN = 10

# Frame dispatcher
DISPATCHER_MAX_QUEUE_SIZE = 2  # max pending frames per slow subscriber before drop

# Logging
LOG_DIR = Path("logs")              # relative to CWD (project root)
MAX_LOG_FILES = 20                  # oldest sessions are deleted when exceeded
TELEMETRY_CSV_INTERVAL_S = 5.0     # how often a CSV row is written (seconds)

# Inference worker
INFERENCE_WORKER_TIMEOUT_S = 10.0  # seconds without response before watchdog fires
INFERENCE_MAX_RESTARTS = 3         # max auto-restart attempts before giving up
INFERENCE_POLL_INTERVAL_MS = 50    # how often GUI thread polls output queue (ms)
INFERENCE_WATCHDOG_INTERVAL_MS = 2000  # how often watchdog checks process health (ms)

# BBox overlay
BBOX_COLOR = (0, 220, 60, 255)          # RGBA — vivid green
BBOX_LABEL_BG_COLOR = (0, 220, 60, 200) # RGBA — semi-transparent green for label bg
BBOX_LABEL_TEXT_COLOR = (0, 0, 0, 255)  # RGBA — black text on green bg
BBOX_LINE_WIDTH = 2
BBOX_FONT_SIZE = 11

# Video file source
VIDEO_FILE_EXTENSIONS = "Video Files (*.mp4 *.avi *.mov *.mkv *.m4v *.webm)"
MODEL_FILE_EXTENSIONS = "YOLO Model (*.pt *.pth)"
