import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EventsVO, EventsForm, EventsQuery } from '@/api/sense/events/types';

/**
 * 查询事件信息列表
 * @param query
 * @returns {*}
 */

export const listEvents = (query?: EventsQuery): AxiosPromise<EventsVO[]> => {
  return request({
    url: '/manage/events/list',
    method: 'get',
    params: query
  });
};
/**
 * 查询事件信息列表
 * @param query
 * @returns {*}
 */

export const eventsCount = () => {
  return request({
    url: '/manage/events/eventsCount',
    method: 'get',
  });
};
/**
 * 查询重点事件分类数据
 */

export const importantEventsStat = (params) => {
  return request({
    url: '/manage/events/importantEventsStat',
    method: 'get',
    params
  });
};
/**
 * 查询机占非TOP10数据
 */

export const motorInLanesTop10 = (params) => {
  return request({
    url: '/manage/events/motorInLanesTop10',
    method: 'get',
    params
  });
};

/**
 * 查询事件信息详细
 * @param id
 */
export const getEvents = (id: string | number): AxiosPromise<EventsVO> => {
  return request({
    url: '/manage/events/' + id,
    method: 'get'
  });
};

/**
 * 新增事件信息
 * @param data
 */
export const addEvents = (data: EventsForm) => {
  return request({
    url: '/manage/events',
    method: 'post',
    data: data
  });
};

/**
 * 修改事件信息
 * @param data
 */
export const updateEvents = (data: EventsForm) => {
  return request({
    url: '/manage/events',
    method: 'put',
    data: data
  });
};

/**
 * 删除事件信息
 * @param id
 */
export const delEvents = (id: string | number | Array<string | number>) => {
  return request({
    url: '/manage/events/' + id,
    method: 'delete'
  });
};

/**
 * 事件占比TOP10（%）
 */

export const eventPercentTop10 = () => {
  return request({
    url: '/manage/events/eventPercentTop10',
    method: 'get',
  });
};
/**
 * 近30日事件统计
 */

export const eventMonthCount = () => {
  return request({
    url: '/manage/events/eventMonthCount',
    method: 'get',
  });
};
/**
 *每日事件统计
 */

export const eventDayCount = () => {
  return request({
    url: '/manage/events/eventDayCount',
    method: 'get',
  });
};
/**
 *监控点位违反统计
 */

export const pointEventsStat = (params) => {
  return request({
    url: '/manage/events/pointEventsStat',
    method: 'get',
    params
  });
};
/**
 *区域违法分布
 */

export const regionEventsStat = (params) => {
  return request({
    url: '/manage/events/regionEventsStat',
    method: 'get',
    params
  });
};
/**
 *每分钟事件统计
 */

export const minuteEventsStat = (params) => {
  return request({
    url: '/manage/events/minuteEventsStat',
    method: 'get',
    params
  });
};
/**
 *交通违法数据来源分析
 */

export const eventsDatasourceStat = (params) => {
  return request({
    url: '/manage/events/eventsDatasourceStat',
    method: 'get',
    params
  });
};
/**
 *交通违法分布式时间
 */

export const eventsHourStat = (params) => {
  return request({
    url: '/manage/events/eventsHourStat',
    method: 'get',
    params
  });
};
/**
 *交通违法处置分析
 */

export const eventsDealRateStat = (params) => {
  return request({
    url: '/manage/events/eventsDealRateStat',
    method: 'get',
    params
  });
};
/**
 *骑行违法分析
 */

export const cycleEventStat = (params) => {
  return request({
    url: '/manage/events/cycleEventStat',
    method: 'get',
    params
  });
};
/**
 *重点车辆违法分析
 */

export const keyVehicleEventStat = (params) => {
  return request({
    url: '/manage/events/keyVehicleEventStat',
    method: 'get',
    params
  });
};
/**
 *查询事件的照片列表
 */

export const eventsMediaList = (params) => {
  return request({
    url: '/manage/events/eventsMediaList',
    method: 'get',
    params
  });
};
//获取事件id获取媒介信息
export const getMediaByEventId = (params) => {
  return request({
    url: '/manage/eventsMedia/getMediaByEventId',
    method: 'get',
    params
  });
};
