import { OjWebElement } from '../';

/**
 * This is the base class for oj-list-view WebElement, and is generated from the
 * component's metadata. Do not modify these contents since they'll be replaced
 * during the next generation.
 * Put overrides into the WebElements's subclass, OjListView.ts.
 */
export class OjListViewBase extends OjWebElement {
  /**
   * Gets the value of <code>as</code> property.
   * Specifies the alias for the current item when referenced inside the item template.
   * @return The value of <code>as</code> property.
   * @deprecated Since 6.2.0. Set the alias directly on the template element using the data-oj-as attribute instead.
   */
  public getAs(): Promise<string> {
    return this.getProperty<string>('as');
  }

  /**
   * Sets the value of <code>currentItem</code> property.
   * Specifies the key of the item that should have keyboard focus. See the Help documentation for more information.
   * @param currentItem The value to set for <code>currentItem</code>
   *
   */
  public changeCurrentItem(currentItem: any): Promise<void> {
    return this.setProperty<any>('currentItem', currentItem);
  }

  /**
   * Gets the value of <code>currentItem</code> property.
   * Specifies the key of the item that should have keyboard focus. See the Help documentation for more information.
   * @return The value of <code>currentItem</code> property.
   *
   */
  public getCurrentItem(): Promise<any> {
    return this.getProperty<any>('currentItem');
  }

  /**
   * Gets the value of <code>display</code> property.
   * Specifies how the items should be displayed.
   * @return The value of <code>display</code> property.
   *
   */
  public getDisplay(): Promise<string> {
    return this.getProperty<string>('display');
  }

  /**
   * Gets the value of <code>dnd</code> property.
   * Customizes the drag and drop functionality. See the Help documentation for more information.
   * @return The value of <code>dnd</code> property.
   *
   */
  public getDnd(): Promise<Dnd> {
    return this.getProperty<Dnd>('dnd');
  }

  /**
   * Gets the value of <code>drillMode</code> property.
   * Specifies whether expand or collapse operations are allowed.
   * @return The value of <code>drillMode</code> property.
   *
   */
  public getDrillMode(): Promise<string> {
    return this.getProperty<string>('drillMode');
  }

  /**
   * Gets the value of <code>firstSelectedItem</code> property.
   * Specifies the key and data of the first selected item. See the Help documentation for more information.
   * @return The value of <code>firstSelectedItem</code> property.
   *
   */
  public getFirstSelectedItem(): Promise<object> {
    return this.getProperty<object>('firstSelectedItem');
  }

  /**
   * Gets the value of <code>gridlines</code> property.
   * Customizes the functionality of how gridlines are shown in various parts of the list.
   * @return The value of <code>gridlines</code> property.
   *
   */
  public getGridlines(): Promise<Gridlines> {
    return this.getProperty<Gridlines>('gridlines');
  }

  /**
   * Gets the value of <code>groupHeaderPosition</code> property.
   * Specifies whether group header should stick to the top as user scrolls.
   * @return The value of <code>groupHeaderPosition</code> property.
   *
   */
  public getGroupHeaderPosition(): Promise<string> {
    return this.getProperty<string>('groupHeaderPosition');
  }

  /**
   * Gets the value of <code>item</code> property.
   * Customizes the functionality of each item on the list.
   * @return The value of <code>item</code> property.
   *
   */
  public getItem(): Promise<Item> {
    return this.getProperty<Item>('item');
  }

  /**
   * Gets the value of <code>scrollPolicy</code> property.
   * Specifies how data are fetched as user scrolls down the list.
   * @return The value of <code>scrollPolicy</code> property.
   *
   */
  public getScrollPolicy(): Promise<string | null> {
    return this.getProperty<string | null>('scrollPolicy');
  }

  /**
   * Gets the value of <code>scrollPolicyOptions</code> property.
   * Specifies fetch options for scrolling behaviors that trigger data fetches. See the Help documentation for more information.
   * @return The value of <code>scrollPolicyOptions</code> property.
   *
   */
  public getScrollPolicyOptions(): Promise<ScrollPolicyOptions | null> {
    return this.getProperty<ScrollPolicyOptions | null>('scrollPolicyOptions');
  }

