import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AgvCodeMapVO, AgvCodeMapForm, AgvCodeMapId, AgvCodeMapIds, AgvCodeMapQuery } from '@/api/wcs/agvCodeMap/types';

/**
 * 查询agv状态对照列表
 * @param query
 * @returns {*}
 */

export const listAgvCodeMap = (query?: AgvCodeMapQuery): AxiosPromise<AgvCodeMapVO[]> => {
  return request({
    url: '/wcs/agvCodeMap/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询agv状态对照详细
 * @param agvCode
 */
export const getAgvCodeMap = (agvCode: AgvCodeMapId): AxiosPromise<AgvCodeMapVO> => {
  return request({
    url: '/wcs/agvCodeMap/' + agvCode,
    method: 'get'
  });
};

/**
 * 批量查询agv状态对照详细
 * @param ids
 */
export const getAgvCodeMapByIds = (ids: AgvCodeMapIds): AxiosPromise<AgvCodeMapVO[]> => {
  return request({
    url: '/wcs/agvCodeMap/listByIds',
    method: 'post',
    data: ids
  });
};

/**
 * 统计agv状态对照数量
 * @param query
 */
export const countAgvCodeMap = (query?: AgvCodeMapQuery): AxiosPromise<number> => {
  return request({
    url: '/wcs/agvCodeMap/count',
    method: 'get',
    params: query
  });
};

/**
 * 判断是否存在符合条件的agv状态对照
 * @param query
 */
export const existsAgvCodeMap = (query?: AgvCodeMapQuery): AxiosPromise<boolean> => {
  return request({
    url: '/wcs/agvCodeMap/exists',
    method: 'get',
    params: query
  });
};

/**
 * 新增agv状态对照
 * @param data
 */
export const addAgvCodeMap = (data: AgvCodeMapForm) => {
  return request({
    url: '/wcs/agvCodeMap',
    method: 'post',
    data: data
  });
};

/**
 * 修改agv状态对照
 * @param data
 */
export const updateAgvCodeMap = (data: AgvCodeMapForm) => {
  return request({
    url: '/wcs/agvCodeMap',
    method: 'put',
    data: data
  });
};

/**
 * 删除agv状态对照
 * @param agvCode
 */
export const delAgvCodeMap = (agvCode: AgvCodeMapId | AgvCodeMapIds) => {
  return request({
    url: '/wcs/agvCodeMap/' + agvCode,
    method: 'delete'
  });
};
