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

/** One funnel step = one `hb-form` schema (`FormSchema`). */
export type FunnelStepSchemes = FormSchema[];

export type Component = {
  id?: string;
  style?: string;
  /** Total steps when `schemes` is not yet parsed (string from HTML). */
  steps?: number | string;
  /** JSON string of `FormSchema[]` (one schema per step); after first parse the implementation clears the prop to `[]`. */
  schemes?: string | FunnelStepSchemes;
  step?: number | string;
  submitstep?: "yes" | "no";
};

export type Events = {
  update: {
    step: number;
    scheme: { schema: FormSchema; valid: boolean };
    valid: boolean;
  };
  submit: {
    schemes: { schema: FormSchema; valid: boolean }[];
    steps: number;
    step: number;
  };
};
