import Component  from '../component.js'
import CoEuiChipList from './eui-chip-list.js'
import CoEuiChip from './eui-chip.js'
import CoEuiBadge from './eui-badge.js'
import { elementAttributeContains } from '../../core/utils.js'

export default class CoEuiPicker extends Component {
  constructor(parent) {
    let selector = 'eui-picker';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-picker/eui-picker.component.html
  }
  get container() {
    return this.currentPath + '//div[contains(@class,"eui-picker-container")]';
  }
  async isDisabled() {
    return await elementAttributeContains(this.container, 'class', 'eui-picker-container--disabled');
  }
  get euiChipListCO() {
    return new CoEuiChipList(this.container);
  }
  async isChipListDisabled() {
    return await (await $(this.euiChipListCO.currentPath +'self::*[@euiOutline]')).isExisting()
  }
  get euiChipCO() {
    return new CoEuiChip(this.euiChipListCO);
  }
  get nbrSelectedBadgeCO() {
    return new CoEuiBadge(this.container).byAttributeContains('styleClass', 'eui-picker__nb-selected-badge');
  }
  async hasNbSelectedInfo() {
    return await (await $(this.nbrSelectedBadgeCO.currentPath)).isExisting();
  }
  async hasSearchFilter() {
    return await (await $(this.currentPath +'self::*[@hasSearchFilter]')).isExisting()
  }
  async hasNbSelectedInfo() {
    return await (await $(this.currentPath +'self::*[@hasNbSelectedInfo]')).isExisting()
  }
}


