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

export default class CoEuiWizardTab extends Component {
    constructor(parent) {
        let selector = 'div[contains(@class,"eui-wizard-step")]';
        super(parent, selector);
        //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-wizard/eui-wizard.component.html?at=master
    }
    async isCompleted() {
        return await (await $(this.currentPath + '/self::*[contains(@class,"eui-wizard-step--completed")]')).isExisting();
    }
    async isNotAllowed() {
        return await (await $(this.currentPath + '/self::*[contains(@class,"eui-wizard-step--notallowed")]')).isExisting();
    }
    async isActive() {
        return await (await $(this.currentPath + '/self::*[contains(@class,"eui-wizard-step--active")]')).isExisting();
    }
    async isDisabled() {
        return await (await $(this.currentPath + '/self::*[contains(@class,"eui-wizard-step--disabled")]')).isExisting();
    }
    async isInvalid() {
        return await (await $(this.currentPath + '/self::*[contains(@class,"eui-wizard-step--error") or contains(@class,"eui--danger")]')).isExisting();
    }
    async isWarning() {
        return await (await $(this.currentPath + '/self::*[contains(@class,"eui-wizard-step--warning") or contains(@class,"eui--warning")]')).isExisting();
    }
    get euiWizardStepIndicatorWrapperCO() {
        return new DivComponent(this.currentPath).addPredicateClassContains('eui-wizard-step__indicator-wrapper');
    }
    get euiWizardStepBulletItemCO() {
        return new DivComponent(this.currentPath).addPredicateClassContains('eui-wizard-step__bullet-item');
    }
    get euiWizardStepBulletItemIconCO() {
        return new SpanComponent(this.euiWizardStepBulletItemCO).addPredicateClassContains('eui-wizard-step__bullet-item-icon');
    }
    get checkIconSvgCO() {
        return new CoEuiIconSvg(this.euiWizardStepBulletItemIconCO).addPredicateIconContains('checkmark:sharp');
    }
    get errorIconSvgCO() {
        return new CoEuiIconSvg(this.euiWizardStepBulletItemIconCO).addPredicateIconContains('alert:sharp');
    }
    get editIconSvgCO() {
        return new CoEuiIconSvg(this.euiWizardStepBulletItemIconCO).addPredicateIconContains('eui-ecl-edit');
    }
    async isIndexIconClass() {
        return (await (await this.checkIconSvgCO.element()).isExisting() || await (await this.errorIconSvgCO.element()).isExisting() || await (await this.editIconSvgCO.element()).isExisting()) ;
    }
    get indexIconClassSpanCO() {
        return new SpanComponent(this.euiWizardStepBulletItemCO).addPredicateAttributeContains('role', 'presentation');
    }
    async isIndexIconSvgName() {
        return await (await this.indexIconSvgNameCO.element()).isExisting();
    }
    get indexIconSvgNameCO() {
        return new CoEuiIconSvg(this.indexIconClassSpanCO).addPredicateClassContains('eui-wizard-step__icon');
    }
    get euiWizardStepBulletItemTextCO(){
        return new SpanComponent(this.euiWizardStepBulletItemCO).addPredicateClassContains('eui-wizard-step__bullet-item-text');
    }
    get euiWizardStepLabelWrapperCO() {
        return new DivComponent(this.currentPath).addPredicateClassContains('eui-wizard-step__label-wrapper');
    }
    get euiWizardStepLabelWrapperLabelCO() {
        return new DivComponent(this.euiWizardStepLabelWrapperCO).addPredicateClassContains('eui-wizard-step__label-wrapper-label');
    }
    get euiWizardStepLabelWrapperSubLabelCO() {
        return new DivComponent(this.euiWizardStepLabelWrapperCO).addPredicateClassContains('eui-wizard-step__label-wrapper-sub-label');
    }
    get euiWizardStepCurrentMarkerCO() {
        return new DivComponent(this.currentPath).addPredicateClassContains('eui-wizard-step__current-marker');
    }
    async isCurrentMarkerActive() {
        return await (await this.euiWizardStepCurrentMarkerCO.element()).isExisting();
    }
    get currentMarkerIconSvgCO() {
        return new CoEuiIconSvg(this.euiWizardStepCurrentMarkerCO).addPredicateClassContains('eui-wizard-step__current-marker-icon');
    }
}

