export type FormSelectPrimitive = string | number;

export type FormSelectMode = 'single' | 'multiple';

export type FormSelectSearchMode = 'client' | 'server';

export type FormSelectDropdownPosition =
  | 'auto'
  | 'bottom'
  | 'top'
  | 'left'
  | 'right';

export type FormSelectValue<
  TValue extends FormSelectPrimitive = FormSelectPrimitive
> = TValue | readonly TValue[] | null;

export interface FormSelectOption<
  TValue extends FormSelectPrimitive = FormSelectPrimitive
> {
  readonly value: TValue;
  readonly label: string;
  readonly prefixText?: string | null;
  readonly description?: string | null;
  readonly group?: string | null;
  readonly disabled?: boolean;
  readonly metadata?: Readonly<Record<string, unknown>>;
}

export interface FormSelectSearchEvent {
  readonly term: string;
}

export interface FormSelectScrollEvent {
  readonly start: number;
  readonly end: number;
}
