/**
 * 轮询监控相关 API
 */

import { BaseService } from '../BaseService'
import type {
  PollingOverviewStats,
  PollingInitProgress,
  PollingQueueStatusResponse,
  PollingTaskStatsResponse,
  BaseResponse
} from '@/types/api'

export class PollingMonitorService extends BaseService {
  /**
   * 获取轮询总览统计
   * GET /api/admin/polling-stats
   */
  static getOverviewStats(): Promise<BaseResponse<PollingOverviewStats>> {
    return this.get<BaseResponse<PollingOverviewStats>>('/api/admin/polling-stats')
  }

  /**
   * 获取轮询初始化进度
   * GET /api/admin/polling-stats/init-progress
   */
  static getInitProgress(): Promise<BaseResponse<PollingInitProgress>> {
    return this.get<BaseResponse<PollingInitProgress>>('/api/admin/polling-stats/init-progress')
  }

  /**
   * 获取轮询队列状态
   * GET /api/admin/polling-stats/queues
   */
  static getQueueStatus(): Promise<BaseResponse<PollingQueueStatusResponse>> {
    return this.get<BaseResponse<PollingQueueStatusResponse>>('/api/admin/polling-stats/queues')
  }

  /**
   * 获取轮询任务统计
   * GET /api/admin/polling-stats/tasks
   */
  static getTaskStats(): Promise<BaseResponse<PollingTaskStatsResponse>> {
    return this.get<BaseResponse<PollingTaskStatsResponse>>('/api/admin/polling-stats/tasks')
  }
}
