from typing import Annotated

from fastapi import FastAPI, File, Form, UploadFile
from pydantic import BaseModel


class Item(BaseModel):
    target: Annotated[UploadFile, File()]
    template: list[UploadFile]
    description: str | None = None


app = FastAPI()

#
# @app.post("/items/")
# async def create_item(item: Item):
#     return item


@app.post("/files/")
async def upload_file(
    # item: Item,
    file: Annotated[bytes, File()],
    fileb: list[Annotated[UploadFile, File()]],
    token: Annotated[str, Form()],
):
    return {
        "file_size": len(file),
        "token": token,
        "fileb_content_type": fileb[0].content_type,
    }
