{%- import 'includes/type_hint.py.jinja' as th %}
{%- macro render_param(param) %}
        {{ param.name }}: typing.Annotated[{{ th.type_hint(param.type, path) }}, {{ param.in_.value | capitalize }}(
    {%- if param.alias  %}'{{ param.alias }}', {% endif %}
    {%- if param.style %}style='{{ param.style.value }}',{% endif %}
    {%- if param.explode %}explode={{ param.explode }},{% endif -%}
)]{% if not param.required %} = None{% endif %},
{%- endmacro %}
{%- macro render_mime_map(mime_map) -%}
{
{%- for media_type, type_hint in mime_map.items() %}
    '{{ media_type }}': {{ th.type_hint(type_hint) }},
{%- endfor %}
}{% endmacro %}
    @{{ func.method }}('{{ func.path }}'{% if func.security is not none %}, security={{ func.security }}{% endif %})
    async def {{ func.name }}(
        self: typing.Self,
{%- if not func.request_body_type.is_none() %}
        request_body: typing.Annotated[
            {{ th.type_hint(func.request_body_type, path) }},
            RequestBody({{ render_mime_map(func.request_body) | indent(12, False) }}),
        ],
{%- endif %}
{%- if func.params | length > 0 %}
        *,{% endif %}
{%- for param in func.params if param.required %}
        {{- render_param(param) }}
{%- endfor %}
{%- for param in func.params if not param.required %}
        {{- render_param(param) }}
{%- endfor %}
    ) -> typing.Annotated[
        Awaitable[{{ th.type_hint(func.response_body_type, path) }}],
        Responses({
            {%- for code, mime_map in func.responses.items() %}
            '{{ code }}': {{ render_mime_map(mime_map) | indent(12, False) }},
            {%- endfor %}
        })
    ]:
        pass
