import Component  from '../component.js'
import { elementAttributeContains } from '../../core/utils.js';
import CoEuiCommonHeader from './eui-common-header.js';
import DivComponent from '../div.js';
import CoEuiExpandContent from './eui-expand-content.js';
import CoEuiPageHeaderBody from './eui-page-header-body.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/eui-page/components/eui-page-header/eui-page-header.component.html
    }
    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 commonHeaderCO() {
      return new CoEuiCommonHeader(this.currentPath);
    }
    get headerActionItemsCO(){
      return new DivComponent(this.commonHeaderCO).addPredicateClassContains('eui-page-header__action-items');
    }
    get headerActionItems(){
      return this.headerActionItemsCO.currentPath + '//eui-page-header-action-items';
    }
    get expandContentCO(){
      return new CoEuiExpandContent(this.currentPath);
    }
    get expandContentHeaderBodyCO(){
      return new CoEuiPageHeaderBody(this.expandContentCO);
    }
    get headerBodyCO(){
      return new CoEuiPageHeaderBody(this.currentPath);
    }
    async notCollapsibleAndCustomPageHeaderBodyContent(){
      return await (await this.headerBodyCO.element()).isExisting();
    }
}


