import Component  from '../component.js'
import CoEuiButton from './eui-button.js'
import CoEuiOverlay from './eui-overlay.js';
import CoEuiIconSvg from './eui-icon-svg.js';
import CoEuiInputGroup from './eui-input-group.js';
import CoEuiInputText from './eui-input-text.js';

export default class CoEuiSearch extends Component {
  constructor(parent) {
    let selector = 'eui-search';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/layout/eui-search/search.component.html
  }
  get euiIconSearchCO() {
    return new CoEuiIconSvg(this.currentPath).byAttributeContains('icon', 'eui-search');
  }
  get euiOverlayCO() {
    return new CoEuiOverlay(this.currentPath);
  }
  async isOverlayActive() {
    return await (await $(this.euiOverlayCO.currentPath + '/self::*[@isActive="isActive"]')).isExisting();
  }
  get euiInputGroupCO() {
    return new CoEuiInputGroup(this.euiOverlayCO.euiOverlayHeaderCO);
  }
  get inputAddon() {
    return this.euiInputGroupCO.currentPath + '//div[contains(@class,"eui-input-group-addon")]';
  }
  get euiButtonAddonItemCO() {
    return new CoEuiButton(this.inputAddon);
  }
  get euiIconArrowLeftCO() {
    return new CoEuiIconSvg(this.euiButtonAddonItemCO).byAttributeContains('icon', 'eui-arrow-left');
  }
  get searchInputCO() {
    return new CoEuiInputText(this.inputAddon);
  }
  get euiButtonSearchCO() {
    return new CoEuiButton(this.inputAddon).byChildSelector('eui-icon-svg[contains(@icon,"eui-search")]');
  }
  get euiIconSearchAddonCO() {
    return new CoEuiIconSvg(this.euiButtonSearchCO).byAttributeContains('icon', 'eui-search');
  }
  get euiOverlayBodyCO() {
    return this.euiOverlayCO.euiOverlayBodyCO;
  }
}


