/**
 * Shared form field types for dynamic form generation
 * Used by: Command Queue, Execution Runner UI, future form-based features
 */

/**
 * Supported form field types for action payloads
 * Maps to Mantine form components
 */
export type FormFieldType =
  | 'text'       // TextInput
  | 'textarea'   // Textarea
  | 'number'     // NumberInput
  | 'select'     // Select dropdown
  | 'checkbox'   // Checkbox
  | 'radio'      // Radio group
  | 'richtext'   // Rich text editor (TipTap)

/**
 * Form field definition
 */
export interface FormField {
  /** Field key in payload object */
  name: string

  /** Field label for UI */
  label: string

  /** Field type (determines UI component) */
  type: FormFieldType

  /** Default value */
  defaultValue?: unknown

  /** Required field */
  required?: boolean

  /** Placeholder text */
  placeholder?: string

  /** Help text */
  description?: string

  /** Options for select/radio */
  options?: Array<{
    label: string
    value: string | number
  }>

  /** Min/max for number */
  min?: number
  max?: number

  /** Path to context value for pre-filling (dot notation, e.g., 'proposal.summary') */
  defaultValueFromContext?: string
}

/**
 * Form schema for action payload collection
 */
export interface FormSchema {
  /** Form title */
  title?: string

  /** Form description */
  description?: string

  /** Form fields */
  fields: FormField[]
}
