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

export type InputFilePlaceholderImage = {
  src: string;
  width?: number;
  height?: number;
};

export type InputFileParams = {
  /** `accept` attribute on the native file input (MIME list or extensions). */
  accept?: string;
  /** Clickable placeholder that opens the hidden input; preview uses optional dimensions. */
  placeHolderImage?: InputFilePlaceholderImage;
};

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

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

  show_validation?: "yes" | "no";
  schemaentry: FormSchemaEntry | undefined;
  /** BCP-47 / short code (e.g. `en`, `it`) for built-in UI strings. */
  i18nlang?: string;
};

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