import { defHttp } from '@/utils/http/axios';
import {
  AddCheckPointParams,
  GetCheckPointListParams,
  DeleteCheckPointParams,
  GetClockOnListParams,
  GetStatisticsCountParams,
  GetStatisticsParams,
} from './model/index';

enum Api {
  AddCheckPoint = '/api/FireGrid/AddCheckPoint',
  GetCheckPointList = '/api/FireGrid/GetCheckPointList',
  DeleteCheckPoint = '/api/FireGrid/DeleteCheckPoint',
  EditCheckPoint = '/api/FireGrid/EditCheckPoint',
  GetSingleCheckPoint = '/api/FireGrid/GetSingleCheckPoint',
  GetCheckInfoByPointId = '/api/FireGrid/GetCheckInfoByPointId',
  GetCheckInfoByUserId = '/api/FireGrid/GetCheckInfoByUserId',
  GetClockOnList = '/api/FireGrid/GetClockOnList',
  GetStatisticsCount = '/api/FireGrid/GetStatisticsCount',
  GetStatistics = '/api/FireGrid/GetStatistics',
}

/**
 * @description: 添加打卡点
 */
export function addCheckPoint(params: AddCheckPointParams) {
  return defHttp.post({
    url: Api.AddCheckPoint,
    params,
  });
}

/**
 * @description: 获取打卡点列表
 */
export function getCheckPointList(params: GetCheckPointListParams) {
  return defHttp.get({ url: Api.GetCheckPointList, params });
}

/**
 * @description: 删除打卡点
 */
export function deleteCheckPoint(params: DeleteCheckPointParams) {
  return defHttp.post({
    url: Api.DeleteCheckPoint,
    params,
  });
}

/**
 * @description: 编辑打卡点
 */
export function editCheckPoint(params: AddCheckPointParams) {
  return defHttp.post({
    url: Api.EditCheckPoint,
    params,
  });
}

/**
 * @description: 获取单个打卡点
 */
export function getSingleCheckPoint(params: DeleteCheckPointParams) {
  return defHttp.get({ url: Api.GetSingleCheckPoint, params });
}
/**
 * @description: 获取打卡记录
 */
export function getCheckInfoByPointId(params: GetCheckPointListParams) {
  return defHttp.get({ url: Api.GetCheckInfoByPointId, params });
}
/**
 * @description: 获取打卡信息
 */
export function getCheckInfoByUserId(params: GetCheckPointListParams) {
  return defHttp.get({ url: Api.GetCheckInfoByUserId, params });
}
/**
 * @description: 获取打卡记录列表
 */
export function getClockOnList(params: GetClockOnListParams) {
  return defHttp.get({ url: Api.GetClockOnList, params });
}

/**
 * @description: 获取数据总览
 */
export function getStatisticsCount(params: GetStatisticsCountParams) {
  return defHttp.get({ url: Api.GetStatisticsCount, params });
}

/**
 * @description: 获取数据列表
 */
export function getStatistics(params: GetStatisticsParams) {
  return defHttp.get({ url: Api.GetStatistics, params });
}
