import Component from '../../component.js'
import { elementAttributeContains } from '../../../core/utils.js'

export default class CoUxWizardStepsStep extends Component {

  constructor(parent) {
    let selector = 'div[contains(@class,"ux-wizard-step") and @role="tab"]';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/src/lib/ux-components/ux-wizard-step/ux-wizard-steps.component.ts
  }
  async isCompleted() {
    return await elementAttributeContains(this.currentPath, 'class', 'ux-wizard-step--completed');
  }
  async isNavigationAllowed() {
    return !(await elementAttributeContains(this.currentPath, 'class', 'ux-wizard-step--notallowed'));
  }
  async isActive() {
    return await elementAttributeContains(this.currentPath, 'class', 'ux-wizard-step--active');
  }
  async isDisabled() {
    return await elementAttributeContains(this.currentPath, 'class', 'ux-wizard-step--disabled');
  }
  async isInvalid() {
    return await elementAttributeContains(this.currentPath, 'class', 'ux-wizard-step--error');
  }
  get currentMarker()  {
    let path = '//div[contains(@class,"ux-wizard-step__current-marker")]';
    return this.currentPath + path;
  }
  get markerIcon()  {
    let path = '//div[contains(@class,"ux-wizard-step__current-marker-icon")]';
    return this.currentMarker + path;
  }
  get indicator()  {
    let path = '//div[contains(@class,"ux-wizard-step__indicator-wrapper")]';
    return this.currentPath + path;
  }
  get bulletItem()  {
    let path = '//div[contains(@class,"ux-wizard-step__bullet-item")]';
    return this.currentPath + path;
  }
  get bulletItemIcon()  {
    let path = '//span[contains(@class,"ux-wizard-step__bullet-item-icon")]';
    return this.bulletItem + path;
  }
  async isCompletedIcon() {
    return await elementAttributeContains(this.bulletItemIcon, 'class', 'eui-icon-check-m');
  }
  async isInvalidIcon() {
    return await elementAttributeContains(this.bulletItemIcon, 'class', 'eui-icon-exclamation');
  }
  async isActiveIcon() {
    return await elementAttributeContains(this.bulletItemIcon, 'class', 'eui-icon-create');
  }
  get bulletItemIconSpan()  {
    let path = '//span';
    return this.bulletItemIcon + path;
  }
  async hasBulletItemIconSpan() {
    return await (await $(this.bulletItemIconSpan)).isExisting();
  }
  get labelWrapper()  {
    let path = '//div[contains(@class,"ux-wizard-step__label-wrapper")]';
    return this.currentPath + path;
  }
  get labelWrapperLabel()  {
    let path = '//div[contains(@class,"ux-wizard-step__label-wrapper-label")]';
    return this.labelWrapper + path;
  }
  get labelWrapperSublabel()  {
    let path = '//div[contains(@class,"ux-wizard-step__label-wrapper-sub-label")]';
    return this.labelWrapper + path;
  }
}


