import type LinkChartView from "../../views/LinkChartView.js";
import type { EventedAccessor } from "../../core/Evented.js";
import type { LayoutMode } from "../../layers/knowledgeGraph/types.js";

export interface LinkChartLayoutSwitcherViewModelProperties extends Partial<Pick<LinkChartLayoutSwitcherViewModel, "view">> {
  /**
   * The current selected link chart layout.
   *
   * @default "organic-standard"
   */
  layout?: LayoutMode | null;
  /**
   * Prevents extent from updating on changes to the layout.
   *
   * @default false
   */
  preventExtentUpdate?: boolean | null;
}

export type LinkChartLayoutSwitcherViewModelState = "loading" | "disabled" | "ready";

export interface LinkChartLayoutSwitcherViewModelEvents {
  /**
   * Fires when the [switchLayout()](https://developers.arcgis.com/javascript/latest/references/core/widgets/LinkChartLayoutSwitcher/LinkChartLayoutSwitcherViewModel/#switchLayout) method is called.
   *
   * @see [switchLayout()](https://developers.arcgis.com/javascript/latest/references/core/widgets/LinkChartLayoutSwitcher/LinkChartLayoutSwitcherViewModel/#switchLayout)
   * @example
   * layoutSwitcher.viewModel.on("switchLayout", function(event){
   *   console.log("Layout Switched");
   * });
   */
  switchLayout: { layout: LayoutMode; };
}

/**
 * Provides the logic for the [Link Chart Layout Switcher component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-link-chart-layout-switcher/) that
 * switches the layout of a [LinkChartView](https://developers.arcgis.com/javascript/latest/references/core/views/LinkChartView/).
 *
 * @beta
 * @since 4.32
 * @see [Link Chart Layout Switcher component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-link-chart-layout-switcher/)
 * @see [Programming patterns: Widget viewModel pattern](https://developers.arcgis.com/javascript/latest/programming-patterns/#widget-viewmodel-pattern)
 */
export default class LinkChartLayoutSwitcherViewModel extends EventedAccessor {
  /**
   * @deprecated
   * Do not directly reference this property.
   * Use EventNames and EventTypes helpers from \@arcgis/core/Evented
   */
  "@eventTypes": LinkChartLayoutSwitcherViewModelEvents;
  constructor(properties?: LinkChartLayoutSwitcherViewModelProperties);
  /**
   * The current selected link chart layout.
   *
   * @default "organic-standard"
   */
  get layout(): LayoutMode;
  set layout(value: LayoutMode | null | undefined);
  /**
   * Prevents extent from updating on changes to the layout.
   *
   * @default false
   */
  get preventExtentUpdate(): boolean;
  set preventExtentUpdate(value: boolean | null | undefined);
  /**
   * The current state of the widget.
   *
   * @default "loading"
   */
  get state(): LinkChartLayoutSwitcherViewModelState;
  /** The view associated with the widget instance. */
  accessor view: LinkChartView | null | undefined;
  /**
   * Switches the layout of the link chart.
   *
   * @param newLayout - List of specific entities and relationships to update.
   * @returns Resolves when the data in the link chart has been updated.
   * @since 4.32
   */
  switchLayout(newLayout: LayoutMode): Promise<void>;
}