import type { FormSchemaEntryShared } from "../form/webcomponent.type";

/** Optional string length bounds (see component validation logic). */
export type InputAreaParams = {
  min?: number;
  max?: number;
};

export type FormSchemaEntry = Omit<FormSchemaEntryShared, "params"> & {
  /**
   * Optional default value.
   */
  value?: string | number | boolean;
  params?: InputAreaParams;
};

export type Component = {
  id?: string;
  style?: string;

  show_validation?: "yes" | "no";
  /** JSON string from HTML, or a parsed object from JavaScript (`parseSchemaentryProp`). */
  schemaentry: string | FormSchemaEntry | undefined;
};

export type Events = {
  setVal: { value: string; valid: boolean; id: string };
  clickEnter: { value: string; valid: boolean; id?: string };
};