  /**
   * Sets the value of <code>scrollPosition</code> property.
   * Specifies the current scroll position of the list. See the Help documentation for more information.
   * @param scrollPosition The value to set for <code>scrollPosition</code>
   *
   */
  public changeScrollPosition(scrollPosition: ScrollPosition): Promise<void> {
    return this.setProperty<ScrollPosition>('scrollPosition', scrollPosition);
  }

  /**
   * Gets the value of <code>scrollPosition</code> property.
   * Specifies the current scroll position of the list. See the Help documentation for more information.
   * @return The value of <code>scrollPosition</code> property.
   *
   */
  public getScrollPosition(): Promise<ScrollPosition> {
    return this.getProperty<ScrollPosition>('scrollPosition');
  }

  /**
   * Gets the value of <code>scrollToKey</code> property.
   * Specifies the behavior when ListView needs to scroll to a position based on an item key.
   * @return The value of <code>scrollToKey</code> property.
   *
   */
  public getScrollToKey(): Promise<string | null> {
    return this.getProperty<string | null>('scrollToKey');
  }

  /**
   * Sets the value of <code>selection</code> property.
   * Specifies the current selections in the list. See the Help documentation for more information.
   * @param selection The value to set for <code>selection</code>
   * @deprecated Since 7.0.0. Use selected attribute instead.
   */
  public changeSelection(selection: Array<any>): Promise<void> {
    return this.setProperty<Array<any>>('selection', selection);
  }

  /**
   * Gets the value of <code>selection</code> property.
   * Specifies the current selections in the list. See the Help documentation for more information.
   * @return The value of <code>selection</code> property.
   * @deprecated Since 7.0.0. Use selected attribute instead.
   */
  public getSelection(): Promise<Array<any>> {
    return this.getProperty<Array<any>>('selection');
  }

  /**
   * Gets the value of <code>selectionMode</code> property.
   * Specifies the selection mode.
   * @return The value of <code>selectionMode</code> property.
   *
   */
  public getSelectionMode(): Promise<string> {
    return this.getProperty<string>('selectionMode');
  }

  /**
   * Gets the value of <code>selectionRequired</code> property.
   * Specifies whether selection is required on the ListView.
   * @return The value of <code>selectionRequired</code> property.
   *
   */
  public getSelectionRequired(): Promise<boolean> {
    return this.getProperty<boolean>('selectionRequired');
  }

