from __future__ import annotations

from fastapi import APIRouter, Depends

from backend.app.api.schemas import DuplicateRequest, TaskCreateResponse
from backend.app.dependencies import get_duplicate_task_service
from backend.app.services.duplicate_task_service import DuplicateTaskService

router = APIRouter(prefix="/files")


@router.post("/duplicate", response_model=TaskCreateResponse, status_code=202)
async def duplicate_paths(
    request: DuplicateRequest,
    service: DuplicateTaskService = Depends(get_duplicate_task_service),
) -> TaskCreateResponse:
    return service.create_duplicate_task(paths=request.paths)
