from typing import Dict, Any
from app.config import settings

# API Version
API_VERSION = "v1"

# API Prefix
API_PREFIX = f"/api/{API_VERSION}"

# API Endpoints
class APIEndpoints:
    # Auth
    AUTH = {
        "LOGIN": "/auth/login",
        "SIGNUP": "/auth/signup",
        "REFRESH_TOKEN": "/auth/refresh-token",
    }
    
    # Users
    USERS = {
        "PROFILE": "/users/profile",
        "UPDATE_PROFILE": "/users/profile",
    }
    
    # Lists
    LISTS = {
        "BASE": "/lists",
        "BY_ID": "/lists/{id}",
        "ITEMS": "/lists/{list_id}/items",
        "ITEM": "/lists/{list_id}/items/{item_id}",
    }
    
    # Groups
    GROUPS = {
        "BASE": "/groups",
        "BY_ID": "/groups/{id}",
        "LISTS": "/groups/{group_id}/lists",
        "MEMBERS": "/groups/{group_id}/members",
    }
    
    # Invites
    INVITES = {
        "BASE": "/invites",
        "BY_ID": "/invites/{id}",
        "ACCEPT": "/invites/{id}/accept",
        "DECLINE": "/invites/{id}/decline",
    }
    
    # OCR
    OCR = {
        "PROCESS": "/ocr/process",
    }
    
    # Financials
    FINANCIALS = {
        "EXPENSES": "/financials/expenses",
        "EXPENSE": "/financials/expenses/{id}",
        "SETTLEMENTS": "/financials/settlements",
        "SETTLEMENT": "/financials/settlements/{id}",
    }
    
    # Health
    HEALTH = {
        "CHECK": "/health",
    }

# API Metadata
API_METADATA = {
    "title": settings.API_TITLE,
    "description": settings.API_DESCRIPTION,
    "version": settings.API_VERSION,
    "openapi_url": settings.API_OPENAPI_URL,
    "docs_url": settings.API_DOCS_URL,
    "redoc_url": settings.API_REDOC_URL,
}

# API Tags
API_TAGS = [
    {"name": "Authentication", "description": "Authentication and authorization endpoints"},
    {"name": "Users", "description": "User management endpoints"},
    {"name": "Lists", "description": "Shopping list management endpoints"},
    {"name": "Groups", "description": "Group management endpoints"},
    {"name": "Invites", "description": "Group invitation management endpoints"},
    {"name": "OCR", "description": "Optical Character Recognition endpoints"},
    {"name": "Financials", "description": "Financial management endpoints"},
    {"name": "Health", "description": "Health check endpoints"},
]

# Helper function to get full API URL
def get_api_url(endpoint: str, **kwargs) -> str:
    """
    Get the full API URL for an endpoint.
    
    Args:
        endpoint: The endpoint path
        **kwargs: Path parameters to format the endpoint
        
    Returns:
        str: The full API URL
    """
    formatted_endpoint = endpoint.format(**kwargs)
    return f"{API_PREFIX}{formatted_endpoint}" 