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

export default class CoEuiTimebarLegendItem extends Component {
  constructor(parent) {
    let selector = 'div[contains(@class, "eui-timebar__legend-item")]';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-timebar/eui-timebar.component.html?at=master
  }
  get itemIconCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-timebar__legend-item-icon');
  }
  get circleIconCO() {
    return new CoEuiIconSvg(this.currentDateMarker);
  }
  async isShowLegend() {
    return await (await $(this.itemIconCO.currentPath)).isExisting();
  }
  get indexWrapperCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-timebar__legend-item-index-wrapper');
  }
  async isShowLegendAsIndexGenerated() {
    return await (await $(this.indexWrapperCO.currentPath)).isExisting();
  }
  get itemLabelCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-timebar__legend-item-label');
  }
  get strongLabel() {
    return new StrongComponent(this.itemLabelCO);
  }
  async isMobile() {
    return !(await (await $(this.strongLabel.currentPath)).isExisting());
  }
}

