import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PathDetailsVO, PathDetailsForm, PathDetailsId, PathDetailsIds, PathDetailsQuery } from '@/api/wcs/pathDetails/types';

/**
 * 查询路径明细列表
 * @param query
 * @returns {*}
 */

export const listPathDetails = (query?: PathDetailsQuery): AxiosPromise<PathDetailsVO[]> => {
  return request({
    url: '/wcs/pathDetails/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询路径明细详细
 * @param objId
 */
export const getPathDetails = (objId: PathDetailsId): AxiosPromise<PathDetailsVO> => {
  return request({
    url: '/wcs/pathDetails/' + objId,
    method: 'get'
  });
};

/**
 * 批量查询路径明细详细
 * @param ids
 */
export const getPathDetailsByIds = (ids: PathDetailsIds): AxiosPromise<PathDetailsVO[]> => {
  return request({
    url: '/wcs/pathDetails/listByIds',
    method: 'post',
    data: ids
  });
};

/**
 * 统计路径明细数量
 * @param query
 */
export const countPathDetails = (query?: PathDetailsQuery): AxiosPromise<number> => {
  return request({
    url: '/wcs/pathDetails/count',
    method: 'get',
    params: query
  });
};

/**
 * 判断是否存在符合条件的路径明细
 * @param query
 */
export const existsPathDetails = (query?: PathDetailsQuery): AxiosPromise<boolean> => {
  return request({
    url: '/wcs/pathDetails/exists',
    method: 'get',
    params: query
  });
};

/**
 * 新增路径明细
 * @param data
 */
export const addPathDetails = (data: PathDetailsForm) => {
  return request({
    url: '/wcs/pathDetails',
    method: 'post',
    data: data
  });
};

/**
 * 修改路径明细
 * @param data
 */
export const updatePathDetails = (data: PathDetailsForm) => {
  return request({
    url: '/wcs/pathDetails',
    method: 'put',
    data: data
  });
};

/**
 * 删除路径明细
 * @param objId
 */
export const delPathDetails = (objId: PathDetailsId | PathDetailsIds) => {
  return request({
    url: '/wcs/pathDetails/' + objId,
    method: 'delete'
  });
};
