import Component from '../component.js';
import CoEuiList from './eui-list.js';
import CoEuiLabel from './eui-label.js';
import CoEuiIconSvg from './eui-icon-svg.js';
import DivComponent from '../div.js';

export default class CoEuiListItem extends Component {
  constructor(parent) {
    let selector = '*[self::eui-list-item or @euilistitem]';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-list/eui-list-item/eui-list-item.component.html?at=master
  }
  get containerCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-list-item__container');
  }
  async hasSubmenu() {
    return await (await $(this.containerCO.currentPath + '/self::div[contains(@class, "eui-list-item--has-submenu")]')).isExisting();
  }
  get contentCO() {
    return new DivComponent(this.containerCO).addPredicateClassContains('eui-list-item__content');
  }
  get contentLeftIconCO() {
    return new DivComponent(this.contentCO).addPredicateClassContains('eui-list-item__content-icon');
  }
  async hasContentIcon() {
    return await (await this.contentLeftIconCO.element()).isExisting();
  }
  get itemIconCO() {
    return new CoEuiIconSvg(this.contentLeftIconCO);
  }
  get contentLeftTextCO() {
    return new DivComponent(this.contentCO).addPredicateClassContains('eui-list-item__content-text');
  }
  async hasContentLeftText() {
    return await (await this.contentLeftTextCO.element()).isExisting();
  }
  get itemLabelCO() {
    return new CoEuiLabel(this.contentLeftTextCO);
  }
  get subListCO() {
    return new DivComponent(this.containerCO).addPredicateClassContains('eui-list-item__sub-list');
  }
  async hasItems() {
    return await (await this.subListCO.element()).isExisting();
  }
  get listCO() {
    return new CoEuiList(this.subListCO);
  }

}


