import Component  from '../component.js'
import { elementAttributeContains } from '../../core/utils.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
    }
    get dataE2ECO(){
      return new DivComponent(this.currentPath).addPredicateClassContains(this.selector);
    }
    async isMainNavigation() {
      return await elementAttributeContains(this.dataE2ECO.currentPath, 'class', 'eui-tabs--main-navigation');
    }
    async isVerticalTabs() {
      return await elementAttributeContains(this.dataE2ECO.currentPath, 'class', 'eui-tabs--vertical');
    }
    get itemsCO() {
      return new DivComponent(this.dataE2ECO).addPredicateClassContains('eui-tabs__items');
    }
    async hasScrolling() {
      return await elementAttributeContains(this.itemsCO.currentPath, 'class', 'eui-tabs__items--scrolling');
    }
    get wrapperCO() {
      return new DivComponent(this.itemsCO).addPredicateClassContains('eui-tabs__items-wrapper');
    }
    get euiTabItemCO() {
      return new EuiTabsItem(this.wrapperCO);
    }
    get rightContentCO() {
      return new DivComponent(this.itemsCO).addPredicateClassContains('eui-tabs__right-content');
    }
    get rightContentPlaceholder() {
      return this.rightContentCO.currentPath + '//euiTabsRightContent';
    }
    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).byAttributeContains('icon', '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).byAttributeContains('icon', 'eui-chevron-forward');
    }
    get euiTabContentCO() {
      return new CoEuiTabsContent(this.dataE2ECO);
    }
}


