import Component from '../../component.js'
import { elementAttributeContains } from '../../../core/utils.js'

export default class CoEuiPageHeader extends Component {
    constructor(parent) {
      let selector = 'eui-page-header';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components-next/src/lib/layout/eui-page/components/eui-page-header/eui-page-header.component.html?at=refs%2Fheads%2Fsupport%2F10.x
    }
    async isCollapsible() {
      return await elementAttributeContains(this.currentPath, 'class', 'eui-page-header--collapsible');
    }
    async isCollapsed() {
      return await elementAttributeContains(this.currentPath, 'class', 'eui-page-header--collapsed');
    }
    get commonHeader() {
      let path = '//eui-common-header';
      return this.currentPath + path;
    }
    get label() {
      let path = '[@label]';
      return this.currentPath + path;
    }
    async hasLabel() {
      return await (await $(this.label)).isExisting();
    }
    get sublabel() {
      let path = '[@sublabel]';
      return this.currentPath + path;
    }
    async hasSublabel() {
      return await (await $(this.sublabel)).isExisting();
    }
    get actionItems() {
      let path = '//div[contains(@class,"eui-page-header__action-items")]';
      return this.commonHeader + path;
    }
    get actionItemsPlaceholder() {
      let path = '//eui-page-header-action-items';
      return this.actionItems + path;
    }
    get expandContent() {
      let path = '//eui-expand-content';
      return this.currentPath + path;
    }
    get body() {
      let path = '//div[contains(@class,"eui-page-header__body")]';
      return this.currentPath + path;
    }
    get bodyPlaceholder() {
      let path = '//eui-page-header-body';
      return this.body + path;
    }
}


