import { TaskReviewModel, TaskReviewQueryParam } from '@/types'
import request from '@/until/request'

/**
 * 获取数据列表
 * @param page TaskReviewQueryParam
 */
const QueryTaskReviewListByTaskDate = (data: TaskReviewQueryParam) =>
    request({
        url: '/TaskReviewAction/list',
        method: 'post',
        data: data
    })

/**
* 新增TaskReview
* @param data TaskReviewModel
*/
const AddTaskReview = (data: TaskReviewModel) =>
    request({
        url: '/TaskReviewAction/saveTaskReview',
        method: 'post',
        data: data
    })

/**
* TaskReview
* @param data TaskReviewModel
*/
const EditTaskReview = (data: TaskReviewModel) =>
    request({
        url: '/TaskReviewAction/updateTaskReview',
        method: 'post',
        data: data
    })

/**
* 处理审核数据(向水利所推送,自动推送失败后,人工推送使用)
* @param data TaskReviewModel
*/
const SendReviewToSls = (data: TaskReviewModel) =>
    request({
        url: '/TaskReviewAction/sendReviewToSls',
        method: 'post',
        data: data
    })

/**
 * 撤销审核
 * @param id 
 * @returns 
 */
const RevokeReview = (id: number) =>
    request({
        url: '/TaskReviewAction/revokeReview/' + id,
        method: 'get'
    })

/**
 * 获取指定日期的审核统计
 * @param taskDate 
 * @returns 
 */
const GetTaskReviewCount = (taskDate: string|undefined) =>
    request({
        url: '/TaskReviewAction/getTaskReviewCount/' + taskDate,
        method: 'get'
    })

/**
 * 获取指定日期的审核统计
 * @param taskDate 
 * @returns 
 */
 const GetTaskReviewCountByUnitCode = (taskDate: string|undefined,unitCode:string) =>
 request({
     url: '/TaskReviewAction/getTaskReviewCountByUnitCode/' + taskDate+'/'+unitCode,
     method: 'get'
 })

export default {
    QueryTaskReviewListByTaskDate,
    AddTaskReview,
    EditTaskReview,
    SendReviewToSls,
    RevokeReview,
    GetTaskReviewCount,
    GetTaskReviewCountByUnitCode
}