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

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 filter() {
    let path = '//div[contains(@class,"eui-menu-filter")]';
    return this.currentPath + path;
  }
  async hasFilter() {
    return await (await $(this.filter)).isExisting();
  }
  get wrapper() {
    let path = '//div[contains(@class,"eui-menu-filter__input-wrapper")]';
    return this.filter + path;
  }
  get filterInputCO() {
    return new CoEuiInputText(this.wrapper).byAttributeContains('class', 'eui-menu-filter__input');
  } 
  get searchIconCO() {
    return new CoEuiIconSvg(this.wrapper).byAttributeContains('class','eui-menu-filter__input-search')
  }
  get listCO() {
    return new UlComponent(this.currentPath).byAttributeContains('class', 'eui-menu');
  }
  get noItems() {
    let path = '//span[contains(@class,"eui-menu--no-items")]';
    return this.listCO.currentPath + path;
  }
  get euiMenuItemRefCO() {
    return new CoEuiMenuItemRef(this.listCO);
  }
}


