import ButtonComponent from '../button.js'
import Component  from '../component.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
  }
  get expandContentBodyCO(){
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-expand-content__body');
  }
  async isNotCollapsed(){
    return await (await this.expandContentBodyCO.element()).isExisting();
  }
  get expandTriggerCO(){
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-button__expand-trigger');
  }
  get expandBtnCO(){
    return new ButtonComponent(this.expandTriggerCO).byAttributeContains('aria-label', 'Expand');
  }
  async isCollapsed(){
    return await (await this.expandBtnCO.element()).isExisting();
  }
  get expandBtnLabelCO(){
    return new SpanComponent(this.expandBtnCO).addPredicateClassContains('eui-label');
  }
  async hasExpandLabel(){
    return await (await this.expandBtnLabelCO.element()).isExisting();
  }
  get expandBtnIconCO(){
    return new CoEuiIconSvg(this.expandBtnCO).byAttributeContains('icon', 'eui-chevron-down');
  }
  get collapsedBtnCO(){
    return new ButtonComponent(this.expandTriggerCO).byAttributeContains('aria-label', 'Collapse');
  }
  get collapseBtnLabelCO(){
    return new SpanComponent(this.collapsedBtnCO).addPredicateClassContains('eui-label');
  }
  async hasCollapsedLabel(){
    return await (await this.collapseBtnLabelCO.element()).isExisting();
  }
  get collapsedBtnIconCO(){
    return new CoEuiIconSvg(this.collapsedBtnCO).addPredicateIconContains('eui-chevron-up');
  }
}


