import Component from '../../component.js';
import CoEuiTimebarStep from './eui-timebar-step.js';
import CoEuiTimebarLegendItem from './eui-timebar-legend-item.js';
import DivComponent from '../div.js';
import CoEuiIconSvg from './eui-icon-svg.js';

export default class CoEuiTimebar extends Component {
  constructor(parent) {
    let selector = 'eui-timebar';
    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 timelineContainerCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-u-flex').addSelectorPredicate('[1]');
  }
  get timelineStartLabelCO() {
    return new DivComponent(this.timelineContainerCO).addPredicateClassContains('eui-timebar__start-label');
  }
  async hasStartLabel() {
    return await (await this.timelineStartLabelCO.element()).isExisting();
  }
  get timebarCO() {
    return new DivComponent(this.timelineContainerCO).addPredicateClassContains('eui-timebar');
  }
  get currentProgressCO() {
    return new DivComponent(this.timebarCO).addPredicateClassContains('eui-timebar__current-progress');
  }
  async isShowCurrentDateMarker() {
    return await (await $(this.currentProgressCO.currentPath)).isExisting();
  }
  get currentProgressMarkedDateCO() {
    return new DivComponent(this.timebarCO).addPredicateClassContains('eui-timebar__current-progress');
  }
  async hasMarkedDate() {
    return await (await $(this.currentProgressMarkedDateCO.currentPath)).isExisting();
  }
  get timebarStepCO() {
    return new CoEuiTimebarStep(this.timebarCO);
  }
  get currentDateMarkerCO() {
    return new DivComponent(this.timebarCO).addPredicateClassContains('eui-timebar__current-date-marker').addSelectorPredicate('[1]');
  }
  get mapMarkerIconCurrentDateCO() {
    return new CoEuiIconSvg(this.currentDateMarkerCO);
  }
  get currentDateMarkerStepCO() {
    return new DivComponent(this.timebarCO).addPredicateClassContains('eui-timebar__current-date-marker-step').addSelectorPredicate('[1]');
  }
  get circleIconCurrentDateCO() {
    return new CoEuiIconSvg(this.currentDateMarkerStepCO);
  }
  get markedDateMarkerCO() {
    return new DivComponent(this.timebarCO).addPredicateClassContains('eui-timebar__current-date-marker').addSelectorPredicate('[2]');
  }
  async hasMarkedDate() {
    return await (await this.markedDateMarkerCO.element()).isExisting();
  }
  get mapMarkerIconMarkedDateCO() {
    return new CoEuiIconSvg(this.markedDateMarkerCO);
  }
  get markedDateMarkerStepCO() {
    return new DivComponent(this.timebarCO).addPredicateClassContains('eui-timebar__current-date-marker-step').addSelectorPredicate('[2]');
  }
  get circleIconMarkedDateCO() {
    return new CoEuiIconSvg(this.markedDateMarkerStepCO);
  }
  get timelineEndLabelCO() {
    return new DivComponent(this.timelineContainerCO).addPredicateClassContains('eui-timebar__end-label');
  }
  async hasTimelineEndLabel() {
    return await (await $(this.timelineEndLabelCO.currentPath)).isExisting();
  }
  get legendContainerCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-u-flex').addSelectorPredicate('[2]');
  }
  get legendStartLabelCO() {
    return new DivComponent(this.legendContainerCO).addPredicateClassContains('col-2').addSelectorPredicate('[1]');
  }
  get legendCO() {
    return new DivComponent(this.legendStartLabelCO).addPredicateClassContains('eui-timebar__legend');
  }
  get timebarLegendItemCO() {
    return new CoEuiTimebarLegendItem(this.legendCO);
  }
  async isShowLegend() {
    return await (await $(this.timebarLegendItemCO.currentPath)).isExisting();
  }
  get legendEndLabelCO() {
    return new DivComponent(this.legendContainerCO).addPredicateClassContains('col-2').addSelectorPredicate('[2]');
  }
}

