import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ServiceVO, ServiceForm, ServiceQuery } from '@/api/system/service/types';

/**
 * 查询轨迹服务列表
 * @param query
 * @returns {*}
 */

export const listService = (query?: ServiceQuery): AxiosPromise<ServiceVO[]> => {
  return request({
    url: '/api/trackService/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询轨迹服务详细
 * @param id
 */
export const getService = (id: string | number): AxiosPromise<ServiceVO> => {
  return request({
    url: '/api/trackService/' + id,
    method: 'get'
  });
};

/**
 * 新增轨迹服务
 * @param data
 */
export const addService = (data: ServiceForm) => {
  return request({
    url: '/api/trackService/add',
    method: 'post',
    data: data
  });
};

/**
 * 修改轨迹服务
 * @param data
 */
export const updateService = (data: ServiceForm) => {
    return Promise.reject({code:500,msg:'不允许此操作'});
//   return request({
//     url: '/api/trackService/update',
//     method: 'put',
//     data: data
//   });
};

/**
 * 删除轨迹服务
 * @param id
 */
export const delService = (id: string | number | Array<string | number>) => {
//   return request({
//     url: '/api/trackService/' + id,
//     method: 'delete'
//   });

return Promise.reject({code:500,msg:'不允许此操作'});
};


//获取设备
export const getDevice = (data) => {
  return request({
    url: '/api/device',
    method: 'get',
    params:data
  });
};

//获取设备
export const getDeviceList = (data) => {
  return request({
    url: '/api/device/list',
    method: 'get',
    params:data
  });
};
//保存
export const terminalDevice=(data)=>{
   return request({
    url: '/api/trackService/terminal',
    method: 'post',
    data:data
  });
}
//删除
export const delTerminalDevice=(id)=>{
   return request({
    url: '/api/trackService/delTerminal/'+id,
    method: 'delete'    
  });
}

//获取地图的终端，列表查询
export const getMapDevice = (data) => {
  return request({
    url: '/api/trackService/listTerminal',
    method: 'get',
    params:data
  });
};

//获取地图的终端，模糊查询
export const getMapDeviceByFilter = (data) => {
  return request({
    url: '/api/trackService/searchTerminal',
    method: 'get',
    params:data
  });
};