import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ItemsLogVO, ItemsLogForm, ItemsLogQuery } from '@/api/system/business/itemsLog/types';

/**
 * 查询道具使用记录列表
 * @param query
 * @returns {*}
 */

export const listItemsLog = (query?: ItemsLogQuery): AxiosPromise<ItemsLogVO[]> => {
  return request({
    url: '/business/itemsLog/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询道具使用记录详细
 * @param id
 */
export const getItemsLog = (id: string | number): AxiosPromise<ItemsLogVO> => {
  return request({
    url: '/business/itemsLog/' + id,
    method: 'get'
  });
};

/**
 * 新增道具使用记录
 * @param data
 */
export const addItemsLog = (data: ItemsLogForm) => {
  return request({
    url: '/business/itemsLog',
    method: 'post',
    data: data
  });
};

/**
 * 修改道具使用记录
 * @param data
 */
export const updateItemsLog = (data: ItemsLogForm) => {
  return request({
    url: '/business/itemsLog',
    method: 'put',
    data: data
  });
};

/**
 * 删除道具使用记录
 * @param id
 */
export const delItemsLog = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/itemsLog/' + id,
    method: 'delete'
  });
};

/**
 * 流水统计
 * @param query
 */
export const queryStatisticsPageList = (query?: ItemsLogQuery): AxiosPromise<ItemsLogVO[]> => {
  return request({
    url: '/business/itemsLog/queryStatisticsPageList',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户流水统计
 * @param query
 */
export const queryStatisticsAllDataPageList = (query?: ItemsLogQuery): AxiosPromise<ItemsLogVO[]> => {
  return request({
    url: '/business/itemsLog/queryStatisticsAllDataPageList',
    method: 'get',
    params: query
  });
};
