import { MonitorTargetType } from './monitor-target.entity';

export type MonitorStatus = 'success' | 'failed' | 'partial' | 'queued' | 'running';

export type MonitorTargetConfig = {
  clusterName?: string;
  nodeKey?: string;
  nodeRole?: string;
  host?: string;
  collectionMode?: 'builtin' | 'blackbox' | 'host-agent';
  blackboxBaseUrl?: string;
  blackboxModule?: string;
  blackboxMetricName?: string;
  blackboxTarget?: string;
  agentKey?: string;
  processMatchMode?: 'pid' | 'command';
  processMatchValue?: string;
  processPid?: number;
  jcmdPath?: string;
  jstatPath?: string;
  jcmdCommands?: string[];
  jstatOptions?: string[];
  timeoutMs?: number;
  expectedStatus?: number;
  expectedText?: string;
  tcpHost?: string;
  tcpPort?: number;
  redisSections?: string[];
  rabbitmqOverviewPath?: string;
  rabbitmqQueuesPath?: string;
  rabbitmqNodesPath?: string;
  elasticsearchHealthPath?: string;
  elasticsearchNodesPath?: string;
  javaCollectionMode?: 'actuator' | 'jmx' | 'hybrid';
  jmxExporterUrl?: string;
  jmxMetricsPath?: string;
  javaRequireHealthCheck?: boolean;
  jmxMetricAllowlist?: string[];
  javaHealthPath?: string;
  javaMetricsPath?: string;
  authUsername?: string;
  authPassword?: string;
  sshHost?: string;
  sshPort?: number;
  sshUsername?: string;
  sshPassword?: string;
  sshPrivateKey?: string;
  logFilePath?: string;
  logTailLines?: number;
  logKeyword?: string;
};

export type MonitorExecutionResult = {
  type: MonitorTargetType;
  status: MonitorStatus;
  errorTag: string | null;
  summary: string;
  failureReason: string | null;
  metrics: Record<string, unknown>;
  details: Record<string, unknown>;
  logExcerpt: string | null;
  resultJsonUrl: string;
};
