import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ScheduleVO, ScheduleForm, ScheduleQuery } from '@/api/app/schedule/types';

/**
 * 查询日程排列列表
 * @param query
 * @returns {*}
 */

export const listSchedule = (query?: ScheduleQuery): AxiosPromise<ScheduleVO[]> => {
  return request({
    url: '/app/schedule/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询日程排列详细
 * @param id
 */
export const getSchedule = (id: string | number): AxiosPromise<ScheduleVO> => {
  return request({
    url: '/app/schedule/' + id,
    method: 'get'
  });
};

/**
 * 新增日程排列
 * @param data
 */
export const addSchedule = (data: ScheduleForm) => {
  return request({
    url: '/app/schedule',
    method: 'post',
    data: data
  });
};

/**
 * 修改日程排列
 * @param data
 */
export const updateSchedule = (data: ScheduleForm) => {
  return request({
    url: '/app/schedule',
    method: 'put',
    data: data
  });
};

/**
 * 删除日程排列
 * @param id
 */
export const delSchedule = (id: string | number | Array<string | number>) => {
  return request({
    url: '/app/schedule/' + id,
    method: 'delete'
  });
};
