import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BaseClassTeamInfoVO, BaseClassTeamInfoForm, BaseClassTeamInfoQuery } from '@/api/mes/baseClassTeamInfo/types';

/**
 * 查询班组信息列表
 * @param query
 * @returns {*}
 */

export const listBaseClassTeamInfo = (query?: BaseClassTeamInfoQuery): AxiosPromise<BaseClassTeamInfoVO[]> => {
  return request({
    url: '/mes/baseClassTeamInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询班组信息详细
 * @param classTeamId
 */
export const getBaseClassTeamInfo = (classTeamId: string | number): AxiosPromise<BaseClassTeamInfoVO> => {
  return request({
    url: '/mes/baseClassTeamInfo/' + classTeamId,
    method: 'get'
  });
};

/**
 * 新增班组信息
 * @param data
 */
export const addBaseClassTeamInfo = (data: BaseClassTeamInfoForm) => {
  return request({
    url: '/mes/baseClassTeamInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改班组信息
 * @param data
 */
export const updateBaseClassTeamInfo = (data: BaseClassTeamInfoForm) => {
  return request({
    url: '/mes/baseClassTeamInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除班组信息
 * @param classTeamId
 */
export const delBaseClassTeamInfo = (classTeamId: string | number | Array<string | number>) => {
  return request({
    url: '/mes/baseClassTeamInfo/' + classTeamId,
    method: 'delete'
  });
};

/**
 * 下拉框查询班组信息列表
 * @param query
 * @returns {*}
 */
export function getBaseClassTeamInfoList (query) {
  return request({
    url: '/mes/baseClassTeamInfo/getBaseClassTeamInfoList',
    method: 'get',
    params: query
  });
};
