import httpClient from '@/utils/http';

import { ControllerResponse } from './data-contracts';
export default {
  /**
   * @description 检查API服务的健康状态
   */
  healthList: () => {
    return httpClient.get<
      ControllerResponse & {
        data?: {
          status?: string;
          timestamp?: number;
          uptime?: string;
        };
      }
    >(`/system/health`);
  },
  /**
   * @description 获取系统基本信息和Redis缓存信息
   */
  infoList: () => {
    return httpClient.get<
      ControllerResponse & {
        data?: {
          architecture?: string;
          cache?: object;
          environment?: string;
          framework?: string;
          name?: string;
          timestamp?: number;
          version?: string;
        };
      }
    >(`/system/info`);
  },
  /**
   * @description 获取Redis缓存的详细信息
   */
  redisList: () => {
    return httpClient.get<
      ControllerResponse & {
        data?: {
          connected_clients?: number;
          /** @format float64 */
          hit_rate?: number;
          keyspace?: object;
          memory_usage?: number;
          top_keys?: any[];
          total_keys?: number;
          uptime?: number;
        };
      }
    >(`/system/redis`);
  },
  /**
   * @description 获取Redis的完整详细信息
   */
  redisDetailList: () => {
    return httpClient.get<
      ControllerResponse & {
        data?: {
          connected_clients?: number;
          /** @format float64 */
          hit_rate?: number;
          keyspace?: object;
          memory?: object;
          server?: object;
          stats?: object;
          total_keys?: number;
          uptime?: number;
          used_memory?: number;
        };
      }
    >(`/system/redis/detail`);
  }
};
