import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RfidLocationVO, RfidLocationForm, RfidLocationQuery } from '@/api/rfid/rfidLocation/types';

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

export const listRfidLocation = (query?: RfidLocationQuery): AxiosPromise<RfidLocationVO[]> => {
  return request({
    url: '/rfid/rfidLocation/list',
    method: 'get',
    params: query
  });
};

/**
 * 获取全部位置信息列表（用于下拉、树选择等场景）
 * @param query
 */
export const getRfidLocationList = (query?: Partial<RfidLocationQuery>): AxiosPromise<RfidLocationVO[]> => {
  return request({
    url: '/rfid/rfidLocation/getRfidLocationList',
    method: 'get',
    params: query
  });
};

/**
 * 查询位置信息详细
 * @param id
 */
export const getRfidLocation = (id: string | number): AxiosPromise<RfidLocationVO> => {
  return request({
    url: '/rfid/rfidLocation/' + id,
    method: 'get'
  });
};

/**
 * 新增位置信息
 * @param data
 */
export const addRfidLocation = (data: RfidLocationForm) => {
  return request({
    url: '/rfid/rfidLocation',
    method: 'post',
    data: data
  });
};

/**
 * 修改位置信息
 * @param data
 */
export const updateRfidLocation = (data: RfidLocationForm) => {
  return request({
    url: '/rfid/rfidLocation',
    method: 'put',
    data: data
  });
};

/**
 * 删除位置信息
 * @param id
 */
export const delRfidLocation = (id: string | number | Array<string | number>) => {
  return request({
    url: '/rfid/rfidLocation/' + id,
    method: 'delete'
  });
};
