import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PathInfoVO, PathInfoForm, PathInfoId, PathInfoIds, PathInfoQuery } from '@/api/wcs/pathInfo/types';
import type { WcsDropdownQuery } from '@/api/wcs/types';

/**
 * 查询路径信息列表
 * @param query
 * @returns {*}
 */

export const listPathInfo = (query?: PathInfoQuery): AxiosPromise<PathInfoVO[]> => {
  return request({
    url: '/wcs/pathInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 获取路径信息下拉列表
 * @param query
 */
export const getPathInfoList = (query?: WcsDropdownQuery<PathInfoQuery>): AxiosPromise<PathInfoVO[]> => {
  return request({
    url: '/wcs/pathInfo/getPathInfoList',
    method: 'get',
    params: query
  });
};

/**
 * 查询路径信息详细
 * @param objId
 */
export const getPathInfo = (objId: PathInfoId): AxiosPromise<PathInfoVO> => {
  return request({
    url: '/wcs/pathInfo/' + objId,
    method: 'get'
  });
};

/**
 * 批量查询路径信息详细
 * @param ids
 */
export const getPathInfoByIds = (ids: PathInfoIds): AxiosPromise<PathInfoVO[]> => {
  return request({
    url: '/wcs/pathInfo/listByIds',
    method: 'post',
    data: ids
  });
};

/**
 * 统计路径信息数量
 * @param query
 */
export const countPathInfo = (query?: PathInfoQuery): AxiosPromise<number> => {
  return request({
    url: '/wcs/pathInfo/count',
    method: 'get',
    params: query
  });
};

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

/**
 * 新增路径信息
 * @param data
 */
export const addPathInfo = (data: PathInfoForm) => {
  return request({
    url: '/wcs/pathInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改路径信息
 * @param data
 */
export const updatePathInfo = (data: PathInfoForm) => {
  return request({
    url: '/wcs/pathInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除路径信息
 * @param objId
 */
export const delPathInfo = (objId: PathInfoId | PathInfoIds) => {
  return request({
    url: '/wcs/pathInfo/' + objId,
    method: 'delete'
  });
};
