import Component from '../../component.js'
import UlComponent from '../../ul.js'
import CoUxLayoutNavBarTopMenuItemChild from './ux-layout-nav-bar-top-menu-item-child.js'

export default class CoUxLayoutNavBarTopMenuItem extends Component {
  constructor(parent) {
    let selector = 'li';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/src/lib/ux-components/layout/ux-layout-app-shell/components/ux-layout-nav-bar/ux-layout-nav-bar-top-menu.component.ts?at=support/10.x
  }
  get link(){
    return this.currentPath + '//a[not(@routerlink)]';
  }
  get linkIcon(){
    return this.link + '//i[contains(@class, "ux-icon-fw")]';
  }
  async hasLinkIcon(){
    return await ( await $(this.linkIcon)).isEXisting();
  }
  get linkNoUrl(){
    return this.currentPath + '//a[@routerlink]';
  }
  get linkNoUrlIcon(){
    return this.linkNoUrl + '//i[contains(@class, "ux-icon-fw")]';
  }
  get ulShowCO(){
    return new UlComponent(this.currentPath).byAttributeContains('class', 'show');
  }
  async hasChildren(){
    return await ( await this.ulShowCO.element()).isEXisting();
  }
  get childCO(){
    return new CoUxLayoutNavBarTopMenuItemChild(this.ulShowCO);
  }
}

