import Component  from '../component.js'

export default class CoUxLayoutPage extends Component {

    constructor(parent) {
      let selector = 'ux-layout-page';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/core/src/lib/commons/ux-components/layout/ux-layout-page/ux-layout-page.component.html?at=refs%2Fheads%2Fsupport%2F7.x
    }

    get dataE2E() {
      return this.currentPath + '//div[@data-e2e="ux-layout-page"]';
    }
    get pageHeaderPlaceholder() {
      return this.dataE2E + '//div[contains(@class,"ux-layout-page__header")]';
    }
    get headerPlaceholder() {
      return this.header + '//uxLayoutPageHeader';
    }
    async isPlain() {
      return await (await $(this.dataE2E + '//div[contains(@class,"ux-layout-page__body-wrapper")]')).isExisting();
    }
    get bodyWrapper() {
      return this.dataE2E + '//div[contains(@class,"ux-layout-page__body-wrapper")]';
    }
    get bodyHeader() {
      return this.bodyWrapper + '//div[contains(@class,"ux-layout-page__body-header")]';
    }
    async pageBodyContent() {
      if (await this.isPlain()) {
        let path = '//div[contains(@class,"ux-layout-page__body-content")]';
        return this.bodyWrapper + path;
      } else {
        let path = '//div[contains(@class,"ux-layout-page__body-content")]';
        return this.currentPath + path;
      }
    }
    get pageFooter() {
      let path = '//div[contains(@class,"ux-layout-page__footer")]';
      return this.currentPath + path;
    }
    async hasFooterActive() {
      let cl = await (await this.element()).getAttribute('class');
      if (cl.includes('ux-layout-page--has-footer')) {
         return true;
      } else {
         console.log('has Footer not Active');
      }
    }
    
}


