import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DataHonorVO, DataHonorForm, DataHonorQuery } from '@/api/smarttrace/dataHonor/types';

/**
 * 查询荣誉墙列表
 * @param query
 * @returns {*}
 */

export const listDataHonor = (query?: DataHonorQuery): AxiosPromise<DataHonorVO[]> => {
  return request({
    url: '/smarttrace/dataHonor/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询荣誉墙详细
 * @param id
 */
export const getDataHonor = (id: string | number): AxiosPromise<DataHonorVO> => {
  return request({
    url: '/smarttrace/dataHonor/getInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增荣誉墙
 * @param data
 */
export const addDataHonor = (data: DataHonorForm) => {
  return request({
    url: '/smarttrace/dataHonor/add',
    method: 'post',
    data: data
  });
};

/**
 * 修改荣誉墙
 * @param data
 */
export const updateDataHonor = (data: DataHonorForm) => {
  return request({
    url: '/smarttrace/dataHonor/edit',
    method: 'post',
    data: data
  });
};

/**
 * 删除荣誉墙
 * @param id
 */
export const delDataHonor = (id: string | number | Array<string | number>) => {
  return request({
    url: '/smarttrace/dataHonor/remove/' + id,
    method: 'get'
  });
};
