import request from '@/utils/request'

// 循环发送短信 - 查询列表
export function listLoopSendAPI(query) {
    return request({
        url: '/msgJob/list',
        method: 'GET',
        params: query,
    })
}

// 循环发送短信 - 新增
export function addLoopSendAPI(data) {
    return request({
        url: '/msgJob/add',
        method: 'POST',
        data,
    })
}

// 循环发送短信 - 修改
export function updateLoopSendAPI(data) {
    return request({
        url: '/msgJob/update',
        method: 'POST',
        data,
    })
}

// 循环发送短信 - 删除
export function delLoopSendAPI(data) {
    return request({
        url: '/msgJob/delete',
        method: 'POST',
        data,
    })
}

// 循环发送短信 - 详情
export function getLoopSendDetailAPI(id) {
    return request({
        url: `/msgJob/getById`,
        method: 'POST',
        data: {
            id,
        },
    })
}

// 循环发送短信 - 更新任务状态
export function updateLoopSendStatusAPI(data) {
    return request({
        url: '/msgJob/updateTaskStatus',
        method: 'POST',
        data,
    })
}

// 获取短信余额
export function getSmsBalanceAPI() {
    return request({
        url: '/msgJob/getMessageBalance',
        method: 'GET',
    })
}

// 获取循环的发送记录
export function getLoopSendRecordsAPI(data) {
    return request({
        url: '/msgJob/getMsgLoopData',
        method: 'GET',
        params: data,
    })
}

// 获取单次循环发送记录的详情列表
export function getLoopSendRecordDetailsAPI(data) {
    return request({
        url: '/msgJob/getOneLoopMsgData',
        method: 'GET',
        params: data,
    })
}

// 单人重新发送
export function resendOneLoopMsgAPI(data) {
    return request({
        url: '/msgJob/oneWorkerResend',
        method: 'POST',
        data,
    })
}

// 立即执行一次
export function runOneLoopMsgAPI(data) {
    return request({
        url: '/msgJob/executeOnceJob',
        method: 'POST',
        data,
    })
}

