import os
from dotenv import load_dotenv

load_dotenv()

class Config:
    PROJECT_NAME = "Flexible Employment Analysis API"
    API_V1_STR = "/api/v1"
    SECRET_KEY = os.getenv("SECRET_KEY", "your-secret-key")
    DATABASE_URL = os.getenv("DATABASE_URL", "sqlite:///./test.db")
    DEBUG = os.getenv("DEBUG", "false").lower() in ("true", "1", "t")
    
    # FastGPT Configuration
    FASTGPT_API_KEY = os.getenv("ANALYSIS_AUTH_TOKEN")
    FASTGPT_BASE_URL = os.getenv("ANALYSIS_SERVICE_URL")
    FASTGPT_APP_ID = os.getenv("APP_ID")
    DELETE_SESSION_URL = os.getenv("DELETE_SESSION_URL")
    DELETE_CHAT_URL = os.getenv("DELETE_CHAT_URL")
    GET_CHAT_RECORDS_URL = os.getenv("GET_CHAT_RECORDS_URL")
    
    @classmethod
    def validate(cls):
        """Validate required configuration."""
        required = [
            ("FASTGPT_API_KEY", cls.FASTGPT_API_KEY),
            ("FASTGPT_APP_ID", cls.FASTGPT_APP_ID),
        ]
        missing = [name for name, value in required if not value]
        if missing:
            raise ValueError(f"Missing required environment variables: {', '.join(missing)}")