import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PatrolRecordsVO, PatrolRecordsForm, PatrolRecordsQuery } from '@/api/elder/patrolRecords/types';

/**
 * 查询巡更记录列表
 * @param query
 * @returns {*}
 */

export const listPatrolRecords = (query?: PatrolRecordsQuery): AxiosPromise<PatrolRecordsVO[]> => {
  return request({
    url: '/elder/patrolRecords/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询巡更记录详细
 * @param id
 */
export const getPatrolRecords = (id: string | number): AxiosPromise<PatrolRecordsVO> => {
  return request({
    url: '/elder/patrolRecords/' + id,
    method: 'get'
  });
};

/**
 * 新增巡更记录
 * @param data
 */
export const addPatrolRecords = (data: PatrolRecordsForm) => {
  return request({
    url: '/elder/patrolRecords',
    method: 'post',
    data: data
  });
};

/**
 * 修改巡更记录
 * @param data
 */
export const updatePatrolRecords = (data: PatrolRecordsForm) => {
  return request({
    url: '/elder/patrolRecords',
    method: 'put',
    data: data
  });
};

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