/**
 * Copyright Aquera Inc 2025
 *
 * This source code is licensed under the BSD-3-Clause license found in the
 * LICENSE file in the root directory of this source tree.
 */

export type NileRemoveEvent = CustomEvent<Record<PropertyKey, never>>;

export interface ComboboxOption {
  value: string;
  selected: boolean;
  getTextLabel: () => string;
}

export interface ComboboxRenderItemConfig {
  getDisplayText: (item: any) => string;
  getValue?: (item: any) => string;
  getSearchText?: (item: any) => string;
  getDescription?: (item: any) => string;
  getPrefix?: (item: any) => string;
  getSuffix?: (item: any) => string;
}

export type ComboboxTagLayout = 'single-line' | 'wrap' | 'fixed-height';
export type ComboboxSize = 'small' | 'medium' | 'large';
export type ComboboxPlacement = 'top' | 'bottom';

export interface ComboboxGroupItem {
  type: 'group';
  id: string;
  label: string;
  prefix?: string;
  options: ComboboxDataItem[];
  collapsible?: boolean;
}

export interface ComboboxOptionItem {
  type?: 'option';
  value: string;
  label?: string;
  [key: string]: any;
}

export type ComboboxDataItem = ComboboxGroupItem | ComboboxOptionItem;

export interface ComboboxHeaderRow {
  kind: 'header';
  id: string;
  label: string;
  prefix?: string;
  depth: number;
  optionCount: number;
}

export interface ComboboxOptionRow {
  kind: 'option';
  item: ComboboxOptionItem;
  depth: number;
  parentIds: string[];
}

export type ComboboxRow = ComboboxHeaderRow | ComboboxOptionRow;
