import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BaseShiftInfoVO, BaseShiftInfoForm, BaseShiftInfoQuery } from '@/api/mes/baseShiftInfo/types';

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

export const listBaseShiftInfo = (query?: BaseShiftInfoQuery): AxiosPromise<BaseShiftInfoVO[]> => {
  return request({
    url: '/mes/baseShiftInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询班次信息详细
 * @param shiftId
 */
export const getBaseShiftInfo = (shiftId: string | number): AxiosPromise<BaseShiftInfoVO> => {
  return request({
    url: '/mes/baseShiftInfo/' + shiftId,
    method: 'get'
  });
};

/**
 * 新增班次信息
 * @param data
 */
export const addBaseShiftInfo = (data: BaseShiftInfoForm) => {
  return request({
    url: '/mes/baseShiftInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改班次信息
 * @param data
 */
export const updateBaseShiftInfo = (data: BaseShiftInfoForm) => {
  return request({
    url: '/mes/baseShiftInfo',
    method: 'put',
    data: data
  });
};

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


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

