import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HistoryVO, HistoryForm, HistoryQuery } from '@/api/system/business/history/types';

/**
 * 查询【请填写功能名称】列表
 * @param query
 * @returns {*}
 */

export const listHistory = (query?: HistoryQuery): AxiosPromise<HistoryVO[]> => {
  return request({
    url: '/business/history/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询【请填写功能名称】详细
 * @param id
 */
export const getHistory = (id: string | number): AxiosPromise<HistoryVO> => {
  return request({
    url: '/business/history/' + id,
    method: 'get'
  });
};

/**
 * 新增【请填写功能名称】
 * @param data
 */
export const addHistory = (data: HistoryForm) => {
  return request({
    url: '/business/history',
    method: 'post',
    data: data
  });
};

/**
 * 修改【请填写功能名称】
 * @param data
 */
export const updateHistory = (data: HistoryForm) => {
  return request({
    url: '/business/history',
    method: 'put',
    data: data
  });
};

/**
 * 删除【请填写功能名称】
 * @param id
 */
export const delHistory = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/history/' + id,
    method: 'delete'
  });
};

/**
 * 查询对局记录
 * @param query
 */
export const listHistory2 = (query?: HistoryQuery): AxiosPromise<HistoryVO[]> => {
  return request({
    url: '/business/history/getPlayHistoryInfo',
    method: 'post',
    params: query
  });
};

/**
 * 查询桌次
 * @param query
 */
export const selectAllHandZhuoCi2 = (query?: HistoryQuery): AxiosPromise<HistoryVO[]> => {
  return request({
    url: '/business/history/selectAllHandZhuoCi',
    method: 'post',
    params: query
  });
};

/**
 * 查询局数
 * @param query
 */
export const selectAllHandNumber = (query?: HistoryQuery): AxiosPromise<HistoryVO[]> => {
  return request({
    url: '/business/history/selectAllHandNumber',
    method: 'post',
    params: query
  });
};
