import { SvelteComponentTyped } from "svelte";
import type { SvelteHTMLElements } from "svelte/elements";

type $RestProps = SvelteHTMLElements["li"];

type $Props = {
  /**
   * Set to `true` for the complete variant
   * @default false
   */
  complete?: boolean;

  /**
   * Set to `true` to use the current variant.
   * @default false
   */
  current?: boolean;

  /**
   * Set to `true` to disable the progress step
   * @default false
   */
  disabled?: boolean;

  /**
   * Set to `true` to indicate an invalid state
   * @default false
   */
  invalid?: boolean;

  /**
   * Specify the step description
   * @default ""
   */
  description?: string;

  /**
   * Specify the step label
   * @default ""
   */
  label?: string;

  /**
   * Specify the step secondary label
   * @default ""
   */
  secondaryLabel?: string;

  /**
   * Set an id for the top-level element
   * @default `ccs-${Math.random().toString(36)}`
   */
  id?: string;

  icon?: (this: void, ...args: [{
        complete: boolean;
        current: boolean;
        invalid: boolean;
        description: string;
      }]) => void;

  children?: (this: void, ...args: [{ props: { class: "bx--progress-label" } }]) => void;

  [key: `data-${string}`]: unknown;
};

export type ProgressStepProps = Omit<$RestProps, keyof $Props> & $Props;

export default class ProgressStep extends SvelteComponentTyped<
  ProgressStepProps,
  {
    blur: WindowEventMap["blur"];
    click: WindowEventMap["click"];
    focus: WindowEventMap["focus"];
    keydown: WindowEventMap["keydown"];
    mouseenter: WindowEventMap["mouseenter"];
    mouseleave: WindowEventMap["mouseleave"];
    mouseover: WindowEventMap["mouseover"];
  },
  {
    default: { props: { class: "bx--progress-label" } };
    icon: {
      complete: boolean;
      current: boolean;
      invalid: boolean;
      description: string;
    };
  }
> {}
