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

/**
 * Bounds for the native number input. Keys are read with `hasOwnProperty`:
 * include the key only when you want a DOM `min` / `max` attribute.
 */
export type InputNumberParams = {
  min?: number;
  max?: number;
};

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

export type Component = {
  id?: string;
  style?: string;
  show_validation?: "yes" | "no";
  /** When `"yes"`, applies Bulma `input.is-small`. */
  is_small?: "yes" | "no";
  schemaentry: FormSchemaEntry | undefined;
};

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