/// <reference path="../../index.d.ts" />
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
import type { Appearance, FlipContext, Kind, Scale, Width } from "../interfaces.js";
import type { IconName } from "../calcite-icon/interfaces.js";
import type { ButtonAlignment } from "./interfaces.js";

/**
 * Passing a 'href' will render an anchor link, instead of a button. Role will be set to link, or button, depending on this.
 *
 * It is the consumers responsibility to add aria information, rel, target, for links, and any button attributes for form submission
 *
 * @cssproperty [--calcite-button-background-color] - Specifies the component's background color.
 * @cssproperty [--calcite-button-border-color] - Specifies the component's border color.
 * @cssproperty [--calcite-button-corner-radius] - Specifies the component's corner radius.
 * @cssproperty [--calcite-button-icon-color] - Specifies the component's `iconStart` and `iconEnd` color.
 * @cssproperty [--calcite-button-loader-color] - Specifies the component's loader color.
 * @cssproperty [--calcite-button-text-color] - Specifies the component's text color.
 * @cssproperty [--calcite-button-shadow] - Specifies the component's shadow.
 * @slot  - A slot for adding text.
 */
export abstract class Button extends LitElement {
  /**
   * Specifies the alignment of the component's elements.
   *
   * @default "center"
   */
  accessor alignment: ButtonAlignment;
  /**
   * Specifies the appearance style of the component.
   *
   * @default "solid"
   */
  accessor appearance: Extract<"outline" | "outline-fill" | "solid" | "transparent", Appearance>;
  /**
   * When `true`, interaction is prevented and the component is displayed with lower opacity.
   *
   * @default false
   */
  accessor disabled: boolean;
  /**
   * Prompts the user to save the linked URL instead of navigating to it. Can be used with or without a value:
   * Without a value, the browser will suggest a filename/extension.
   *
   * @default false
   * @see [Global download attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#download).
   */
  accessor download: string | boolean;
  /**
   * Specifies the `id` of the component's associated form.
   *
   * When not set, the component is associated with its ancestor form element, if one exists.
   */
  accessor form: string;
  /** Specifies the URL of the linked resource, which can be set as an absolute or relative path. */
  accessor href: string;
  /** Specifies an icon to display at the end of the component. */
  accessor iconEnd: IconName;
  /** Displays the `iconStart` and/or `iconEnd` as flipped when the element direction is right-to-left (`"rtl"`). */
  accessor iconFlipRtl: FlipContext;
  /** Specifies an icon to display at the start of the component. */
  accessor iconStart: IconName;
  /**
   * Specifies the kind of the component, which will apply to the border and background if applicable.
   *
   * @default "brand"
   */
  accessor kind: Extract<"brand" | "danger" | "inverse" | "neutral", Kind>;
  /** Specifies an accessible label for the component. */
  accessor label: string;
  /**
   * When `true`, a busy indicator is displayed.
   *
   * @default false
   */
  accessor loading: boolean;
  /** Overrides individual strings used by the component. */
  accessor messageOverrides: { loading?: string; };
  /** Specifies the name of the component. Required to pass the component's `value` on form submission. */
  accessor name: string | undefined;
  /**
   * Defines the relationship between the `href` value and the current document.
   *
   * @mdn [rel](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel)
   */
  accessor rel: string;
  /**
   * When `true`, adds a round style to the component.
   *
   * @default false
   */
  accessor round: boolean;
  /**
   * Specifies the size of the component.
   *
   * @default "m"
   */
  accessor scale: Scale;
  /**
   * Specifies if the component is a child of a `calcite-split-button`.
   *
   * @default false
   */
  accessor splitChild: "primary" | "secondary" | false;
  /**
   * Specifies where to open the linked document defined in the `href` property.
   *
   * @mdn [target](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-target)
   */
  accessor target: string;
  /**
   * Specifies the default behavior of the component.
   *
   * @default "button"
   * @mdn [type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type)
   */
  accessor type: HTMLButtonElement["type"];
  /**
   * Specifies the width of the component.
   *
   * @default "auto"
   */
  accessor width: Extract<Width, "auto" | "half" | "full">;
  /**
   * Sets focus on the component.
   *
   * @param options - When specified an optional object customizes the component's focusing process. When `preventScroll` is `true`, scrolling will not occur on the component.
   * @mdn [focus(options)](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#options)
   */
  setFocus(options?: FocusOptions): Promise<void>;
}