import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PatrolProjectVO, PatrolProjectForm, PatrolProjectQuery } from '@/api/elder/patrolProject/types';

/**
 * 查询巡更项目列表
 * @param query
 * @returns {*}
 */

export const listPatrolProject = (query?: PatrolProjectQuery): AxiosPromise<PatrolProjectVO[]> => {
  return request({
    url: '/elder/patrolProject/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询巡更项目详细
 * @param id
 */
export const getPatrolProject = (id: string | number): AxiosPromise<PatrolProjectVO> => {
  return request({
    url: '/elder/patrolProject/' + id,
    method: 'get'
  });
};

/**
 * 新增巡更项目
 * @param data
 */
export const addPatrolProject = (data: PatrolProjectForm) => {
  return request({
    url: '/elder/patrolProject',
    method: 'post',
    data: data
  });
};

/**
 * 修改巡更项目
 * @param data
 */
export const updatePatrolProject = (data: PatrolProjectForm) => {
  return request({
    url: '/elder/patrolProject',
    method: 'put',
    data: data
  });
};

/**
 * 删除巡更项目
 * @param id
 */
export const delPatrolProject = (id: string | number | Array<string | number>) => {
  return request({
    url: '/elder/patrolProject/' + id,
    method: 'delete'
  });
};
