import { request, paramsSerializer } from '@/utils/request.js';

// abnormal-check
export const workHoursWaitCheckListApi = (data) =>
  request({
    url: '/api/admin/ding/exception/apply/flow/task/un_done/list',
    params: data,
  });
export const workHoursCheckDetailApi = (id) =>
  request({
    url: '/api/admin/ding/exception/apply/view',
    params: { id },
  });
export const workHoursDoneCheckListApi = (data) =>
  request({
    url: '/api/admin/ding/exception/apply/flow/task/done/list',
    params: data,
  });
export const workHoursWaitCheckAuditApi = (data, isBatch) => {
  return request({
    url: isBatch
      ? '/api/admin/ding/exception/apply/flow/batch/approve'
      : '/api/admin/ding/exception/apply/flow/approve',
    params: data,
    paramsSerializer,
  });
};

// work-attendance
export const workAttendanceListApi = (data) =>
  request({
    url: '/api/admin/tb/ding/submit/page',
    params: data,
  });
export const detail = (data) =>
    request({
        url: '/api/admin/tb/ding/detail',
        params: data,
    });
export const workAttendanceInfoApi = (data) =>
  request({
    url: '/api/admin/tb/ding/submit/sub_total',
    params: data,
  });
export const workAttendanceSubmitApi = (data) =>
  request({
    url: '/api/admin/tb/ding/submit/submit_batch',
    data,
  });
export const workAttendanceExportApi = (data) =>
  request({
    url: '/api/admin/tb/ding/submit/export',
    params: data,
  });
export const workAttendanceWithdrawApi = (data) =>
  request({
    url: '/api/admin/tb/ding/submit/apply_withdraw',
    data,
  });
export const workAttendanceCancelWithdrawApi = (data) =>
  request({
    url: '/api/admin/tb/ding/submit/cancel_withdraw',
    data,
  });

// work-attendance-detail
export const workAttendanceDetailListApi = (data) =>
  request({
    url: '/api/admin/tb/ding/attendance/query',
    params: data,
  });
export const workAttendanceDetailExportApi = (ids) =>
  request({
    url: '/api/system/work-attendance-detail/export',
    params: { ids },
    download: true,
  });
export const workStatisticsDetailInfoApi = (data) =>
  request({
    url: '/api/admin/tb/ding/attendance/count',
    params: data,
  });

// work-statistics
export const workStatisticsListApi = (data) =>
  request({
    url: '/api/admin/tb/ding/query',
    params: data,
  });
export const workStatisticsInfoApi = (data) =>
  request({
    url: '/api/admin/tb/ding/count',
    params: data,
  });
export const workStatisticsExportApi = (data) =>
  request({
    url: '/api/admin/tb/ding/export',
    params: data,
  });
export const workStatisticsPassApi = (id) =>
  request({
    url: '/api/admin/tb/ding/submit/agree_withdraw',
    params: { dingSubmitId: id },
  });
