import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LogVO, LogForm, LogQuery } from '@/api/equipment/log/types';

/**
 * 查询设备日志列表
 * @param query
 * @returns {*}
 */

export const listLog = (query?: LogQuery): AxiosPromise<LogVO[]> => {
  return request({
    url: '/equipment/log/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备日志详细
 * @param id
 */
export const getLog = (id: string | number): AxiosPromise<LogVO> => {
  return request({
    url: '/equipment/log/' + id,
    method: 'get'
  });
};

/**
 * 新增设备日志
 * @param data
 */
export const addLog = (data: LogForm) => {
  return request({
    url: '/equipment/log',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备日志
 * @param data
 */
export const updateLog = (data: LogForm) => {
  return request({
    url: '/equipment/log',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备日志
 * @param id
 */
export const delLog = (id: string | number | Array<string | number>) => {
  return request({
    url: '/equipment/log/' + id,
    method: 'delete'
  });
};
