import Component from '../../component.js'
import CoUxAicon from './ux-a-icon.js'
import CoUxAmarker from './ux-a-marker.js'
import CoUxBadge from './ux-badge.js'
import { elementAttributeContains } from '../../../core/utils.js'

export default class CoUxAlabel extends Component {
    constructor(parent) {
      let selector = 'ux-a-label';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/src/lib/ux-components/atomic/ux-a-label/ux-a-label.component.html?at=support/10.x
    }
    get dataE2E() {
      const path = '//div[@data-e2e="ux-a-label"]';
      return this.currentPath + path;
    }
    async isDisabled() {
      return await elementAttributeContains(this.currentPath, 'class', 'ux-a-label--disabled');
    }
    get markerCO(){
      return  new CoUxAmarker(this.dataE2E);
    }
    async hasMarker(){
      return await( await $(this.markerCO.currentPath)).isExisting();
    }
    get iconCO() {
      return new CoUxAicon(this.dataE2E);
    }
    async iconStyleClass(){
      return await (await $(new CoUxAicon(this.dataE2E).currentPath)).getAttribute('styleClass');
    }
    get labelContent() {
      let path = '//div[contains(@class,"ux-a-label__content")]';
      return this.dataE2E + path;
    }
    get labelContentLabel() {
      let path = '//div[contains(@class,"ux-a-label__label")]/span';
      return this.labelContent + path;
    }
    async isClickable() {
      return await (await $(this.clickableLink)).isExisting();
    }
    get customLabel() {
      let path = '//div[contains(@class,"ux-a-label__custom-label")]';
      return this.labelContent + path;
    }
    get clickableLink() {
      let path = '//a';
      return this.labelContent + path;
    }
    get subLabel() {
      let path = '//div[contains(@class,"ux-a-label__sub-label")]';
      return this.labelContent + path;
    }
    get customSubLabelPlaceholder() {
      let path = '//uxLabelSubLabel';
      return this.labelContent + path;
    }
    get badgeCO() {
      return new CoUxBadge(this.dataE2E);
    }
    get infos() {
      let path = '//span[contains(@class,"ux-a-label__label-infos")]';
      return this.dataE2E + path;
    }
    async isSmall() {
      return await elementAttributeContains(this.dataE2E, 'class', 'ux-a-label--small');
    }
    async isLarge() {
      return await elementAttributeContains(this.dataE2E, 'class', 'ux-a-label--large');
    }
    async isRenderHTML() {
      return await (await $(this.labelContentLabel)).isDisplayed();
    }
}


