import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PatrolPlanVO, PatrolPlanForm, PatrolPlanQuery } from '@/api/elder/patrolPlan/types';

/**
 * 查询巡更计划列表
 * @param query
 * @returns {*}
 */

export const listPatrolPlan = (query?: PatrolPlanQuery): AxiosPromise<PatrolPlanVO[]> => {
  return request({
    url: '/elder/patrolPlan/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询巡更计划详细
 * @param id
 */
export const getPatrolPlan = (id: string | number): AxiosPromise<PatrolPlanVO> => {
  return request({
    url: '/elder/patrolPlan/' + id,
    method: 'get'
  });
};

/**
 * 新增巡更计划
 * @param data
 */
export const addPatrolPlan = (data: PatrolPlanForm) => {
  return request({
    url: '/elder/patrolPlan',
    method: 'post',
    data: data
  });
};

/**
 * 修改巡更计划
 * @param data
 */
export const updatePatrolPlan = (data: PatrolPlanForm) => {
  return request({
    url: '/elder/patrolPlan',
    method: 'put',
    data: data
  });
};

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