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';

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).byClassContains('eui-menu-filter');
  }
  async hasFilter() {
    return await (await this.filterCO.element()).isExisting();
  }
  get wrapperCO() {
    return new DivComponent(this.filterCO).byClassContains('eui-menu-filter__input-wrapper');
  }
  get filterInputCO() {
    return new CoEuiInputText(this.wrapperCO).byClassContains('eui-menu-filter__input');
  } 
  get searchIconCO() {
    return new CoEuiIconSvg(this.wrapperCO).byClassContains('eui-menu-filter__input-search');
  }
  get listCO() {
    return new UlComponent(this.currentPath).byAttributeContains('class', 'eui-menu');
  }
  get noItemsCO() {
    return new SpanComponent(this.listCO).byClassContains('eui-menu--no-items');
  }
  get euiMenuItemRefCO() {
    return new CoEuiMenuItemRef(this.listCO);
  }
}

