import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InterveneRecordVO, InterveneRecordForm, InterveneRecordQuery } from '@/api/archive/interveneRecord/types';

/**
 * 查询干预记录列表
 * @param query
 * @returns {*}
 */

export const listInterveneRecord = (query?: InterveneRecordQuery): AxiosPromise<InterveneRecordVO[]> => {
  return request({
    url: '/scale/intervene/list',
    method: 'get',
    params: query
  });
};

export const pageInterveneRecord = (query?: InterveneRecordQuery): AxiosPromise<InterveneRecordVO[]> => {
  return request({
    url: '/scale/intervene/pageList',
    method: 'get',
    params: query
  });
};

export const listInterveneTimes = (query?: any): AxiosPromise<any[]> => {
  return request({
    url: '/scale/intervene/times',
    method: 'get',
    params: query
  });
};

/**
 * 查询干预记录详细
 * @param interveneId
 */
export const getInterveneRecord = (interveneId: string | number): AxiosPromise<InterveneRecordVO> => {
  return request({
    url: '/scale/intervene/' + interveneId,
    method: 'get'
  });
};

/**
 * 新增干预记录
 * @param data
 */
export const addInterveneRecord = (data: InterveneRecordForm) => {
  return request({
    url: '/scale/intervene',
    method: 'post',
    data: data
  });
};

/**
 * 修改干预记录
 * @param data
 */
export const updateInterveneRecord = (data: InterveneRecordForm) => {
  return request({
    url: '/scale/intervene',
    method: 'put',
    data: data
  });
};

/**
 * 删除干预记录
 * @param interveneId
 */
export const delInterveneRecord = (interveneId: string | number | Array<string | number>) => {
  return request({
    url: '/scale/intervene/' + interveneId,
    method: 'delete'
  });
};
