import Component from '../../component.js'
import { elementAttributeContains } from '../../../core/utils.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/components/src/lib/ux-components/layout/ux-layout-page/ux-layout-page.component.html
    }
    get dataE2E() {
      let path = '//div[@data-e2e="ux-layout-page"]';
      return this.currentPath + path;
    }
    get headerPlaceholder() {
      let path = '//div[contains(@class,"ux-layout-page__header")]';
      return this.dataE2E + path;
    }
    async customPageHeaderContent() {
      return await (await $(this.headerPlaceholder)).isExisting();
    }
    async isPlain() {
      return await elementAttributeContains(this.dataE2E, 'class', 'ux-layout-page--plain');
    }
    get bodyWrapper() {
      let path = '//div[contains(@class,"ux-layout-page__body-wrapper")]';
      return this.dataE2E + path;
    }
    get bodyHeaderPlaceholder() {
      let path = '//div[contains(@class,"ux-layout-page__body-header")]';
      return this.bodyWrapper + path;
    }
    async customPageBodyHeaderContent() {
      return await (await $(this.bodyHeaderPlaceholder)).isExisting();
    }
    async isPageBodyHeaderEditable() {
      return await elementAttributeContains(this.bodyHeaderPlaceholder, 'class', 'ux-layout-page__body-header--highlighted');
    }
    get bodyContentIsPlain() {
      let path = '//div[contains(@class,"ux-layout-page__body-content")]';
      return this.bodyWrapper + path;
    }
    get bodyContentNoPlain() {
      let path = '//div[contains(@class,"ux-layout-page__body-content")]';
      return this.dataE2E + path;
    }
    async hasFooterActive() {
      return await elementAttributeContains(this.dataE2E, 'class', 'ux-layout-page--has-footer');
    }
    get pageFooterPlaceholder() {
      let path = '//div[contains(@class,"ux-layout-page__footer")]';
      return this.dataE2E + path;
    }
    async hasCustomPageFooterContent() {
      return await (await $(this.pageFooterPlaceholder)).isExisting();
    }
}


