/**
 * Types for the vendored OrcaSlicer process-settings metadata.
 *
 * The JSON under `src/data/slicer/` is generated by
 * `scripts/generate-slicer-schema.mjs` from the `three-slicer` package, which
 * extracts it from OrcaSlicer's own `PrintConfig.cpp` and `Tab.cpp`. These
 * types describe that generated shape.
 */

/** A value the user has set for one process option, in its slicer-side form. */
export type SettingValue = string | number | boolean | Array<string | number | boolean>;

/**
 * OrcaSlicer's `ConfigOptionType` names, as they appear in the extracted schema.
 * The plural forms are per-extruder vectors.
 */
export type OptionType =
  | 'coBool'
  | 'coBools'
  | 'coInt'
  | 'coFloat'
  | 'coFloats'
  | 'coPercent'
  | 'coFloatOrPercent'
  | 'coFloatsOrPercents'
  | 'coEnum'
  | 'coString';

/** OrcaSlicer's setting visibility tiers, mirrored by the panel's mode switch. */
export type OptionMode = 'simple' | 'advanced' | 'expert' | 'develop';

export interface ProcessOption {
  type: OptionType;
  mode: OptionMode;
  label: string;
  tooltip?: string;
  /** Unit shown after the input ("mm", "mm/s²", "%"). */
  sidetext?: string;
  /**
   * Bounds, normalised out of their C++ source form by the generator. Typed as
   * string too because the JSON carries both shapes; coerce with
   * ``numericBound`` rather than assuming a number.
   */
  min?: number | string;
  max?: number | string;
  enum_values?: string[];
  enum_labels?: string[];
  default?: SettingValue;
}

export type ProcessSchema = Record<string, ProcessOption>;

export interface ProcessGroup {
  group: string;
  options: string[];
}

export interface ProcessPage {
  page: string;
  icon?: string;
  groups: ProcessGroup[];
}

export type ProcessUiTree = ProcessPage[];
