import Component from '../../component.js'
import CoUxDropdownButton from './ux-dropdown-button.js'
import CoUxButton from './ux-button.js'

export default class CoUxLayoutPageHeader extends Component {
    constructor(parent) {
      let selector = 'ux-layout-page-header';
      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-page-header/ux-layout-page-header.component.html?at=support/10.x
    }
    get pageHeaderWrapper() {
      let path = '//div[contains(@class,"ux-layout-page-header-wrapper")]';
      return this.currentPath + path;
    }
    get pageHeader() {
      let path = '//div[@class = "ux-layout-page-header"]';
      return this.pageHeaderWrapper + path;
    }
    get headerTitle() {
      let path = '//div[@class = "ux-layout-page-header__title"]';
      return this.pageHeader + path;
    }
    // <-- TITLE TEXT -->
    get headerTitleText() {
      let path = '//div[contains(@class,"ux-layout-page-header__title-text")]';
      return this.headerTitle + path;
    }
    // <-- TITLE ACTIONS -->
    get headerTitleActions() {
      let path = '//div[contains(@class,"ux-layout-page-header__actions")]';
      return this.headerTitle + path;
    }
    get headerActionsContent() {
      let path = '//*[contains(@class,"ux-layout-page-header__actions-content")]';
      return this.headerTitleActions + path;
    }
    // <-- ACTIONS BUTTONS -->
    get actionContentButton() {
      return new CoUxButton(this.headerActionsContent).currentPath;
    }
    // <-- LOCAL MENU -->
    get headerLocalMenu() {
      let path = '//div[contains(@class,"ux-layout-page-header__local-menu")]';
      return this.headerTitleActions + path;
    }
    // <-- LOCAL MENU DROPDOWN MENU -->
    get headerLocalMenuDropDownButton() {
      return new CoUxDropdownButton(this.headerLocalMenu).currentPath;
    }
    get bookmarkButton() {
      let path = '//button[contains(@class,"ux-button--bookmark")]';
      return this.headerTitleActions + path;
    }
    async isBookmarkable() {
      return await (await $(this.bookmarkButton)).isExisting();
    }
    get bookmarkedButton() {
      let path = '//span[contains(@class,"eui-icon-bookmark-o")]';
      return this.bookmarkButton + path;
    }
    async isBookmarked() {
      return !(await(await $(this.bookmarkedButton)).isExisting());
    }
    // <-- SUB TITLE -->
    get headerSubTitle() {
      let path = '//div[contains(@class,"ux-layout-page-header__sub-title")]';
      return this.pageHeaderWrapper + path;
    }
    get headerSubTitleText() {
      let path = '//div[contains(@class,"ux-layout-page-header__sub-title-text")]';
      return this.headerSubTitle + path;
    }

}


