import {AxiosResponse} from "axios";
import {ResponseVO} from "@/lib/definitions";
import {httpReq} from "@/utils/axiosReq";
import {TaskStepSortVO} from "@/components/type/TaskSort.d";

export const addStepItemAPI= (data:TaskStepSortVO):Promise<AxiosResponse<ResponseVO<TaskStepSortVO>>> =>{
    return httpReq.post(process.env.NEXT_PUBLIC_TODO_REQUEST_URL + `/task/step/sort/item`,
        data)
}
export const insertStepItemAPI= (data:TaskStepSortVO):Promise<AxiosResponse<ResponseVO<TaskStepSortVO>>> =>{
    return httpReq.post(process.env.NEXT_PUBLIC_TODO_REQUEST_URL + `/task/step/sort/insert/item`,
        data)
}
export const updateStepItemAPI= (data:TaskStepSortVO):Promise<AxiosResponse<ResponseVO<TaskStepSortVO>>> =>{
    return httpReq.put(process.env.NEXT_PUBLIC_TODO_REQUEST_URL + `/task/step/sort/item`,
        data)
}
export const updateStepItemIndexAPI=(lastId:string,currentId:string ,nextId:string)=>{
    return httpReq.get(process.env.NEXT_PUBLIC_TODO_REQUEST_URL +
        `/task/step/sort/update/index?lastId=${lastId}&currentId=${currentId}&nextId=${nextId}`)
}

export const deleteStepItemAPI=(id:string)=>{
    return httpReq.delete(process.env.NEXT_PUBLIC_TODO_REQUEST_URL +
        `/task/step/sort/item?id=${id}`)
}