import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SchedulingDeviceVO, SchedulingDeviceForm, SchedulingDeviceQuery } from '@/api/app/schedulingDevice/types';

/**
 * 查询排程与设备关联列表
 * @param query
 * @returns {*}
 */

export const listSchedulingDevice = (query?: SchedulingDeviceQuery): AxiosPromise<SchedulingDeviceVO[]> => {
  return request({
    url: '/app/schedulingDevice/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询排程与设备关联详细
 * @param schedulingId
 */
export const getSchedulingDevice = (schedulingId: string | number): AxiosPromise<SchedulingDeviceVO> => {
  return request({
    url: '/app/schedulingDevice/' + schedulingId,
    method: 'get'
  });
};

/**
 * 新增排程与设备关联
 * @param data
 */
export const addSchedulingDevice = (data: SchedulingDeviceForm) => {
  return request({
    url: '/app/schedulingDevice',
    method: 'post',
    data: data
  });
};

/**
 * 修改排程与设备关联
 * @param data
 */
export const updateSchedulingDevice = (data: SchedulingDeviceForm) => {
  return request({
    url: '/app/schedulingDevice',
    method: 'put',
    data: data
  });
};

/**
 * 删除排程与设备关联
 * @param schedulingId
 */
export const delSchedulingDevice = (schedulingId: string | number | Array<string | number>) => {
  return request({
    url: '/app/schedulingDevice/' + schedulingId,
    method: 'delete'
  });
};
