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 CoEuiWizard extends Component {
    constructor(parent) {
        let selector = 'eui-wizard';
        super(parent, selector);
        //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-wizard/eui-wizard.component.html
    }

    get tabListCO() {
        return new DivComponent(this.currentPath).addPredicateClassContains('eui-wizard');
    }

    get euiWizardStepCO() {
        return new DivComponent(this.tabListCO).addPredicateClassContains('eui-wizard-step');
    }

    get euiWizardStepIndicatorWrapperCO() {
        return new DivComponent(this.euiWizardStepCO).addPredicateClassContains('eui-wizard-step__indicator-wrapper');
    }

    get euiWizardStepBulletItemCO() {
        return new DivComponent(this.euiWizardStepCO).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).byAttributeContains('icon', 'eui-check');
    }

    async isCompleted() {
        return await (await this.checkIconSvgCO.element()).isExisting();
    }

    get exclamationIconSvgCO() {
        return new CoEuiIconSvg(this.euiWizardStepBulletItemIconCO).byAttributeContains('icon', 'eui-exclamation');
    }

    async isInvalidAndNotActive() {
        return await (await this.exclamationIconSvgCO.element()).isExisting();
    }

    get createIconSvgCO() {
        return new CoEuiIconSvg(this.euiWizardStepBulletItemIconCO).byAttributeContains('icon', 'eui-create');
    }

    async isActive() {
        return await (await this.createIconSvgCO.element()).isExisting();
    }

    get indexIconClassSpanCO(){
        return new SpanComponent(this.euiWizardStepBulletItemCO).addPredicateAttributeContains('role', 'presentation');
    }

    async isIndexIconClass() {
        return await (await this.indexIconClassSpanCO.element()).isExisting();
    }

    get euiWizardStepIcon() {
        return new SpanComponent(this.indexIconClassSpanCO).addPredicateClassContains('eui-wizard-step__icon');
    }

    get indexIconSvgNameCO() {
        return new CoEuiIconSvg(this.euiWizardStepBulletItemCO).addPredicateClassContains('eui-wizard-step__icon');
    }

    get euiWizardStepLabelWrapperCO() {
        return new DivComponent(this.euiWizardStepCO).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.euiWizardStepCO).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');
    }

    get tabPanelCO() {
        return new DivComponent(this.currentPath).addPredicateClassContains('step-content');
    }
}


