import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ScheduleDetailVO, ScheduleDetailForm, ScheduleDetailQuery } from '@/api/app/scheduleDetail/types';

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

export const listScheduleDetail = (query?: ScheduleDetailQuery): AxiosPromise<ScheduleDetailVO[]> => {
  return request({
    url: '/app/scheduleDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询排程详情详细
 * @param id
 */
export const getScheduleDetail = (id: string | number): AxiosPromise<ScheduleDetailVO> => {
  return request({
    url: '/app/scheduleDetail/' + id,
    method: 'get'
  });
};

/**
 * 新增排程详情
 * @param data
 */
export const addScheduleDetail = (data: ScheduleDetailForm) => {
  return request({
    url: '/app/scheduleDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改排程详情
 * @param data
 */
export const updateScheduleDetail = (data: ScheduleDetailForm) => {
  return request({
    url: '/app/scheduleDetail',
    method: 'put',
    data: data
  });
};

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