/**
 * Default widget mappings.
 *
 * ⚠️ AUTO-GENERATED BY PRISM - DO NOT EDIT
 */

import type { Widget, FieldType } from './types';

// Import default widget components
import {
  TextInput,
  TextArea,
  NumberInput,
  Checkbox,
  Select,
  DatePicker,
  EmailInput,
  UrlInput,
  PhoneInput,
  PasswordInput,
  CurrencyInput,
  PercentageInput,
  TagInput,
  JsonEditor,
  RelationSelect,
} from './components';

// Widget type with broader compatibility for the registry
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type AnyWidget = Widget<any>;

/** Default widgets for each field type */
export const DEFAULT_WIDGETS: Record<FieldType, AnyWidget> = {
  string: TextInput,
  text: TextArea,
  integer: NumberInput,
  float: NumberInput,
  decimal: NumberInput,
  boolean: Checkbox,
  datetime: DatePicker,
  date: DatePicker,
  time: TextInput, // TODO: TimePicker
  uuid: TextInput,
  json: JsonEditor,
  enum: Select,
  foreign_key: RelationSelect,
};

/**
 * UI widget hint overrides.
 * These match the ui_widget field in FieldSpec.
 */
export const UI_WIDGET_MAP: Record<string, AnyWidget> = {
  textarea: TextArea,
  select: Select,
  checkbox: Checkbox,
  datepicker: DatePicker,
  email: EmailInput,
  url: UrlInput,
  phone: PhoneInput,
  password: PasswordInput,
  currency: CurrencyInput,
  percentage: PercentageInput,
  tags: TagInput,
  json: JsonEditor,
  relation: RelationSelect,
};
