import Component  from '../component.js'
import { elementAttributeContains } from '../../core/utils.js'
import EuiTabItem from './eui-tab-item.js'
import EuiButton from './eui-button.js'
import CoEuiTabContent from './eui-tab-content.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=support/13.x
    }
    get dataE2E(){
      let path = '//div[@data-e2e = "eui-tabs"]';
      return this.currentPath + path;
    }
    async isMainNavigation() {
      return await elementAttributeContains(this.dataE2E, 'class', 'eui-tabs--main-navigation');
    }
    async isVerticalTabs() {
      return await elementAttributeContains(this.dataE2E, 'class', 'eui-tabs--vertical');
    }
    get items() {
      let path = '//div[contains(@class, "eui-tabs__items")]';
      return this.dataE2E + path;
    }
    async hasScrolling() {
      return await elementAttributeContains(this.items, 'class', 'eui-tabs__items--scrolling');
    }
    get wrapper() {
      let path = '//div[contains(@class, "eui-tabs__items-wrapper")]';
      return this.items + path;
    }
    get euiTabItemCO() {
      return new EuiTabItem(this.wrapper);
    }
    get rightContent() {
      let path = '//div[contains(@class, "eui-tabs__right-content")]';
      return this.items + path;
    }
    get rightContentPlaceholder() {
      let path = '//euiTabsRightContent';
      return this.rightContent + path;
    }
    get navigation() {
      let path = '//div[contains(@class, "eui-tabs__navigation")]';
      return this.items + path;
    }
    get navigationLeftItem() {
      let path = '//div[contains(@class, "eui-tabs__navigation__left-item")]';
      return this.navigation + path;
    }
    get angleLeftIcon() {
      let path = '//span[contains(@class, "eui-icon-angle-left")]';
      return new EuiButton(this.navigationLeftItem).currentPath + path;
    }
    get navigationRightItem() {
      let path = '//div[contains(@class, "eui-tabs__navigation__right-item")]';
      return this.navigation + path;
    }
    get angleRightIcon() {
      let path = '//span[contains(@class, "eui-icon-angle-right")]';
      return new EuiButton(this.navigationRightItem).currentPath + path;
    }
    get euiTabContentCO() {
      return new CoEuiTabContent(this.dataE2E);
    }

}


