import request from '@/request'
import type * as TYPE from './types'

// 跌倒统计
export const statsFallQuery = (
  params: TYPE.StatsFallQueryParams
): Promise<ResponseData<TYPE.StatsFallQueryData>> => {
  return request.post('/stats/fallQuery', params)
}

// 告警统计
export const statsAlarmQuery = (
  params: TYPE.AtatsAlarmQueryParams
): Promise<ResponseData<TYPE.StatsAlarmQueryData>> => {
  return request.post('/stats/alarmEventsQuery', params)
}

// 首页大屏统计
export const statsHomeScreenQuery = (params: {
  tenantId: string
}): Promise<ResponseData<TYPE.StatsHomeScreenQueryData>> => {
  return request.post('/stats/screen', params)
}

// 首页大屏历史跌倒统计
export const statsHomeScreenFallHistory = (params: {
  tenantId: string
  queryType: string // 查询类型 最近七天 day 最近半年 month
}): Promise<ResponseData<TYPE.StatsHomeScreenFallHistory>> => {
  return request.post('/stats/falling', params)
}

// 首页大屏历史告警统计
export const statsHomeScreenAlarmHistory = (params: {
  tenantId: string
  queryType: string // 查询类型 最近七天 day 最近半年 month
}): Promise<ResponseData<TYPE.StatsHomeScreenAlarmHistory>> => {
  return request.post('/stats/alarm', params)
}
