"""API routes for BooruGacha — serves category schema to the frontend."""

from aiohttp import web

from .data import DATA_DIR, load_category_schema


def add_routes(app: web.Application):
    app.router.add_get("/booru-gacha/categories", _handle_categories)


async def _handle_categories(_request: web.Request) -> web.Response:
    schema = load_category_schema(DATA_DIR)
    return web.json_response(schema)
