import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ApiErrorLogVO, ApiErrorLogForm, ApiErrorLogQuery } from '@/api/customer/apiErrorLog/types';

/**
 * 查询接口错误日志列表
 * @param query
 * @returns {*}
 */

export const listApiErrorLog = (query?: ApiErrorLogQuery): AxiosPromise<ApiErrorLogVO[]> => {
  return request({
    url: '/customer/apiErrorLog/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询接口错误日志详细
 * @param errorId
 */
export const getApiErrorLog = (errorId: string | number): AxiosPromise<ApiErrorLogVO> => {
  return request({
    url: '/customer/apiErrorLog/' + errorId,
    method: 'get'
  });
};

/**
 * 新增接口错误日志
 * @param data
 */
export const addApiErrorLog = (data: ApiErrorLogForm) => {
  return request({
    url: '/customer/apiErrorLog',
    method: 'post',
    data: data
  });
};

/**
 * 修改接口错误日志
 * @param data
 */
export const updateApiErrorLog = (data: ApiErrorLogForm) => {
  return request({
    url: '/customer/apiErrorLog',
    method: 'put',
    data: data
  });
};

/**
 * 删除接口错误日志
 * @param errorId
 */
export const delApiErrorLog = (errorId: string | number | Array<string | number>) => {
  return request({
    url: '/customer/apiErrorLog/' + errorId,
    method: 'delete'
  });
};
