import os
from dotenv import load_dotenv

# Load environment variables
load_dotenv()

class Config:
    # Flask settings
    SECRET_KEY = os.getenv('FLASK_SECRET_KEY', 'dev-secret-key-change-in-production')

    # OpenWeatherMap API settings
    OPENWEATHER_API_KEY = os.getenv('OPENWEATHER_API_KEY', '')
    WEATHER_LOCATION = os.getenv('WEATHER_LOCATION', 'Hamilton,NZ')
    WEATHER_LAT = float(os.getenv('WEATHER_LAT', '-37.7870'))
    WEATHER_LON = float(os.getenv('WEATHER_LON', '175.2793'))
    WEATHER_UNITS = 'metric'  # Use Celsius

    # Google Calendar settings
    GOOGLE_CALENDAR_ID = os.getenv('GOOGLE_CALENDAR_ID', '')
    GOOGLE_CALENDAR_ICAL_URL = os.getenv('GOOGLE_CALENDAR_ICAL_URL', '')
    CALENDAR_DAYS_AHEAD = int(os.getenv('CALENDAR_DAYS_AHEAD', '5'))

    # Update intervals (in seconds)
    IMAGE_ROTATION_INTERVAL = int(os.getenv('IMAGE_ROTATION_INTERVAL', '300'))  # 5 minutes
    WEATHER_UPDATE_INTERVAL = int(os.getenv('WEATHER_UPDATE_INTERVAL', '900'))  # 15 minutes
    CALENDAR_UPDATE_INTERVAL = int(os.getenv('CALENDAR_UPDATE_INTERVAL', '300'))  # 5 minutes
    JOKE_UPDATE_INTERVAL = int(os.getenv('JOKE_UPDATE_INTERVAL', '3600'))  # 1 hour

    # Directories
    BACKGROUNDS_DIR = os.path.join('static', 'backgrounds')
    CREDENTIALS_DIR = 'credentials'
