import BasePage from '../base.js';

export default class EcasBasePage extends BasePage {
    /**
    * @type WebdriverIO.Element
    */
    get notificationContainer() {
        let path = '//div[contains(@class,"notification") and contains(@class,"container-fluid")]//div[contains(@class,"container")]';
        return this.root + path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get notificationContainerMessage() {
        let path = '//p';
        return this.notificationContainer + path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get notificationContainerMessageLink() {
        let path = '//a';
        return this.notificationContainerMessage + path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get notificationContainerCloseBtn() {
        let path = '//a[@id="close-cookie-law-consent"]';
        return this.notificationContainer + path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get notificationContainerCloseBtnText() {
        let path = '//span';
        return this.NotificationContainerCloseBtn + path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get main() {
      let path = '//div[contains(@class,"main") and contains(@class,"container-fluid")]';
      return this.root + path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get mainHeader() {
        let path = '//header[contains(@class,"main-header")]';
        return this.main + path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get mainHeaderBranding() {
        let path = '//div[contains(@class,"branding") and contains(@class,"col-")]';
        return this.mainHeader + path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get mainHeaderBrandingTitle() {
        let path = '//span[contains(@class,"eu-login")]';
        return path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get mainHeaderBrandingTitleLink() {
        let path = '//a';
        return this.mainHeaderBrandingTitle + path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get mainHeaderBrandingSubTitle() {
        let path = '//span[contains(@class,"baseline")]';
        return this.mainHeaderBranding + path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get mainHeaderBrandingWhatsNewLink() {
        let path = '//a[contains(@class,"whatsnew")]';
        return this.mainHeaderBranding + path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get mainHeaderBrandingContrastLink() {
        let path = '//a[@id="btn-contrast"]';
        return this.mainHeaderBranding + path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get mainHeaderLanguageSelection() {
        let path = '//div[contains(@class,"language-selection")]';
        return this.mainHeader + path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get mainHeaderLanguageSelectionFormLink() {
        let path = '//a[@name="languageFormLink"]';
        return this.mainHeaderLanguageSelection + path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get mainHeaderLanguageSelectionForm() {
        let path = '//form[@id="languageForm"]';
        return this.mainHeaderLanguageSelection + path;
    }
    /**
    * @type SelectComponent
    */
    get mainHeaderLanguageSelectionFormSelect() {
        let path = '//select[@id="lang"]';
        return new SelectComponent(this.mainHeaderLanguageSelectionForm + path);
    }
    /**
    * @type WebdriverIO.Element
    */
    get mainNavigation() {
        let path = '//div[contains(@class,"navigation")]';
        return this.main + path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get mainNavigationList() {
        let path = '//ul';
        return this.mainNavigation + path;
    }
    /**
    * @type WebdriverIO.Element
    * @param index number
    */
    async mainNavigationListItemByIndex(index) {
        let path = '//li';
        return await (await this.mainNavigationList.$$(path))[index];
    }
    /**
    * @type WebdriverIO.Element
    */
    mainNavigationListItemByText(text) {
        let path = '//li//descendant-or-self::*[text()[normalize-space()="' + text + '"]]/ancestor::li[1]';
        return this.mainNavigationList + path;
    }
    /**
    * @type WebdriverIO.Element
    * @param text string
    * @param index number
    */
    async mainNavigationListItemByTextAndIndex( text, index) {
        let path = '//li//descendant-or-self::*[text()[normalize-space()="' + text + '"]]/ancestor::li[1]';
        return await (await this.mainNavigationList.$$(path))[index];
    }
    /**
    * @type WebdriverIO.Element
    * @param li WebdriverIO.Element
    */
    mainNavigationListItemLink(li) {
        let path = '//a';
        return li + path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get mainContainer() {
        let path = '/div[contains(@class,"container")]';
        return this.main + path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get mainContainerTitle() {
        let path = '//h1';
        return this.mainContainer + path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get mainContainerContent() {
        let path = '//div[@id="content"]';
        return this.mainContainer + path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get mainContainerContentGenericErrors() {
        let path = '//div[@id="genericErrorsDesc"]';
        return this.mainContainerContent + path;
    }
    /**
    * @type WebdriverIO.Element
    */
    get mainContainerContentInformationMessage() {
        let path = '//p[@class="informationMessage"]';
        return this.mainContainerContent + path;
    }
    /**
    * @type WebdriverIO.Element
    * @param index number
    */
    mainContainerContentInformationMessageByIndex(index) {
        let path = '//p[@class="informationMessage"][' + index + ']';
        return this.mainContainerContent + path;
    }
    /**
    * @type WebdriverIO.Element
    * @param text string
    */
    mainContainerContentInformationMessageByText(text) {
        let path = '//p[@class="informationMessage"]//descendant-or-self::*[text()[normalize-space()="' +
        text + '"]]/ancestor-or-self::p[@class="informationMessage"][1]';
        return this.mainContainerContent + path;
    }
    /**
    * @type WebdriverIO.Element
    * @param text string
    * @param index number
    */
    async mainContainerContentInformationMessageByTextAndIndex( text, index) {
        let path = '//p[@class="informationMessage"]//descendant-or-self::*[text()[normalize-space()="' +
        text + '"]]/ancestor-or-self::p[@class="informationMessage"][1]';
        return await (await this.mainNavigationList.$$(path))[index];
    }
    /**
    * @type string
    */
    get mainContainerContentForm() {
        let path = '//form';
        return this.mainContainerContent + path;
    }
    /**
    * @type string
    * @param index number
    */
    mainContainerContentFormByIndex(index) {
        let path = '//form[' + index + ']';
        return this.mainContainerContent + path;
    }
    /**
    * @type string
    * @param id string
    */
    mainContainerContentFormById(id) {
        let path = '//form[@id="' + id + '"]';
        return this.mainContainerContent + path;
    }
    /**
    * @type string
    * @param id string
    */
    inputById(parent, id) {
        let path = '//input[@id="' + id + '"]';
        return parent + path;
    }
    /**
    * @type string
    * @param parent WebdriverIO.Element
    * @param name string
    */
    inputByName(parent, name) {
        let path = '//input[@name="' + name + '"]';
        return parent + path;
    }
    /**
    * @type string
    * @param parent WebdriverIO.Element
    * @param type string
    */
    inputByType(parent, type) {
        let path = '//input[@type="' + type + '"]';
        return parent + path;
    }
}


