import Component from '../../component.js'
import { elementAttributeContains } from '../../../core/utils.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-next/src/lib/components/atoms/eui-icon-toggle/eui-icon-toggle.component.html?at=support/develop-10.x
    }
    get toggle() {
      return this.currentPath + '//div[contains(@class, "eui-icon-toggle")]';
    }
    get icon() {
      return this.toggle + '//span[contains(@class, "eui-icon-toggle__icon")]';
    }
    async isChecked() {
      return await elementAttributeContains(this.icon, 'class', 'eui-icon-toggle--checked');
    }
    async isReadOnly() {
      return !(await elementAttributeContains(this.icon, 'class', 'eui-u-cursor-pointer'));
    }

}


