# Generated by smithplates HTTP codegen. Do not edit.

from __future__ import annotations

from dataclasses import dataclass

from fastapi import HTTPException, Request

from generated.petstore.api.petstore.apis.categories_api_base import CategoriesApiServiceProtocol
from generated.petstore.api.petstore.apis.health_api_base import HealthApiServiceProtocol
from generated.petstore.api.petstore.apis.orders_api_base import OrdersApiServiceProtocol
from generated.petstore.api.petstore.apis.pets_api_base import PetsApiServiceProtocol


@dataclass(frozen=True)
class ApiServices:
    categories_api: CategoriesApiServiceProtocol
    health_api: HealthApiServiceProtocol
    orders_api: OrdersApiServiceProtocol
    pets_api: PetsApiServiceProtocol


def get_api_services(request: Request) -> ApiServices:
    services = getattr(request.app.state, "api_services", None)
    if not isinstance(services, ApiServices):
        raise HTTPException(status_code=500, detail="API services are not configured")
    return services
