import Component  from '../component.js';
import CoEuiInputText from './eui-input-text.js';
import CoEuiModalPickerItem from './eui-modal-picker-item.js'

export default class CoEuiModalPicker extends Component {
  constructor(parent) {
    let selector = 'div[contains(@class,"eui-modal-picker-container")]';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-picker/modal-picker/eui-modal-picker.component.html
  }
  get searchContainer() {
    return this.currentPath + '//div[contains(@class,"eui-modal-picker__search-container")]';
  }
  get searchInputCO() {
    return new CoEuiInputText(this.searchContainer).byAttributeContains('formControlName', 'search');
  }
  get clear() {
    return this.searchContainer + '//span[contains(@class,"eui-clearable-input-wrapper__clear")]';
  }
  async hasClear() {
    return await (await $(this.clear)).isExisting();
  }
  get itemsContainer() {
    return this.currentPath + '//div[contains(@class,"eui-modal-picker__items-container")]';
  }
  get euiModalPickerItemCO() {
    return new CoEuiModalPickerItem(this.itemsContainer);
  }
}


