import request from '@/utils/request'

export function getTaskList(params) {
    return request({
        url: '/inspection/task/list', 
        method: 'get',
        params: params
    })
}

export function addTask(data) {
    return request({
        url: '/inspection/task',
        method: 'post',
        data: data
    })
}

export function updateTask(data) {
    return request({
        url: '/inspection/task',
        method: 'put',
        data: data
    })
}

export function deleteTask(id) {
    return request({
        url: `/inspection/task/${id}`,
        method: 'delete'
    })
}

export function getWaypointByTaskId(taskId) {
    return request({
        url: `/inspection/task/${taskId}/waypoints`,
        method: 'get'
    })
}

export function bindWaypointsToTask(taskId, waypointIds) {
    return request({
        url: `/inspection/task/${taskId}/waypoints`,
        method: 'post',
        data: waypointIds
    })
}