import Component from '../../component.js'
import CoUxLanguageSelectorItem from './ux-language-selector-item.js'
import CoUxLanguageSelectorLanguageRows from './ux-language-selector-languageRows.js'
import CoUxModal from './ux-modal.js'

export default class CoUxLanguageSelector extends Component {
  constructor(parent) {
    let selector = 'ux-language-selector';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/src/lib/ux-components/ux-language-selector/ux-language-selector.component.html
  }
  get dataE2E() {
    let path = '//div[@data-e2e="ux-language-selector"]';
    return this.currentPath + path;
  }
  get buttonGroup() {
    let path = '//div[contains(@class,"ux-button-group")]';
    return this.dataE2E + path;
  }
  async isShowDropDown() {
    return await (await $(this.buttonGroup)).isExisting();
  }
  get dropdownMenu() {
    let path = '//div[contains(@class,"ux-dropdown-menu")]';
    return this.buttonGroup + path;
  }
  get languageDropdownItemCO() {
    return new CoUxLanguageSelectorItem(this.dropdownMenu);
  }
  get modalCO() {
    return new CoUxModal(this.dataE2E);
  }
  async isShowModal() {
    return await (await $(this.modalCO.currentPath)).isExisting();
  }
  get languageSelectorLanguageRowsCO() {
    return new CoUxLanguageSelectorLanguageRows(this.modalCO.bodyPlaceholder);
  }
  get headerSelector() {
    let path = '//div[contains(@class, "ecl-site-header__selector")]';
    return this.currentPath + path;
  }
  get headerSelectorLink() {
    let path = '//a[contains(@class, "ecl-link") and contains(@class, "ecl-link--standalone")]';
    return this.headerSelector + path;
  }
  get selectedLanguageLabel() {
    let path = '/span[not(contains(@class,"ecl-site-header__language-icon"))]'
    return this.headerSelectorLink + path;
  }
  async isShowLabel() {
    return await (await $(this.selectedLanguageLabel)).isExisting();
  }
  get languageIcon() {
    let path = '//span[contains(@class,"ecl-site-header__language-icon")]';
    return this.headerSelectorLink + path;
  }
  get languageSelector() {
    let path = '//span[contains(@class,"ux-icon-language-selector")]';
    return this.languageIcon + path;
  }
  get languageCode() {
    let path = '//span[contains(@class,"ecl-site-header__language-code")]';
    return this.languageIcon + path;
  }
}

  
