import ButtonComponent from '../button.js';
import Component from '../component.js';
import DivComponent from '../div.js';
import CoEuiIconButtonExpander from './eui-icon-button-expander.js';
import CoEuiIconState from './eui-icon-state.js';
import CoEuiIconSvg from './eui-icon-svg.js';
import CoEuiLabel from './eui-label.js';

export default class CoEuiFieldset extends Component {
  constructor(parent) {
    let selector = 'eui-fieldset';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-fieldset/eui-fieldset.component.html?at=master
  }
  get containerCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-fieldset__container');
  }
  get headerCO() {
    return new ButtonComponent(this.containerCO).addPredicateClassContains('eui-fieldset__header');
  }
  async hasLabel() {
    return await (await this.headerCO.element()).isExisting();
  }
  get headerLabelCO() {
    return new DivComponent(this.headerCO).addPredicateClassContains('eui-fieldset__header-label');
  }
  async isLarge() {
    return await (await $(this.headerLabelCO.currentPath + '/self::*[contains(@class,"eui-fieldset__header-label--large")]')).isExisting();
  }
  get iconClassCO() {
    return new DivComponent(this.headerLabelCO).addPredicateClassContains('eui-fieldset__header-icon');
  }
  async hasIconClass() {
    return await (await this.iconClassCO.element()).isExisting();
  }
  get iconSvgNameCO() {
    return new CoEuiIconSvg(this.headerLabelCO);
  }
  get iconStateCO() {
    return new CoEuiIconState(this.headerLabelCO);
  }
  async hasIconSvgName() {
    return await (await this.iconSvgNameCO.element()).isExisting();
  }
  async hasDefaultIcon() {
    return await (await this.iconStateCO.element()).isExisting();
  }
  get labelCO() {
    return new CoEuiLabel(this.headerLabelCO);
  }
  get euiFieldsetLabelExtraContent() {
    return this.headerLabelCO.currentPath + "//euiFieldsetLabelExtraContent";
  }
  get headerRightContentCO() {
    return new DivComponent(this.headerCO).addPredicateClassContains('eui-fieldset__header-right-content');
  }
  get euiFieldsetLabelRightContent() {
    return this.headerRightContentCO.currentPath + "//euiFieldsetLabelRightContent";
  }
  get expandToggleButtonCO() {
    return new CoEuiIconButtonExpander(this.headerRightContentCO);
  }
  async isExpandable() {
    return await (await this.expandToggleButtonCO.element()).isExisting();
  }
  get contentCO() {
    return new DivComponent(this.containerCO).addPredicateClassContains('eui-fieldset__content');
  }
  async isExpanded() {
    return await (await this.contentCO.element()).isExisting();
  }
}


