import os
from dataclasses import dataclass
from dotenv import load_dotenv

# Load environment variables from .env file
load_dotenv()

# Configuration Management

@dataclass
class AppConfig:
    minio_endpoint: str
    minio_access_key: str
    minio_secret_key: str
    minio_bucket: str
    n8n_webhook_url: str
    openai_api_key: str

    @classmethod
    def from_env(cls) -> 'AppConfig':
        return cls(
            minio_endpoint=os.getenv("MINIO_ENDPOINT", "http://minio:9000"),
            minio_access_key=os.getenv("MINIO_ACCESS_KEY"),
            minio_secret_key=os.getenv("MINIO_SECRET_KEY"),
            minio_bucket=os.getenv("MINIO_BUCKET"),
            n8n_webhook_url=os.getenv("N8N_WEBHOOK_URL"),
            openai_api_key=os.getenv("OPENAI_API_KEY")
        )