from dataclasses import dataclass
from swagger_codegen.api.client import ApiClient
from swagger_codegen.api.configuration import Configuration
from swagger_codegen.api.adapter.base import HttpClientAdapter

{% for api in apis %}
from .apis.{{ api.name }}.api import {{ api.type_name }}
{% endfor %}


@dataclass
class AutogeneratedApiClient:
    configuration: Configuration
    client: ApiClient
    {%- for api in apis %}
    {{ api.name }}: {{ api.type_name }}
    {%- endfor %}


def new_client(
    adapter: HttpClientAdapter, configuration: Configuration
) -> AutogeneratedApiClient:
    client = ApiClient(configuration=configuration, adapter=adapter)
    return AutogeneratedApiClient(
        configuration,
        client=client,
        {% for api in apis %}
        {{ api.name }}={{ api.type_name }}(client, configuration){% if not loop.last %},{% endif %}
        {% endfor %}
    )
