import AComponent from '../a.js';
import Component from '../component.js';
import SpanComponent from '../span.js';
import CoEuiIconSvg from './eui-icon-svg.js';

export default class CoEuiToolbarMenuItemSubChild extends Component {
  constructor(parent) {
    let selector = 'li[contains(@class, "child")]';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/layout/eui-toolbar/toolbar-menu/toolbar-menu.component.html
  }
  get routerLinkCO() {
    return new AComponent(this.currentPath).addSelectorPredicate('[@routerLink]');
  }
  async routerLinkIsDisabled() {
    return await elementAttributeContains(this.routerLinkCO.currentPath, 'class', 'disabled');
  }
  get routerLinkIconCO() {
    return SpanComponent(this.routerLinkCO).addSelectorPredicate('[contains(@class, "eui-icon") and contains(@class, "eui-toolbar-menu-item__icon")]');
  }
  async hasSubLinkUrl() {
    return await (await this.routerLinkCO.element()).isExisting();
  }
  get routerLinkSvgIconCO() {
    return new CoEuiIconSvg(this.routerLinkCO).addPredicateClassContains('eui-toolbar-menu-item__icon');
  }
  async hasRouterLinkIcon() {
    return await (await this.routerLinkIconCO.element()).isExisting();
  }
  get routerLinkLabelCO() {
    return new SpanComponent(this.routerLinkCO).addPredicateClassContains('eui-toolbar-menu-item__label');
  }
  get tabIndexLinkCO() {
    return new AComponent(this.currentPath).addSelectorPredicate('[not(@routerLink)]');
  }
  async tabIndexLinkIsDisabled() {
    return await elementAttributeContains(this.tabIndexLinkCO.currentPath, 'class', 'disabled');
  }
  get tabIndexLinkIconCO() {
    return SpanComponent(this.tabIndexLinkCO).addSelectorPredicate('[contains(@class, "eui-icon") and contains(@class, "eui-toolbar-menu-item__icon")]');
  }
  get tabIndexLinkSvgIconCO() {
    return new CoEuiIconSvg(this.tabIndexLinkCO).addPredicateClassContains('eui-toolbar-menu-item__icon');
  }
  get tabIndexLinkLabelCO() {
    return new SpanComponent(this.tabIndexLinkCO).addPredicateClassContains('eui-toolbar-menu-item__label');
  }
  async hasTabIndexLinkIcon() {
    return await (await this.tabIndexLinkIconCO.element()).isExisting();
  }
}


