import { LogEntry } from '@jest/console';

type WarningDataArray = Array<Array<string | number>>;
type PrepareWarnings = (arg0: Record<string, number>) => WarningDataArray;

type Warning = {
  name: string;
  regex: RegExp;
  files?: Set<unknown>;
};

type SlowTest = {
  duration: number;
  fullName: string;
  filePath: string;
};

type Log = {
  filePath: string;
  warnings: Array<LogEntry>;
};

type LogsObj = Record<string, Log>;
interface IJestReporterConfig {
  showSlowest?: boolean;
  maxSlowTests?: number;
  warnOnSlowerThan?: number;
  showWarningSummary?: boolean;
  warningsConfig?: Array<Warning>;
}

enum CustomLogType {
  Log = 'log',
  Warn = 'warn',
  Error = 'error',
}

type CustomLogEntry = {
  message: string;
  type: CustomLogType;
  origin: string;
};

export {
  CustomLogEntry,
  CustomLogType,
  IJestReporterConfig,
  LogsObj,
  PrepareWarnings,
  SlowTest,
  Warning,
  WarningDataArray,
};
