import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MealPlanVO, MealPlanForm, MealPlanQuery } from '@/api/patients/hospitalMealPlan/types';

/**
 * 查询院内膳食主列表
 * @param query
 * @returns {*}
 */

export const listMealPlan = (query?: MealPlanQuery): AxiosPromise<MealPlanVO[]> => {
  return request({
    url: '/patients/hospitalMealPlan/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询院内膳食主详细
 * @param id
 */
export const getMealPlan = (id: string | number): AxiosPromise<MealPlanVO> => {
  return request({
    url: '/patients/hospitalMealPlan/' + id,
    method: 'get'
  });
};

/**
 * 新增院内膳食
 * @param data
 */
export const addMealPlan = (data: MealPlanForm) => {
  return request({
    url: '/patients/hospitalMealPlan',
    method: 'post',
    data: data
  });
};

/**
 * 修改院内膳食
 * @param data
 */
export const updateMealPlan = (data: MealPlanForm) => {
  return request({
    url: '/patients/hospitalMealPlan',
    method: 'put',
    data: data
  });
};

/**
 * 删除院内膳食
 * @param id
 */
export const delMealPlan = (id: string | number | Array<string | number>) => {
  return request({
    url: '/patients/hospitalMealPlan/' + id,
    method: 'delete'
  });
};
