import Component from '../component.js';
import UlComponent from '../ul.js';
import CoEuiInputText from './eui-input-text.js';
import CoEuiIconSvg from './eui-icon-svg.js';
import CoEuiMenuItemRef from './eui-menu-item-ref.js';
import DivComponent from '../div.js';
import SpanComponent from '../span.js';
import CoEuiList from './eui-list.js';

export default class CoEuiMenu extends Component {
  constructor(parent) {
    let selector = 'eui-menu';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-menu/eui-menu.component.html
  }
  get filterCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-menu-filter');
  }
  async hasFilter() {
    return await (await this.filterCO.element()).isExisting();
  }
  get wrapperCO() {
    return new DivComponent(this.filterCO).addPredicateClassContains('eui-menu-filter__input-wrapper');
  }
  get filterInputCO() {
    return new CoEuiInputText(this.wrapperCO).addPredicateClassContains('eui-menu-filter__input');
  } 
  get searchIconCO() {
    return new CoEuiIconSvg(this.wrapperCO).addPredicateIconContains('eui-search');
  }
  get listCO() {
    return new CoEuiList(this.currentPath).addPredicateClassContains('eui-menu');
  }
  get noItemsCO() {
    return new SpanComponent(this.listCO).addPredicateClassContains('eui-menu--no-items');
  }
  async noItems(){
    return await (await this.noItemsCO.element()).isExisting();
  }
  get euiMenuItemRefCO() {
    return new CoEuiMenuItemRef(this.listCO);
  }
}

