import CoEuiButton from './eui-button.js'
import CoEuiLabel from './eui-label.js'
import CoEuiIconSvg from './eui-icon-svg.js'
import Component from '../component.js'
import DivComponent from '../div.js';
import { elementAttributeContains } from '../../core/utils.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/layout/eui-breadcrumb/item/breadcrumb-item.component.html
  }
  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);
  }
  get linkButtonCO() {
    return new CoEuiButton(this.currentPath);
  }
  async hasLink() {
    return await (await this.linkButtonCO.element()).isExisting();
  }
  get noLinkLabelCO() {
    return new CoEuiLabel(this.currentPath);
  }
  async hasNext() {
    return elementAttributeContains(this.linkButtonCO.currentPath, 'class', 'eui-button--primary');
  }
}


