import Component from '../component.js';
import EuiTabsItem from './eui-tabs-item.js';
import CoEuiTabsContent from './eui-tabs-content.js';
import DivComponent from '../div.js';
import CoEuiButton from './eui-button.js';
import CoEuiIconSvg from './eui-icon-svg.js';

export default class CoEuiTabs extends Component {
    constructor(parent) {
      let selector = 'eui-tabs';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-tabs/eui-tabs.component.html?at=master
    }
    get dataE2ECO(){
      return new DivComponent(this.currentPath).addPredicateClassContains(this.selector);
    }
    async isMainNavigation() {
      return await (await $(this.dataE2ECO.currentPath + '/self::*[contains(@class,"eui-tabs--main-navigation")]')).isExisting();
    }
    async isVerticalTabs() {
      return await (await $(this.dataE2ECO.currentPath + '/self::*[contains(@class,"eui-tabs--vertical")]')).isExisting();
    }
    get flexCO() {
      return new DivComponent(this.dataE2ECO).addPredicateClassContains('eui-u-flex');
    }
    async isHorizontal() {
      return await (await $(this.flexCO.currentPath + '/self::*[contains(@class,"eui-tabs__wrapper--horizontal")]')).isExisting();
    }
    get itemsCO() {
      return new DivComponent(this.flexCO).addPredicateClassContains('eui-tabs__items');
    }
    async hasScrolling() {
      return await (await $(this.itemsCO.currentPath + '/self::*[contains(@class,"eui-tabs__items--scrolling")]')).isExisting();
    }
    get wrapperCO() {
      return new DivComponent(this.itemsCO).addPredicateClassContains('eui-tabs__items-wrapper');
    }
    get euiTabItemCO() {
      return new EuiTabsItem(this.wrapperCO);
    }
    get navigationCO() {
      return new DivComponent(this.itemsCO).addPredicateClassContains('eui-tabs__navigation');
    }
    get navigationLeftItemCO() {
      return new DivComponent(this.navigationCO).addPredicateClassContains('eui-tabs__navigation__left-item');
    }
    get scrollLeftBtnCO(){
      return new CoEuiButton(this.navigationLeftItemCO);
    }
    get scrollLeftIconCO() {
      return new CoEuiIconSvg(this.scrollLeftBtnCO).addPredicateIconContains('eui-chevron-back');
    }
    get navigationRightItemCO() {
      return new DivComponent(this.navigationCO).addPredicateClassContains('eui-tabs__navigation__right-item');
    }
    get scrollRightBtnCO(){
      return new CoEuiButton(this.navigationRightItemCO);
    }
    get scrollRightIconCO() {
      return new CoEuiIconSvg(this.scrollRightBtnCO).addPredicateIconContains('eui-chevron-forward');
    }
    get rightContentCO() {
      return new DivComponent(this.flexCO).addPredicateClassContains('eui-tabs__right-content');
    }
    get rightContentPlaceholder() {
      return this.rightContentCO.currentPath + '//euiTabsRightContent';
    }
    get euiTabContentCO() {
      return new CoEuiTabsContent(this.dataE2ECO);
    }
}

