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

export default class CoEuiDropdownItem extends Component {
    constructor(parent) {
      let selector = '*[self::eui-dropdown-item or self::*[@euiDropdownItem]]';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-dropdown/dropdown-item/eui-dropdown-item.component.html?at=master
    }
    async isActive() {
      return await (await $(this.currentPath + '/self::*[contains(@class,"eui-dropdown-item--active")]')).isExisting();
    }
    get containerCO() {
      return new DivComponent(this.currentPath).addPredicateClassContains('eui-dropdown-item__container');
    }
    get contentCO() {
      return new DivComponent(this.containerCO).addPredicateClassContains('eui-dropdown-item__content');
    }
    get subDropdownLeftCO(){
      return new DivComponent(this.contentCO).addPredicateClassContains('eui-dropdown-item__content-icon--left');
    }
    get subDropdownLeftIconCO(){
      return new CoEuiIconSvg(this.subDropdownLeftCO).addPredicateIconContains('chevron-back');
    }
    get contentTextCO() {
      return new DivComponent(this.contentCO).addPredicateClassContains('eui-dropdown-item__content-text');
    }
    get contentIconRightCO() {
      return new DivComponent(this.contentCO).addPredicateClassContains('eui-dropdown-item__content-icon--right');
    }
    async hasSubDropdown(){
      return await(await this.contentIconRightCO.element()).isExisting();
    }
    get iconRightCO() {
      return new CoEuiIconSvg(this.contentIconRightCO).addPredicateIconContains('chevron-forward');
    }
}


