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

export type InputSelectOption = {
  /** Stable key for `{#each}` (see component). */
  id: string;
  value: string;
  label?: string;
};

export type InputSelectParams = {
  options?: InputSelectOption[];
};

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

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

  show_validation?: "yes" | "no";
  /** When `"yes"`, applies Bulma `select.is-small`. */
  is_small?: "yes" | "no";
  schemaentry: FormSchemaEntry | undefined;
};

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