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

export default class CoUxSwitch extends Component {
    constructor(parent) {
      let selector = 'ux-switch';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/src/lib/ux-components/ux-switch/ux-switch.component.ts
    }
    get dataE2E() {
       return this.currentPath + '//span[@data-e2e = "ux-switch"]';
    }
    get switchHandle() {
      let path = '//*[@class = "ux-c-switch__handle"]';
      return this.dataE2E + path;
    }
    async isChecked() {
      return await elementAttributeContains(this.dataE2E, 'aria-checked', 'true');
    }
    async isDisabled() {
      return await elementAttributeContains(this.dataE2E, 'aria-disabled', 'true');
    }
    async isSmall() {
      return await elementAttributeContains(this.dataE2E, 'class', 'ux-c-switch--small');
    }
    async isLarge() {
      return await elementAttributeContains(this.dataE2E, 'class', 'ux-c-switch--large');
    }
}

