"""HeatDebt configuration — check/tune these before running."""

import os

# --- UNO Q HTTP endpoint (App Lab WebUI brick, served on port 7000) ---
UNO_Q_HOST = "192.168.1.79"   # set to your UNO Q's actual LAN IP (check with `hostname -I` on the board)
UNO_Q_PORT = 7000
UNO_Q_POLL_INTERVAL_SECONDS = 2

# --- Ambient temperature reference bands (Celsius) ---
# No humidity sensor here, so this uses plain air temperature rather than a
# true heat index. Thresholds are set a bit higher than heat-index bands
# would be, since there's no humidity term inflating perceived heat.
# Tune these to your actual climate/use case.
BASELINE_TEMP_C = 29.4      # ~85F - below this, no exposure accrues
DANGER_TEMP_C = 35.0        # ~95F - accrual multiplies faster above this

# --- Exposure score model ---
# Score behaves like a "heat debt" meter: it climbs the longer + hotter
# you're exposed, and drains once you leave the hot zone.
ACCUM_RATE = 1.0            # score units per (excess-C * minute) while exposed
DANGER_MULTIPLIER = 3.0     # accrual multiplier once temp is in the Danger band
DECAY_RATE = 2.0            # score units recovered per minute once you leave
PRESENCE_TIMEOUT_SECONDS = 30   # no camera-confirmed motion for this long = "left the zone"

WARNING_SCORE = 30    # local buzzer chirp — "consider a break soon"
BREAK_SCORE = 60      # buzzer + SMS — "take a break now"
DANGER_SCORE = 90     # urgent buzzer + SMS — possible heat-illness risk

# --- Twilio (create free trial at twilio.com/console) ---
TWILIO_ACCOUNT_SID = os.environ.get("TWILIO_ACCOUNT_SID", "")
TWILIO_AUTH_TOKEN = os.environ.get("TWILIO_AUTH_TOKEN", "")
TWILIO_FROM_NUMBER = os.environ.get("TWILIO_FROM_NUMBER", "")
OWNER_PHONE_NUMBER = os.environ.get("OWNER_PHONE_NUMBER", "")

# --- Buzzer on the Pi 5 (BCM GPIO numbering) ---
BUZZER_GPIO_PIN = 17

# --- Camera presence detection (this IS the presence sensor now — no PIR) ---
CAMERA_ENABLED = True
MOTION_PIXEL_THRESHOLD = 2000
CAMERA_POLL_INTERVAL_SECONDS = 2     # how often to grab + check a frame
BG_SUBTRACTOR_HISTORY = 500          # higher = slower to absorb a STILL person into "background"

# --- Logging ---
LOG_CSV_PATH = "heatdebt_log.csv"
