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 CoEuiIconToggle extends Component {
  constructor(parent) {
    let selector = 'eui-icon-toggle';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-icon-toggle/eui-icon-toggle.component.html?at=master
  }
  get toggleDivCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-icon-toggle');
  }
  get toggleIconCO() {
    return new SpanComponent(this.curretoggleDivCOntPath).addPredicateClassContains('eui-icon-toggle__icon');
  }
  async hasIconClass() {
    return await(await this.toggleIconCO.element()).isExisting();
  }
  async isChecked() {
    return await(await $(this.toggleIconCO.currentPath + '/self::span[contains(@class, "eui-icon-toggle--checked")]')).isExisting();
  }
  async isReadOnly() {
    return await(await $(this.toggleIconCO.currentPath + '/self::span[contains(@class, "eui-icon-toggle--readonly")]')).isExisting();
  }
  get iconSvgCO() {
    return new CoEuiIconSvg(this.toggleDivCO);
  }
  async hasIconSvg() {
    return await(await this.iconSvgCO.element()).isExisting();
  }
}


