import Component from '../../component.js'
import CoUxAicon from './ux-a-icon.js'
import CoUxDropdownButton from './ux-dropdown-button.js'
import CoUxLanguageSelector from './ux-language-selector.js'
import CoUxLayoutOverlayPanel from './ux-layout-overlay-panel.js'
import CoUxLayoutSidebarItems from './ux-layout-sidebar-items.js'

export default class CoUxLayoutNavBarActionItem extends Component {
  constructor(parent) {
    let selector = 'ux-layout-nav-bar-action-item';
    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-action-item.component.ts?at=support/10.x
  }
  get actionItem(){
    return this.currentPath + '//div[contains(@class, "ux-layout-nav-bar__action-item")]';
  }
  async hasCustomItemContent(){
    return await ( await $(this.navBarItemContent)).isExisting();
  }
  get actionItemIconCO(){
    return new CoUxAicon(this.actionItem);
  }
  async isOverlayPanel(){
    return ( await this.isOverlayPanelCustomContent() || await (await $(this.overlayPanel).isExisting())) 
  }
  get customOverlayPanelCO(){
    return new CoUxLayoutOverlayPanel(this.actionItem);
  }
  async isOverlayPanelCustomContent(){
    return await (await this.customOverlayPanelCO.element()).isExisting();
  }
  get overlayPanelContent(){
    return this.customOverlayPanelCO.currentPath + '//uxLayoutNavBarOverlayPanelContent';
  }
  get overlayPanel(){
    return this.actionItem + '//div[contains(@class, "overlay-panel")]';
  }
  get overlayPanelHeader(){
    return this.overlayPanel + '//div[contains(@class, "overlay-panel__header")]';
  }
  get profile(){
    return this.overlayPanelHeader + '//div[contains(@class, "overlay-panel__header-profile")]';
  }
  get languageSelector(){
    return this.profile + '//span';
  }
  async isShowLanguageSelector(){
    return await (await $(this.languageSelector)).isExisting();
  }
  get languageSelectorCO(){
    return new CoUxLanguageSelector(this.languageSelector);
  }
  get headerCustomContent(){
    return this.profile + '//div[contains(@class, "overlay-panel__header-custom-content")]';
  }
  get profileInfos(){
    return this.profile + '//span[contains(@class, "overlay-panel__header-profile-infos")]';
  }
  get dropdownBtnCO(){
    return new CoUxDropdownButton(this.profileInfos);
  }
  async hasHeaderUserProfileLinks(){
    return await (await this.dropdownBtnCO.element()).isExisting();
  }
  get overlayPanelInner(){
    return this.overlayPanel + '//div[contains(@class, "overlay-panel__inner")]';
  }
  async isNotDesktop(){
    return await (await $(this.overlayPanelInner)).isExisting();
  }
  get sidebarItemsCO(){
    return new CoUxLayoutSidebarItems(this.overlayPanelInner);
  }
  get innerContent(){
    return this.actionItem + '//aside[contains(@class, "inner-content")]';
  }
}

