import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { NursingMemberVO, NursingMemberForm, NursingMemberQuery } from '@/api/residenceService/nursingMember/types';

/**
 * 查询护理成员列表
 * @param query
 * @returns {*}
 */

export const listNursingMember = (query?: NursingMemberQuery): AxiosPromise<NursingMemberVO[]> => {
  return request({
    url: '/residential/nursingMember/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询护理成员详细
 * @param id
 */
export const getNursingMember = (id: string | number): AxiosPromise<NursingMemberVO> => {
  return request({
    url: '/residential/nursingMember/' + id,
    method: 'get'
  });
};

/**
 * 新增护理成员
 * @param data
 */
export const addNursingMember = (data: NursingMemberForm) => {
  return request({
    url: '/residential/nursingMember',
    method: 'post',
    data: data
  });
};

/**
 * 修改护理成员
 * @param data
 */
export const updateNursingMember = (data: NursingMemberForm) => {
  return request({
    url: '/residential/nursingMember',
    method: 'put',
    data: data
  });
};

/**
 * 删除护理成员
 * @param id
 */
export const delNursingMember = (id: string | number | Array<string | number>) => {
  return request({
    url: '/residential/nursingMember/' + id,
    method: 'delete'
  });
};
