/**
 * Widget type definitions.
 *
 * ⚠️ AUTO-GENERATED BY PRISM - DO NOT EDIT
 */

import type { ComponentType } from 'react';

/** Field types supported by Prism */
export type FieldType =
  | 'string'
  | 'text'
  | 'integer'
  | 'float'
  | 'decimal'
  | 'boolean'
  | 'datetime'
  | 'date'
  | 'time'
  | 'uuid'
  | 'json'
  | 'enum'
  | 'foreign_key';

/** Base props that all widgets receive */
export interface WidgetBaseProps<T = unknown> {
  /** Field name (used for form binding) */
  name: string;
  /** Current value */
  value: T;
  /** Change handler */
  onChange: (value: T) => void;
  /** Display label */
  label?: string;
  /** Help text / description shown below input */
  description?: string;
  /** Tooltip text shown on hover */
  tooltip?: string;
  /** Placeholder text */
  placeholder?: string;
  /** Whether the field is required */
  required?: boolean;
  /** Whether the field is disabled */
  disabled?: boolean;
  /** Error message to display */
  error?: string;
  /** Additional CSS classes */
  className?: string;
  /** Additional props passed from spec */
  [key: string]: unknown;
}

/** Widget component type */
export type Widget<T = unknown> = ComponentType<WidgetBaseProps<T>>;

/** Widget registry key types */
export type WidgetKey =
  | FieldType
  | `${string}.${string}` // Model.field specific
  | `ui:${string}` // UI widget hint
  | string; // Custom key

/** Field specification for form generation */
export interface FieldSpec {
  name: string;
  type: FieldType;
  required?: boolean;
  /** Human-readable label for the field */
  displayName?: string;
  /** Tooltip/help text shown in UI */
  description?: string;
  placeholder?: string;
  uiWidget?: string;
  widgetProps?: Record<string, unknown>;
  enumValues?: string[];
  references?: string;
}

/** Model specification for form generation */
export interface ModelSpec {
  name: string;
  fields: FieldSpec[];
}
