import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BugVO, BugForm, BugQuery } from '@/api/ygpassport/bug/types';

/**
 * 查询Bug信息列表
 * @param query
 * @returns {*}
 */

export const listBug = (query?: BugQuery): AxiosPromise<BugVO[]> => {
  return request({
    url: '/ygpassport/bug/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询Bug信息详细
 * @param id
 */
export const getBug = (id: string | number): AxiosPromise<BugVO> => {
  return request({
    url: '/ygpassport/bug/' + id,
    method: 'get'
  });
};

/**
 * 新增Bug信息
 * @param data
 */
export const addBug = (data: BugForm) => {
  return request({
    url: '/ygpassport/bug',
    method: 'post',
    data: data
  });
};

/**
 * 修改Bug信息
 * @param data
 */
export const updateBug = (data: BugForm) => {
  return request({
    url: '/ygpassport/bug',
    method: 'put',
    data: data
  });
};

/**
 * 删除Bug信息
 * @param id
 */
export const delBug = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/bug/' + id,
    method: 'delete'
  });
};
