import { getNoticePage, getStatsList, getWarnPage } from '@/api/iot/devOps'

export class DevOpsController {
  static statsMap = new Map([
    ['transportSuccessCounter', { name: '设备上报成功消息数', key: 'transportSuccessCounter', aliasName: '成功消息数' }],
    ['transportFailCounter', { name: '设备上报失败消息数', key: 'transportFailCounter', aliasName: '失败消息数' }],
    ['transportTotalCounter', { name: '设备上报总消息数', key: 'transportTotalCounter', aliasName: '总消息数' }],
    ['toTransportSuccessCounter', { name: '发送到设备成功消息数', key: 'toTransportSuccessCounter', aliasName: '成功消息数' }],
    ['toTransportFailCounter', { name: '发送到设备失败消息数', key: 'toTransportFailCounter', aliasName: '失败消息数' }],
    ['toTransportTotalCounter', { name: '发送到设备总消息数', key: 'toTransportTotalCounter', aliasName: '总消息数' }],
    ['transportReqSuccessCounter', { name: '设备请求成功消息数', key: 'transportReqSuccessCounter', aliasName: '成功消息数' }],
    ['transportReqFailCounter', { name: '设备请求失败消息数', key: 'transportReqFailCounter', aliasName: '失败消息数' }],
    ['transportReqTotalCounter', { name: '设备请求总消息数', key: 'transportReqTotalCounter', aliasName: '总消息数' }]
  ])

  static async pageWarn (params: {duration: number, page: number, pageSize: number}) {
    return await getWarnPage(params)
  }

  static async pageNotice (params: {page: number, pageSize: number}) {
    return await getNoticePage(params)
  }

  static async pageStats () {
    return await getStatsList()
  }
}
