import CoEuiIconSvg from './eui-icon-svg.js'
import Component from '../component.js'
import DivComponent from '../div.js';
import { elementAttributeContains } from '../../core/utils.js';
import AComponent from '../a.js';
import SpanComponent from '../span.js';
import CoEuiLabel from './eui-label.js';

export default class CoEuiBreadcrumbItem extends Component {
  constructor(parent) {
    let selector = 'eui-breadcrumb-item';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-breadcrumb/item/breadcrumb-item.component.html?at=refs%2Fheads%2Fmaster
  }
  get separatorCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-breadcrumb-item__separator');
  }
  async hasPrevious() {
    return await (await this.separatorCO.element()).isExisting();
  }
  get separatorIconCO() {
    return new CoEuiIconSvg(this.separatorCO).addPredicateIconContains('chevron-forward');
  }
  get linkButtonCO() {
    return new AComponent(this.currentPath).addPredicateClassContains('eui-u-text-link-standalone');
  }
  async hasLink() {
    return await (await this.linkButtonCO.element()).isExisting();
  }
  get labelCO() {
    return new SpanComponent(this.linkButtonCO);
  }
  async hasNext() {
    return elementAttributeContains(this.linkButtonCO.currentPath, 'class', 'eui-u-c-neutral');
  }
  get wrapperCO() {
    return new CoEuiLabel(this.currentPath).addPredicateClassContains('eui-breadcrumb-item__label-wrapper');
  }
  get wrapperLabelCO() {
    return new SpanComponent(this.wrapperCO).addPredicateClassContains('eui-breadcrumb-item__label');
  }
}


