import Component from '../component.js'
import { elementAttributeContains } from '../../core/utils.js'
import DivComponent from '../div.js'
import SpanComponent from '../span.js'
import CoEuiButton from './eui-button.js'
import CoEuiIconSvg from './eui-icon-svg.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/eui-page/components/eui-page-column/eui-page-column.component.html
  }
  async isCollapsed() {
    return await elementAttributeContains(this.currentPath, 'class', 'eui-page-column--collapsed');
  }
  get headerCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains("eui-page-column__header");
  }
  async isCollapsedWithIcons() {
    return await elementAttributeContains(this.headerCO.currentPath, 'class', 'eui-page-column__header--with-icons');
  }
  get headerLeftContentCO() {
    return new DivComponent(this.headerCO).addPredicateClassContains("eui-page-column__header-left-content");
  }
  get headerLeftContentLabelCO() {
    return new DivComponent(this.headerLeftContentCO).addPredicateClassContains("eui-page-column__header-left-content-label");
  }
  async hasHeaderLeftContentLabel() {
    return await (await this.headerLeftContentLabelCO.element()).isExisting();
  }
  get headerCollapsedContent() {
    return this.headerLeftContentCO.currentPath + '//eui-page-column-header-collapsed-content';
  }
  async hasCustomHeaderCollapsedContent() {
    return await (await $(this.headerCollapsedContent)).isExisting();
  }
  get headerLeftContentSubLabelCO() {
    return new DivComponent(this.headerLeftContentCO).addPredicateClassContains('eui-page-column__header-left-content-sub-label');
  }
  get headerLeftContentPlaceholder() {
    return this.headerLeftContentCO.currentPath + '//eui-page-column-header-left-content';
  }
  async hasCustomHeaderLeftContent() {
    return await (await $(this.headerLeftContentPlaceholder)).isExisting();
  }
  get headerRightContentCO() {
    return new DivComponent(this.headerCO).addPredicateClassContains('eui-page-column__header-right-content');
  }
  get headerRightContentBodyCO() {
    return new SpanComponent(this.headerRightContentCO).addPredicateClassContains('eui-page-column__header-right-content-body');
  }
  async hasCustomHeaderRightContent() {
    return await (await this.headerRightContentBodyCO.element()).isExisting();
  }
  get headerRightContentPlaceholder() {
    return this.headerRightContentBodyCO.currentPath + '//eui-page-column-header-right-content';
  }
  get buttonCO() {
    return new CoEuiButton(this.headerRightContentCO).byClassContains('eui-page-column__header-toggle');
  }
  async isButtonCollapsible() {
    return await (await this.buttonCO.element()).isExisting();
  }
  get iconDownCO() {
    return new CoEuiIconSvg(this.buttonCO).addPredicateIconContains('chevron-down');
  }
  get iconForwardCO() {
    return new CoEuiIconSvg(this.buttonCO).addPredicateIconContains('chevron-forward');
  }
  get iconUpCO() {
    return new CoEuiIconSvg(this.buttonCO).addPredicateIconContains('chevron-up');
  }
  get iconBackCO() {
    return new CoEuiIconSvg(this.buttonCO).addPredicateIconContains('chevron-back');
  }
  get headerLeftContentBodyCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-page-column__header-left-content-body');
  }
  async hasCustomHeaderBodyContent() {
    return await (await this.headerLeftContentBodyCO.element()).isExisting();
  }
  get headerBodyPlaceholder() {
    let path = '//eui-page-column-header-body';
    return this.headerLeftContentBodyCO.currentPath + path;
  }
  get bodyCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-page-column__body');
  }
  async isBodyCollapsedWithIcons() {
    return await elementAttributeContains(this.bodyCO.currentPath, 'class', 'eui-page-column--collapsed-with-icons');
  }
  get bodyPlaceholder() {
    let path = '//eui-page-column-body';
    return this.bodyCO.currentPath + path;
  }
  get footerCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-page-column__footer');
  }
  async hasCustomFooterContent() {
    return await (await this.footerCO.element()).isExisting();
  }
  async isHighlighted() {
    return await elementAttributeContains(this.footerCO.currentPath, 'class', 'eui-page-column__footer--highlighted');
  }
  get footerPlaceholder() {
    let path = '//eui-page-column-footer';
    return this.footerCO.currentPath + path;
  }
}
