import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MonitorPointVO, MonitorPointForm, MonitorPointQuery } from '@/api/manage/monitorPoint/types';

/**
 * 查询监控点位信息列表
 * @param query
 * @returns {*}
 */

export const listMonitorPoint = (query?: MonitorPointQuery): AxiosPromise<MonitorPointVO[]> => {
  return request({
    url: '/manage/monitorPoint/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询监控点位信息详细
 * @param pointId
 */
export const getMonitorPoint = (pointId: string | number): AxiosPromise<MonitorPointVO> => {
  return request({
    url: '/manage/monitorPoint/' + pointId,
    method: 'get'
  });
};

/**
 * 新增监控点位信息
 * @param data
 */
export const addMonitorPoint = (data) => {
  return request({
    url: '/manage/monitorPoint',
    method: 'post',
    data
  });
};

/**
 * 修改监控点位信息
 * @param data
 */
export const updateMonitorPoint = (data) => {
  return request({
    url: '/manage/monitorPoint',
    method: 'put',
    data: data
  });
};

/**
 * 删除监控点位信息
 * @param pointId
 */
export const delMonitorPoint = (pointId: string | number | Array<string | number>) => {
  return request({
    url: '/manage/monitorPoint/' + pointId,
    method: 'delete'
  });
};

/**
 * 根据监控点名称查询区域树监控
 * @param
 */
export const getListByAreaTree = (params) => {
  return request({
    url: '/manage/monitorPoint/getListByAreaTree',
    method: 'get',
    params
  });
};
//获取监控点树形结构
export const getPointsTree = (params) => {
  return request({
    url: '/manage/monitorPoint/getPointsTree',
    method: 'get',
    params
  });
};
//根据监控点获取监控点媒介信息
export const getPointMediaByPointId = (params) => {
  return request({
    url: '/manage/monitorPointMedia/getPointMediaByPointId',
    method: 'get',
    params
  });
};

