import Component from '../../component.js';
import LiComponent from '../../li.js';
import UlComponent from '../../ul.js';
import CoUxLayoutNavBarTopMenuItem from './ux-layout-nav-bar-top-menu-item.js';

export default class CoUxLayoutNavBarTopMenu extends Component {
  constructor(parent) {
    let selector = 'ux-layout-nav-bar-top-menu';
    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 nav(){
    return this.currentPath + '//nav[@id, "top-menu"]';
  }
  get ulCO(){
    return new UlComponent(this.nav);
  }
  get liMenuItemCO(){
    return new LiComponent(this.ulCO).byAttributeContains('class', 'icon-menu-item');
  }
  async isShowHome(){
    return await ( await this.liMenuItemCO.element()).isExisting();
  }
  get homeUrl(){
    return this.liMenuItemCO.currentPath + '//a[contains(@class, "icon-home-link")]';
  }
  get homeIcon(){
    return this.homeUrl + '//span[contains(@class, "ux-icon-home")]'
  }
  get menuItemCO(){
    return new CoUxLayoutNavBarTopMenuItem();
  }
}

