/** URL when running locally */
export const LOCAL_URL = '/local';

/** Plugin name */
export const PLUGIN_NAME = 'profile';

/** Pefix of API */
export const API_PREFIX = '/data/plugin/';

/** Config API */
export const CONFIG_API = API_PREFIX + PLUGIN_NAME + '/config';

/** Runs API */
export const RUNS_API = API_PREFIX + PLUGIN_NAME + '/runs';

/** Tools per run API */
export const RUN_TOOLS_API = API_PREFIX + PLUGIN_NAME + '/run_tools';

/** Hosts API */
export const HOSTS_API = API_PREFIX + PLUGIN_NAME + '/hosts';

/** Data API */
export const DATA_API = API_PREFIX + PLUGIN_NAME + '/data';

/** Data CSV API */
export const DATA_CSV_API = API_PREFIX + PLUGIN_NAME + '/data_csv';

/** Version API */
export const VERSION_API = API_PREFIX + PLUGIN_NAME + '/version';

/** HLO Module List API */
export const HLO_MODULE_LIST_API = API_PREFIX + PLUGIN_NAME + '/module_list';

/** Capture Profile API */
export const CAPTURE_PROFILE_API =
  API_PREFIX + PLUGIN_NAME + '/capture_profile';

/** Default Host */
export const DEFAULT_HOST = 'default';

/**
 * Based on palette of Kenneth Kelly's 22 colors of maximum contrast.
 * More information at page 5 of
 * https://eleanormaclure.files.wordpress.com/2011/03/colour-coding.pdf.
 * "F2F3F4" was removed because it's contrast against white is poor.
 */
export const KELLY_COLORS = [
  '0067A5',
  'E68FAC',
  'E25822',
  '008856',
  'F99379',
  '604E97',
  'F6A600',
  'B3446C',
  'DCD300',
  '8DB600',
  '654522',
  '222222',
  '882D17',
  'F3C300',
  '875692',
  'F38400',
  'A1CAF1',
  'BE0032',
  'C2B280',
  '848482',
  '2B3D26',
];

/**
 * color palette for stack chart
 */
export const STACK_CHART_FILL_COLORS = [
  '#00AA55', // green
  '#E65722', // orange
  '#DC2A2A', // red
  '#B8860B', // yellow
  '#B381B3', // purple
  '#009FD4', // blue
  '#545454', // grey
];

/**
 * Empty diagnostic content
 * diagnostics is input to the <diagnostic-view> component, used by graph viewer
 */
export const DIAGNOSTICS_DEFAULT = {
  info: [] as string[],
  warnings: [] as string[],
  errors: [] as string[],
};

/**
 * The default graph type instruct graph processing on backend for graph viewer
 */
export const GRAPH_TYPE_DEFAULT = 'xla';

/**
 * The graph type for viewing the original HLO graph.
 */
export const GRAPH_TYPE_ORIGINAL_HLO = 'original_hlo';

/** The tools generated by HLO proto. */
export const HLO_TOOLS = ['memory_viewer', 'graph_viewer'];

/** The query parameter keys used in graph viewer */
export const GRAPHVIZ_PAN_ZOOM_CONTROL = '&pan_zoom=1&pan_zoom_controls=1';

/** The query parameter key to use IR from the cache */
export const USE_SAVED_RESULT = 'use_saved_result';

/** Primary tool endpoints that are authorized to consume and clear the cache invalidation flag */
export const PRIMARY_TOOL_ENDPOINTS = new Set([
  'overview_page',
  'trace_viewer',
  'raw_trace_viewer',
  'events_db',
  'graph_viewer',
  'hlo_op_profile',
  'hlo_op_stats',
  'host_profile',
  'input_pipeline_analyzer',
  'input_pipeline',
  'kernel_stats',
  'kpi_metrics',
  'memory_profile',
  'memory_viewer',
  'roofline_model',
  'pod_viewer',
  'tensorflow_stats',
  'inference_profile',
  'perf_counters',
  'utilization_viewer',
  'framework_op_stats',
  'op_profile',
  'megascale_stats',
]);
