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

export default class CoUxLayoutNavBarTopMenuItemChild 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/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 childLink(){
    return this.currentPath + '//a[not(@routerlink)]'
  }
  get childLinkIcon(){
    return this.childLink + '//i[contains(@class, "ux-icon-fw")]';
  }
  async hasChildLinkIcon(){
    return await ( await $(this.childLinkIcon)).isEXisting();
  }
  get childLinkNoUrl(){
    return this.currentPath + '//a[@routerlink]'
  }
  get childLinkNoUrlIcon(){
    return this.childLinkNoUrl + '//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 CoUxLayoutNavBarTopMenuItemSubChild(this.ulShowCO);
  }
}

