import os
from dotenv import load_dotenv

# Load environment variables from .env file
load_dotenv()


class Config:
    """Configuration settings for DS Task Tag Scan System"""
    
    # Flask Settings
    DEBUG = os.getenv('DEBUG', 'False').lower() == 'true'
    HOST = os.getenv('HOST', '0.0.0.0')
    PORT = int(os.getenv('PORT', 5000))
    
    # Data Paths
    TAG_GUIDES_PATH = os.getenv('TAG_GUIDES_PATH', 'data/tag_guides_clean.json')
    EXPERT_DATA_PATH = os.getenv('EXPERT_DATA_PATH', 'data/expert_data.csv')
    COMMUNITY_DATA_PATH = os.getenv('COMMUNITY_DATA_PATH', 'data/community_data.csv')
    
    # Model Settings
    CLIP_MODEL = os.getenv('CLIP_MODEL', 'openai/clip-vit-base-patch16')
    MAX_IMAGES = int(os.getenv('MAX_IMAGES', 200))  # Limit for testing
    
    # Cache Settings
    EMBEDDINGS_CACHE_FILE = os.getenv('EMBEDDINGS_CACHE_FILE', 'data/image_embeddings_200.pkl')
    USE_CACHE = os.getenv('USE_CACHE', 'True').lower() == 'true'
    
    # Processing Settings
    REQUEST_TIMEOUT = int(os.getenv('REQUEST_TIMEOUT', 60))  # seconds
    IMAGE_TIMEOUT = int(os.getenv('IMAGE_TIMEOUT', 10))     # seconds
    MAX_SIMILARITY_RESULTS = int(os.getenv('MAX_SIMILARITY_RESULTS', 5))
    
    # OCR Settings
    OCR_METHOD = os.getenv('OCR_METHOD', 'auto')  # 'auto', 'easyocr', 'clip_only'
    
    # Optional: LLM Enhancement (Groq)
    GROQ_API_KEY = os.getenv('GROQ_API_KEY', None)
    USE_LLM_ENHANCEMENT = os.getenv('USE_LLM_ENHANCEMENT', 'False').lower() == 'true'

# Create config instance
config = Config()
