import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { NutritionConsumableVO, NutritionConsumableForm, NutritionConsumableQuery } from '@/api/system/nutritionConsumable/types';

/**
 * 查询肠内营养耗材列表
 * @param query
 * @returns {*}
 */

export const listNutritionConsumable = (query?: NutritionConsumableQuery): AxiosPromise<NutritionConsumableVO[]> => {
  return request({
    url: '/system/nutritionConsumable/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询肠内营养耗材详细
 * @param id
 */
export const getNutritionConsumable = (id: string | number): AxiosPromise<NutritionConsumableVO> => {
  return request({
    url: '/system/nutritionConsumable/' + id,
    method: 'get'
  });
};

/**
 * 新增肠内营养耗材
 * @param data
 */
export const addNutritionConsumable = (data: NutritionConsumableForm) => {
  return request({
    url: '/system/nutritionConsumable',
    method: 'post',
    data: data
  });
};

/**
 * 修改肠内营养耗材
 * @param data
 */
export const updateNutritionConsumable = (data: NutritionConsumableForm) => {
  return request({
    url: '/system/nutritionConsumable',
    method: 'put',
    data: data
  });
};

/**
 * 删除肠内营养耗材
 * @param id
 */
export const delNutritionConsumable = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/nutritionConsumable/' + id,
    method: 'delete'
  });
};
