"""FastAPI app generated by intpot."""

from fastapi import FastAPI
from pydantic import BaseModel, Field

app = FastAPI()
{% for tool in tools %}
{% if tool.parameters %}


class {{ tool.name | capitalize }}Request(BaseModel):
{%- for param in tool.parameters %}
    {{ param.name }}: {{ param.type_annotation }}
{%- if not param.required %} = Field(default={{ param.default | repr }}, description="{{ param.description }}")
{%- else %} = Field(..., description="{{ param.description }}")
{%- endif %}
{%- endfor %}


@app.post("/{{ tool.name }}")
def {{ tool.name }}(request: {{ tool.name | capitalize }}Request) -> dict:
    """{{ tool.description }}"""
    # TODO: implement
    return {"result": "{{ tool.name }} called"}
{%- else %}


@app.post("/{{ tool.name }}")
def {{ tool.name }}() -> dict:
    """{{ tool.description }}"""
    # TODO: implement
    return {"result": "{{ tool.name }} called"}
{%- endif %}
{%- endfor %}
