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

export default class CoUxBadgeGroup extends Component {
    constructor(parent) {
      let selector = 'ux-badge-group';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/src/lib/ux-components/ux-badge-group/ux-badge-group.component.html
    }
    get badgeDataSpan() {
      return this.currentPath + '//span[@data-e2e="ux-badge-group"]';
    }
    get badgeLeft() {
      return this.badgeDataSpan + '//span[contains(@class, "ux-badge-group__badge-left")]';
    }
    get badgeRight() {
      return this.badgeDataSpan + '//span[contains(@class, "ux-badge-group__badge-right")]';
    }
    async isPill() {
      let leftIsPill = await elementAttributeContains(this.badgeLeft, 'class', 'ux-badge--pill');
      let rightIsPill = await elementAttributeContains(this.badgeRight, 'class', 'ux-badge--pill');
      return leftIsPill && rightIsPill;
    }
    async isSmall() {
      let leftIsSmall = await elementAttributeContains(this.badgeLeft, 'class', 'ux-badge--small');
      let rightIsSmall = await elementAttributeContains(this.badgeRight, 'class', 'ux-badge--small');
      return leftIsSmall && rightIsSmall;
    }
    async isLarge() {
      let leftIsLarge = await elementAttributeContains(this.badgeLeft, 'class', 'ux-badge--large');
      let rightIsLarge = await elementAttributeContains(this.badgeRight, 'class', 'ux-badge--large');
      return leftIsLarge && rightIsLarge;
    }
    async typeClass() {
      return await (await $(this.currentPath)).getAttribute('typeclass');
    }
}


