import Component  from '../component.js'
import CoEuiButton from './eui-button.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=refs%2Fheads%2Fsupport%2Fdevelop-14.x
    }
    get container() {
      return this.currentPath + '//div[contains(@class,"eui-fieldset__container")]';
    }
    get header() {
      return this.container + '//div[contains(@class,"eui-fieldset__header")]';
    }
    async hasLabel() {
      return await (await $(this.header)).isExisting();
    }
    get headerLabel() {
      return this.header + '//div[contains(@class,"eui-fieldset__header-label")]';
    }
    get headerIcon() {
      return this.headerLabel + '//div[contains(@class,"eui-fieldset__header-icon")]';
    }
    async hasIconClass() {
      return await (await $(this.headerIcon)).isExisting();
    }
    get euiFieldsetLabelExtraContent() {
      return this.headerLabel + '//euiFieldsetLabelExtraContent';
    }
    get headerRightContent() {
      return this.header + '//div[contains(@class,"eui-fieldset__header-right-content")]';
    }
    get euiFieldsetLabelRightContent() {
      return this.headerRightContent + '//euiFieldsetLabelExtraContent';
    }
    async hasCustomLabelRightContent() {
      return await (await $(this.euiFieldsetLabelRightContent)).isExisting();
    }
    get expandToggleButtonCO() {
      return new CoEuiButton(this.headerRightContent).byAttributeContains('class','eui-fieldset__header-expand-toggle');
    }
    async isExpandable() {
      return await (await $(this.expandToggleButtonCO.currentPath)).isExisting();
    }
    get iconAngleRight() {
      return this.CoEuiButton.currentPath + '//span[contains(@class,"eui-icon-angle-right")]';
    }
    async isExpanded() {
      return await (await $(this.container + '//div[contains(@class,"eui-fieldset__content")]')).isExisting();
    }
    async isFirst() {
      return await (await $(this.currentPath + '/self::div[contains(@class,"eui-fieldset--first")]')).isExisting();
    }
}


