import Component  from '../component.js'
import MatAutocomplete from '@eui/automation/components/material/mat-autocomplete.js';

export default class CoUxAutocomplete extends Component {
    constructor(parent) {
      let selector = 'ux-autocomplete';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/core/src/lib/commons/ux-components/ux-autocomplete/ux-autocomplete.component.html?at=refs%2Fheads%2Fsupport%2F7.x
    }

    get dataE2E() {
      let path = '//div[@data-e2e = "ux-autocomplete"]';
      return this.currentPath + path;
    }
//no value input
    get input() {
      let path = '//input[contains(@class, "form-control") and contains(@class, "custom-select")]';
      return this.dataE2E + path
    }
// Prepend Section
    get inputGroupPrepend() {
      let path = '//div[contains(@class, "input-group-prepend")]';
      return this.dataE2E + path;
    }
    get inputGroupPrependText() {
      let path = '//span[contains(@class, "input-group-text")]';
      return this.inputGroupPrepend + path;
    }
    get inputGroupPrependIcon() {
      let path = '//span[contains(@class, "ux-icon")]';
      return this.inputGroupPrependText + path;
    }
    get inputGroupPrependButton() {
      let path = '//button[contains(@class, "btn") and contains(@class, "btn-primary")]';
      return this.inputGroupPrepend + path;
    }
    get inputGroupPrependButtonContent() {
      return this.inputGroupPrependButton + '/span'
    }
// Prepend Input Section
    get clearableInputWrapper() {
      let path = '//div[contains(@class, "ux-clearable-input-wrapper")]';
      return this.dataE2E + path;
    }
    get prependInput() {
      let path = '//input[contains(@class, "form-control") and contains(@class, "custom-select")]';
      return this.clearableInputWrapper + path;
    }
    get inputClearButton() {
      let path = '//span[contains(@class, "ux-clearable-input-wrapper__clear")]';
      return this.clearableInputWrapper + path;
    }

// Append Section
    get inputGroupAppend() {
      let path = '//div[contains(@class, "input-group-append")]';
      return this.dataE2E + path;
    }
    get inputGroupAppendText() {
      let path = '//span[contains(@class, "input-group-text")]';
      return this.inputGroupAppend + path;
    }
    get inputGroupAppendIcon() {
      let path = '//span[contains(@class, "ux-icon")]';
      return this.inputGroupAppend + path;
    }
    get inputGroupAppendButton() {
      let path = '//button[contains(@class, "btn") and contains(@class, "btn-primary")]';
      return this.inputGroupAppend + path;
    }
    get inputGroupAppendButtonContent() {
      return this.inputGroupAppendButton + '/span'
    }
// Append Input Section
    get inputContent() {
      let path = '//div[contains(@class, "ux-form-group__input-content")]';
      return this.dataE2E + path;
    }
    get loadingIndicator() {
      let path = '//span[contains(@class, "ux-form-group__loading-indicator")]';
      return this.inputContent + path;
    }
    get matAutocompleteCO() {
      return new MatAutocomplete(this.dataE2E);
    }
    
}