  /**
   * Gets the value of <code>translations</code> property.
   * A collection of translated resources from the translation bundle, or null if this component has no resources.
   * @return The value of <code>translations</code> property.
   *
   */
  public getTranslations(): Promise<Translations | null> {
    return this.getProperty<Translations | null>('translations');
  }
}
export interface Dnd {
  /**
   * Customizes the drag functionality.
   */
  drag: DndDrag;
  /**
   * Customizes the drop functionality.
   */
  drop: DndDrop;
  /**
   * Customizes the item reordering functionality.
   */
  reorder: DndReorder;
}
export interface DndDrag {
  /**
   * An object that describes drag functionality for a selected set of items. See the Help documentation for more information.
   */
  items: DndDragItems;
}
export interface DndDragItems {
  /**
   * Specifies one or more MIME types to use for the dragged data in the dataTransfer object. See the Help documentation for more information.
   */
  dataTypes: string | Array<string>;
}
export interface DndDrop {
  /**
   * An object that describes drop functionality for a selected set of items.
   */
  items: DndDropItems;
}
export interface DndDropItems {
  /**
   * Specifies one or more data types that this component can accept. See the Help documentation for more information.
   */
  dataTypes: string | Array<string>;
}
export interface DndReorder {
  /**
   * Specify the item reordering functionality. See the Help documentation for more information.
   */
  items: string;
}
export interface Gridlines {
  /**
   * Specifies whether the grid lines should be visible.
   */
  item: string;
}
export interface Item {
  /**
   * Specifies whether the item can receive keyboard focus. See the Help documentation for more information.
   * @deprecated Since 13.0.0. Not accessible by screen reader.
   */
  focusable: boolean | null;
  /**
   * Specifies the renderer for the item. See the Help documentation for more information.
   */
  renderer: null | null;
  /**
   * Specifies whether the item can be selected. See the Help documentation for more information.
   */
  selectable: boolean | null;
}
export interface ScrollPolicyOptions {
  /**
   * The number of items to fetch in each block
   */
  fetchSize: number;
  /**
   * The maximum total number of items to fetch
   */
  maxCount: number;
  /**
   * The element used to determine the scroll position as well as the maximum scroll position. See the Help documentation for more information.
   */
  scroller: string;
}
export interface ScrollPosition {
  /**
   * The zero-based index of the item. If scrollPolicy is set to 'loadMoreOnScroll' and the index is greater than maxCount set in scrollPolicyOptions, then it will scroll and fetch until the end of the list is reached and there's no more items to fetch.
   */
  index: number;
  /**
   * The key of the item. If DataProvider is used for data and the key does not exists in the DataProvider, then the value is ignored. If DataProvider is not used then ListView will fetch and scroll until the item is found or the end of the list is reached and there's no more items to fetch.
   */
  key: any;
  /**
   * The horizontal offset in pixels relative to the item identified by key/index.
   */
  offsetX: number;
  /**
   * The vertical offset in pixels relative to the item identified by key/index.
   */
  offsetY: number;
  /**
   * The key of the parent where the index is relative to. If not specified, then the root is assumed
   */
  parent: any;
  /**
   * The horizontal position in pixels.
   */
  x: number;
  /**
   * The vertical position in pixels.
   */
  y: number;
}
export interface Translations {
  /**
   * Provides instruction text for group header expand or collapse
   */
  accessibleExpandCollapseInstructionText: string;
  /**
   * Provides notification for group header collapse
   */
  accessibleGroupCollapse: string;
  /**
   * Provides notification for group header expand
   */
  accessibleGroupExpand: string;
  /**
   * Provides properties to customize the screen reader text when focus skips a number of items as a result of up/down arrow navigation in card layout mode.
   */
  accessibleNavigateSkipItems: string;
  /**
   * Provides properties to customize the screen reader text when the tentative drop target is after a certain item.
   */
  accessibleReorderAfterItem: string;
  /**
   * Provides properties to customize the screen reader text when the tentative drop target is before a certain item.
   */
  accessibleReorderBeforeItem: string;
  /**
   * Provides properties to customize the screen reader text when the tentative drop target is inside a certain item.
   */
  accessibleReorderInsideItem: string;
  /**
   * Provides properties to customize the screen reader touch instructional text for reordering items.
   */
  accessibleReorderTouchInstructionText: string;
  /**
   * Provides properties to customize the screen reader text for suggestions returned by OARS service.
   */
  accessibleSuggestion: string;
  /**
   * Provides properties to customize the characters to display in the Indexer.
   */
  indexerCharacters: string;
  /**
   * Provides properties to customize the context menu copy label.
   */
  labelCopy: string;
  /**
   * Provides properties to customize the context menu cut label.
   */
  labelCut: string;
  /**
   * Provides properties to customize the context menu paste label.
   */
  labelPaste: string;
  /**
   * Provides properties to customize the context menu paste after label.
   */
  labelPasteAfter: string;
  /**
   * Provides properties to customize the context menu paste before label.
   */
  labelPasteBefore: string;
  /**
   * Provides properties to customize the message text used by ListView when all items are fetched.
   */
  msgFetchCompleted: string;
  /**
   * Provides properties to customize the message text used by ListView when waiting for data.
   */
  msgFetchingData: string;
  /**
   * Provides properties to customize the message text used by ListView when items are appended.
   */
  msgItemsAppended: string;
  /**
   * Provides properties to customize the message text used by ListView when there are no items.
   */
  msgNoData: string;
}
