import Component  from '../component.js'
import CoEuiDropdown from './eui-dropdown.js'
import CoEuiButton from './eui-button.js'
import CdkOverlayContainer from '../cdk-overlay-container.js'
import CoEuiDropdownContent from './eui-dropdown-content.js'
import CoEuiLabel from './eui-label.js'
import DivComponent from '../div.js'
import StrongComponent from '../strong.js'
import CoEuiIconSvg from './eui-icon-svg.js'
import CoEuiDropdownItem from './eui-dropdown-item.js'

export default class CoEuiPaginator extends Component {
  constructor(parent) {
    let selector = 'eui-paginator';
    super(parent, selector);
    this.overlayContainer = new CdkOverlayContainer('//body');
  //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-paginator/eui-paginator.component.html?at=master
  }

  get pageDivCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-paginator__page');
  }
  async hasPaginatorPage(){
    return await (await this.pageDivCO.element()).isExisting();
  }
  get pageSelectorDivCO() {
    return new DivComponent(this.pageDivCO).addPredicateClassContains('eui-paginator__page-selector');
  }
  get dropdownCO() {
    return new CoEuiDropdown(this.pageSelectorDivCO);
  }
  get euiButtonCO(){
    return new CoEuiButton(this.dropdownCO);
  }
  get labelCO() {
    return new CoEuiLabel(this.euiButtonCO);
  }
  get strongCO() {
    return new StrongComponent(this.labelCO);
  }
  get carretDownCO() {
    return new CoEuiIconSvg(this.euiButtonCO).byAttributeContains('icon','eui-caret-down');
  }
  get dropdownContentCO() {
    return new CoEuiDropdownContent(this.overlayContainer.overlayPane);
  }
  get dropdownContentDivCO() {
    return new DivComponent(this.dropdownContentCO);
  }
  get dropdownContentpageSizeOption() {
    return new CoEuiDropdownItem(this.dropdownContentDivCO);
  }
  get pageRange(){
    return new DivComponent(this.pageDivCO).addPredicateClassContains('eui-paginator__page-range');
  }
  async hasPageRange(){
    return await (await this.pageRange.element()).isExisting();
  }
  get navigatorDivCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-paginator__page-navigation');
  }
  async hasNavigator(){
    return await (await this.navigatorDivCO.element()).isExisting();
  }
  get firstNavigationItemDivCO() {
    return new DivComponent(this.navigatorDivCO).addPredicateClassContains('eui-paginator__page-navigation-item').addSelectorPredicate('[1]');
  }
  get caretFirstButtonCO() {
    return new CoEuiButton(this.firstNavigationItemDivCO);
  }
  get caretFirstIconCO() {
    return new CoEuiIconSvg(this.caretFirstButtonCO).byAttributeContains('icon','eui-caret-first');
  }
  get secondNavigationItemDivCO() {
    return new DivComponent(this.navigatorDivCO).addPredicateClassContains('eui-paginator__page-navigation-item').addSelectorPredicate('[2]');
  }
  get caretLeftButtonCO() {
    return new CoEuiButton(this.secondNavigationItemDivCO);
  }
  get caretLeftIconCO() {
    return new CoEuiIconSvg(this.caretLeftButtonCO).byAttributeContains('icon','eui-caret-left');
  }
  get navigationNumbersDivCO(){
    return new DivComponent(this.navigatorDivCO).addPredicateClassContains('eui-paginator__page-navigation-numbers');
  }
  async hasPageNumberNavigation(){
    return await (await this.navigationNumbersDivCO.element()).isExisting();
  }
  get goToPageButtonCO(){
    return new CoEuiButton(this.navigationNumbersDivCO);
  }
  get pageRangeLabelDivCO(){
    return new DivComponent(this.navigatorDivCO).addPredicateClassContains('eui-paginator__page-range');
  }
  async hasPageRangeLabel(){
    return await (await this.pageRangeLabelDivCO.element()).isExinsting();
  }
  get thirdNavigationItemDivCO() {
    return new DivComponent(this.navigatorDivCO).addPredicateClassContains('eui-paginator__page-navigation-item').addSelectorPredicate('[3]');
  }
  get caretRightButtonCO() {
    return new CoEuiButton(this.thirdNavigationItemDivCO);
  }
  get caretRightIconCO() {
    return new CoEuiIconSvg(this.caretRightButtonCO).byAttributeContains('icon','eui-caret-right');
  }
  get fourthNavigationItemDivCO() {
    return new DivComponent(this.navigatorDivCO).addPredicateClassContains('eui-paginator__page-navigation-item').addSelectorPredicate('[4]');
  }
  get lastCaretButtonCO() {
    return new CoEuiButton(this.fourthNavigationItemDivCO);
  }
  get caretLastIconCO() {
    return new CoEuiIconSvg(this.lastCaretButtonCO).byAttributeContains('icon','eui-caret-last');
  }
}


