# ================================================================
# GATEWAY SERVICE CONFIGURATION
# gateway/app/core/config.py
# ================================================================

"""
Gateway service configuration
Central API Gateway for all microservices
"""

from shared.config.base import BaseServiceSettings
import os
from typing import Dict, List

class GatewaySettings(BaseServiceSettings):
    """Gateway-specific settings"""
    
    # Service Identity
    APP_NAME: str = "Bakery Forecasting Gateway"
    SERVICE_NAME: str = "gateway"
    DESCRIPTION: str = "API Gateway for Bakery Forecasting Platform"
    
    # Gateway-specific Redis database
    REDIS_DB: int = 6
    
    # Service Discovery
    CONSUL_URL: str = os.getenv("CONSUL_URL", "http://consul:8500")
    ENABLE_SERVICE_DISCOVERY: bool = os.getenv("ENABLE_SERVICE_DISCOVERY", "false").lower() == "true"
    
    # Load Balancing
    ENABLE_LOAD_BALANCING: bool = os.getenv("ENABLE_LOAD_BALANCING", "true").lower() == "true"
    LOAD_BALANCER_ALGORITHM: str = os.getenv("LOAD_BALANCER_ALGORITHM", "round_robin")
    
    # Circuit Breaker
    CIRCUIT_BREAKER_ENABLED: bool = os.getenv("CIRCUIT_BREAKER_ENABLED", "true").lower() == "true"
    CIRCUIT_BREAKER_FAILURE_THRESHOLD: int = int(os.getenv("CIRCUIT_BREAKER_FAILURE_THRESHOLD", "5"))
    CIRCUIT_BREAKER_RECOVERY_TIMEOUT: int = int(os.getenv("CIRCUIT_BREAKER_RECOVERY_TIMEOUT", "60"))
    
    # Request/Response Settings
    MAX_REQUEST_SIZE: int = int(os.getenv("MAX_REQUEST_SIZE", "10485760"))  # 10MB
    REQUEST_TIMEOUT: int = int(os.getenv("REQUEST_TIMEOUT", "30"))
    
    # Gateway doesn't need a database
    DATABASE_URL: str = ""

settings = GatewaySettings()
