import Component from '../component.js';
import ButtonComponent from '../button.js';
import DivComponent from '../div.js';
import SpanComponent from '../span.js';
import CoEuiIconSvg from './eui-icon-svg.js';

export default class CoEuiExpandContent extends Component {
  constructor(parent) {
    let selector = 'eui-expand-content';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/shared/eui-expand-content/eui-expand-content.component.html?at=master
  }
  get bodyCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-expand-content__body');
  }
  get expandTriggerCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-button__expand-trigger');
  }
  async isCollapsed() {
    return await (await $(this.expandTriggerCO.currentPath + '/self::div[contains(@class, "eui-button__expand-trigger--collapsed")]')).isExisting();
  }
  get expandButtonCO() {
    return new ButtonComponent(this.expandTriggerCO).addPredicateAttributeContains('aria-label', 'Expand');
  }
  get expandLabelCO() {
    return new SpanComponent(this.expandButtonCO).addPredicateClassContains('eui-label');
  }
  async hasExpandLabel() {
    return await (await this.expandLabelCO.element()).isExisting();
  }
  get expandIconCO() {
    return new CoEuiIconSvg(this.expandButtonCO).addPredicateIconContains('eui-chevron-down');
  }
  get collapseButtonCO() {
    return new ButtonComponent(this.expandTriggerCO).addPredicateAttributeContains('aria-label', 'Collapse');
  }
  get collapseLabelCO() {
    return new SpanComponent(this.collapseButtonCO).addPredicateClassContains('eui-label');
  }
  async hasCollapseLabel() {
    return await (await this.collapseLabelCO.element()).isExisting();
  }
  get collapseIconCO() {
    return new CoEuiIconSvg(this.collapseButtonCO).addPredicateIconContains('eui-chevron-up');
  }
}


