# app/api/main.py
"""
API router configuration for multi-tenant ecommerce platform.

This module provides:
- API version 1 route aggregation
- Route organization by user type (admin, vendor, storefront)
- Auto-discovery of module routes
"""

from fastapi import APIRouter

from app.api.v1 import admin, platform, storefront, vendor, webhooks

api_router = APIRouter()

# ============================================================================
# ADMIN ROUTES (Platform-level management)
# Prefix: /api/v1/admin
# ============================================================================

api_router.include_router(admin.router, prefix="/v1/admin", tags=["admin"])

# ============================================================================
# VENDOR ROUTES (Vendor-scoped operations)
# Prefix: /api/v1/vendor
# ============================================================================

api_router.include_router(vendor.router, prefix="/v1/vendor", tags=["vendor"])

# ============================================================================
# STOREFRONT ROUTES (Public customer-facing API)
# Prefix: /api/v1/storefront
# Note: Previously /api/v1/shop, renamed as not all platforms sell items
# ============================================================================

api_router.include_router(storefront.router, prefix="/v1/storefront", tags=["storefront"])

# ============================================================================
# PLATFORM ROUTES (Unauthenticated endpoints)
# Prefix: /api/v1/platform
# Includes: /signup, /pricing, /letzshop-vendors, /language
# ============================================================================

api_router.include_router(platform.router, prefix="/v1/platform", tags=["platform"])

# ============================================================================
# WEBHOOK ROUTES (External service callbacks via auto-discovery)
# Prefix: /api/v1/webhooks
# Includes: /stripe
# ============================================================================

api_router.include_router(webhooks.router, prefix="/v1/webhooks", tags=["webhooks"])
