import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MealRecipeVO, MealRecipeForm, MealRecipeQuery } from '@/api/patients/hospitalMealRecipe/types';

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

export const listMealRecipe = (query?: MealRecipeQuery): AxiosPromise<MealRecipeVO[]> => {
  return request({
    url: '/patients/hospitalMealRecipe/list',
    method: 'get',
    params: query
  });
};

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

/**
 * 新增院内膳食食谱明细
 * @param data
 */
export const addMealRecipe = (data: MealRecipeForm) => {
  return request({
    url: '/patients/hospitalMealRecipe',
    method: 'post',
    data: data
  });
};

/**
 * 修改院内膳食食谱明细
 * @param data
 */
export const updateMealRecipe = (data: MealRecipeForm) => {
  return request({
    url: '/patients/hospitalMealRecipe',
    method: 'put',
    data: data
  });
};

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