Expose game configuration (energy types, card types, rule constants) via /api/config endpoint so frontend can dynamically load game rules without hardcoding values.
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
"""Configuration API router for Mantimon TCG.
|
|
|
|
Provides endpoints for fetching game configuration. The frontend uses these
|
|
values for UI display (progress bars, limits) and includes them in requests.
|
|
|
|
The backend is stateless - these defaults are starting points. The frontend
|
|
may customize them based on game mode (campaign, freeplay, custom) and send
|
|
the appropriate config in validation/creation requests.
|
|
|
|
Endpoints:
|
|
GET /config/deck - Get default DeckConfig
|
|
"""
|
|
|
|
from fastapi import APIRouter
|
|
|
|
from app.core.config import DeckConfig
|
|
|
|
router = APIRouter(prefix="/config", tags=["config"])
|
|
|
|
|
|
@router.get("/deck", response_model=DeckConfig)
|
|
async def get_default_deck_config() -> DeckConfig:
|
|
"""Get default deck building configuration.
|
|
|
|
Returns the standard Mantimon deck rules:
|
|
- 40-card main deck
|
|
- 20-card energy deck
|
|
- 4-copy limit per card
|
|
- 1 Basic Pokemon minimum
|
|
|
|
Frontend uses these for:
|
|
- UI hints (progress bar targets, card limit indicators)
|
|
- Default values in deck validation requests
|
|
|
|
Returns:
|
|
DeckConfig with default Mantimon TCG rules.
|
|
"""
|
|
return DeckConfig()
|