import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EvaluationVO, EvaluationForm, EvaluationQuery } from '@/api/system/evaluation/types';

/**
 * 查询营养评估列表
 * @param query
 * @returns {*}
 */

export const listEvaluation = (query?: EvaluationQuery): AxiosPromise<EvaluationVO[]> => {
  return request({
    url: '/system/evaluation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询营养评估详细
 * @param id
 */
export const getEvaluation = (id: string | number): AxiosPromise<EvaluationVO> => {
  return request({
    url: '/system/evaluation/' + id,
    method: 'get'
  });
};

/**
 * 新增营养评估
 * @param data
 */
export const addEvaluation = (data: EvaluationForm) => {
  return request({
    url: '/system/evaluation',
    method: 'post',
    data: data
  });
};

/**
 * 修改营养评估
 * @param data
 */
export const updateEvaluation = (data: EvaluationForm) => {
  return request({
    url: '/system/evaluation',
    method: 'put',
    data: data
  });
};

/**
 * 删除营养评估
 * @param id
 */
export const delEvaluation = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/evaluation/' + id,
    method: 'delete'
  });
};
