from typing import Annotated
from fastapi import APIRouter, Depends, UploadFile, File, Form

from models.api import BatchResponse
from api.dependencies import get_flight_api
from components.flight_api import FlightAPIBase

router = APIRouter()


@router.post("/{flight_id}/batches", response_model=BatchResponse)
async def upload_batch(
    flight_id: str,
    files: Annotated[list[UploadFile], File()],
    start_sequence: Annotated[int, Form()],
    end_sequence: Annotated[int, Form()],
    batch_number: Annotated[int, Form()],
    api: FlightAPIBase = Depends(get_flight_api),
) -> BatchResponse:
    return await api.upload_batch(
        flight_id,
        files,
        start_sequence,
        end_sequence,
        batch_number,
    )

