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

export default class CoEuiPageColumn extends Component {
    constructor(parent) {
      let selector = 'eui-page-column';
      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-column/eui-page-column.component.html?at=refs%2Fheads%2Fsupport%2F10.x
    }
    get header() {
      let path = '//div[contains(@class,"eui-page-column__header")]';
      return this.currentPath + path;
    }
    async isCollapsedWithIcons() {
      return await elementAttributeContains(this.header, 'class', 'eui-page-column__header--with-icons');
    }
    get headerLeftContent() {
      let path = '//div[contains(@class,"eui-page-column__header-left-content")]';
      return this.header + path;
    }
    get headerLeftContentLabel() {
      let path = '//div[contains(@class,"eui-page-column__header-left-content-label")]';
      return this.headerLeftContent + path;
    }
    async hasHeaderLeftContentLabel() {
      return await (await $(this.headerLeftContentLabel)).isExisting();
    }
    get headerCollapsedContent() {
      let path = '//eui-page-column-header-collapsed-content';
      return this.headerLeftContent + path;
    }
    async hasCustomHeaderCollapsedContent() {
      return await (await $(this.headerCollapsedContent)).isExisting();
    }
    get headerLeftContentPlaceholder() {
      let path = '//eui-page-column-header-left-content';
      return this.headerLeftContent + path;
    }
    async hasCustomHeaderLeftContent() {
      return await (await $(this.headerLeftContentPlaceholder)).isExisting();
    }
    get headerRightContent() {
      let path = '//div[contains(@class,"eui-page-column__header-right-content")]';
      return this.header + path;
    }
    get headerRightContentBody() {
      let path = '//div[contains(@class,"eui-page-column__header-right-content-body")]';
      return this.headerRightContent + path;
    }
    async hasCustomHeaderRightContent() {
      return await (await $(this.headerRightContentBody)).isExisting();
    }
    get headerRightContentPlaceholder() {
      let path = '//eui-page-column-header-right-content';
      return this.headerRightContentBody + path;
    }
    get buttonCO() {
      return new ButtonComponent(this.headerRightContent);
    }
    get headerToggleIcon() {
      let path = '[contains(@class,"eui-page-column__header-toggle") and contains(@class,"eui-icon")]';
      return this.buttonCO.currentPath + path;
    }
    async isCollapsible() {
      return await (await $(this.headerToggleIcon)).isExisting();
    }
    async hasIconAngleRight() {
      return await elementAttributeContains(this.buttonCO.currentPath, 'class', 'eui-icon-angle-right');
    }
    async hasIconAngleLeft() {
      return await elementAttributeContains(this.buttonCO.currentPath, 'class', 'eui-icon-angle-left');
    }
    async hasIconAngleDown() {
      return await elementAttributeContains(this.buttonCO.currentPath, 'class', 'eui-icon-angle-down');
    }
    async hasIconAngleUp() {
      return await elementAttributeContains(this.buttonCO.currentPath, 'class', 'eui-icon-angle-up');
    }
    get headerLeftContentBody() {
      let path = '//div[contains(@class,"eui-page-column__header-left-content-body")]';
      return this.currentPath + path;
    }
    async hasCustomHeaderBodyContent() {
      return await (await $(this.headerLeftContentBody)).isExisting();
    }
    async isHeaderBodyShrinked() {
      return await elementAttributeContains(this.headerLeftContentBody, 'class', 'eui-page-column__header-left-content-body--shrinked');
    }
    get headerBodyPlaceholder() {
      let path = '//eui-page-column-header-body';
      return this.headerLeftContentBody + path;
    }
    get body() {
      let path = '//div[contains(@class,"eui-page-column__body")]';
      return this.currentPath + path;
    }
    async isBodyInteractiveScrollbars() {
      return await elementAttributeContains(this.body, 'class', 'eui-page-column__body--interactive-scrollbars');
    }
    async isBodyCollapsedWithIcons() {
      return await elementAttributeContains(this.body, 'class', 'eui-page-column__header-left-content-body--shrinked');
    }
    get bodyPlaceholder() {
      let path = '//eui-page-column-body';
      return this.body + path;
    }
    get footer() {
      let path = '//div[contains(@class,"eui-page-column__footer")]';
      return this.currentPath + path;
    }
    async hasCustomFooterContent() {
      return await (await $(this.footer)).isExisting();
    }
    async isHighlighted() {
      return await elementAttributeContains(this.footer, 'class', 'eui-page-column__footer--highlighted');
    }
    get footerPlaceholder() {
      let path = '//eui-page-column-footer';
      return this.footer + path;
    }
}


