/**
 * Common option / choice shapes shared by every selectable element
 * (option-select, picker, etc.). The shape mirrors the v2 schema so
 * JSON authored against the platform deserialises cleanly.
 */
export interface SelectOption<TValue = unknown> {
  label: string
  value: TValue
  /** Secondary text rendered beneath / beside the label. */
  secondaryText?: string
  /** Inline icon name (lucide). */
  icon?: string
  /** Optional Tailwind class or style hint. */
  className?: string
  disabled?: boolean
  /** Free-form metadata consumers can use; ignored by the renderer. */
  meta?: Record<string, unknown>
}

/** A plain string option is also accepted by the engine. */
export type SelectOptionLike<TValue = unknown> = SelectOption<TValue> | string

/**
 * Functions that resolve options dynamically from the bound data model.
 * Lets a select compute its options from sibling fields without a
 * round-trip to the server.
 */
export type SelectOptionsResolver<TItem = Record<string, unknown>, TValue = unknown> = (
  item: TItem,
) => SelectOptionLike<TValue>[]
