import { requestClient ,fullUrl } from '#/api/request';

/**
 * 分页查询消费记录
 */
export function queryPage(params) {
  return requestClient.post(
    '/auth/RobotConsumptionRecord/queryPage',
    params
  );
}

/**
 * 查询消费记录列表
 */
export function queryList(params) {
  return requestClient.post(
    '/auth/RobotConsumptionRecord/queryList',
    params
  );
}

/**
 * 创建消费记录
 */
export function create(params) {
  return requestClient.post(
    '/auth/RobotConsumptionRecord/addOne',
    params
  );
}

/**
 * 根据UUID删除消费记录
 */
export function removeByUid(uuid: string) {
  return requestClient.post<boolean>(
    '/auth/RobotConsumptionRecord/removeByUid',
    { uuid }
  );
}

/**
 * 根据UUID更新消费记录
 */
export function updateByUid(params) {
  return requestClient.post(
    '/auth/RobotConsumptionRecord/updateByUid',
    params
  );
}

/**
 * 根据ID查询消费记录
 */
export function getById(id: number) {
  return requestClient.post(
    '/auth/RobotConsumptionRecord/getById',
    { id }
  );
}

/**
 * 根据UUID查询消费记录
 */
export function getByUuid(uuid: string) {
  return requestClient.post(
    '/auth/RobotConsumptionRecord/getByUuid',
    { uuid }
  );
}

/**
 * 导出全部数据URL
 */
function exportAllUrl(param) {
  return fullUrl('/auth/RobotConsumptionRecord/export', param);
}

/**
 * 导出部分数据URL
 */
function exportPartUrl(param) {
  return fullUrl('/auth/RobotConsumptionRecord/export', param);
}

/**
 * 下载模板URL
 */
function downloadTemplateUrl(param) {
  return fullUrl('/auth/RobotConsumptionRecord/downloadTemplate', param);
}

/**
 * 导出全部数据
 */
async function exportAll(param) {
  return requestClient.post('/auth/RobotConsumptionRecord/export', param);
}

/**
 * 导出部分数据
 */
async function exportPart(param) {
  return requestClient.post('/auth/RobotConsumptionRecord/exportPart', param);
}

/**
 * 下载模板
 */
async function downloadTemplate(param) {
  return requestClient.post('/auth/RobotConsumptionRecord/downloadTemplate', param);
}

export const robotConsumptionRecord = {
  queryPage,
  queryList,
  create,
  removeByUid,
  updateByUid,
  getById,
  getByUuid,
  exportAllUrl,
  exportPartUrl,
  downloadTemplateUrl,
  exportAll,
  exportPart,
  downloadTemplate
};

export default robotConsumptionRecord;