package cz.moneta.test.dsl.salesforce.components;

import cz.moneta.test.harness.support.web.Builder;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.Until;
import cz.moneta.test.harness.support.web.Wait;

public interface PageHeader extends Builder {
    //Search section
    String SEARCH_INPUT_DIV = "//div[@data-aura-class='forceSearchInputDesktop']";
    String SEARCH_INPUT = "(//div[@class='forceSearchAssistantDialog']//input)[2]";
    String SEARCH_BUTTON = "//div[contains(@class,'global-header__item_search')]//button";
    String SEARCH_AUTOCOMPLETE = SEARCH_INPUT_DIV + "//div[@data-aura-class='uiAbstractList uiAutocompleteList']";
    String SEARCH_AUTOCOMPLETE_ITEM = SEARCH_AUTOCOMPLETE + "//li[contains(.,'\"%s\"')]";
    String USER_PROFILE_LINK = "//span[contains(@class,'UserProfile')]//button";
    String USER_PROFILE = "//h1[contains(@class,'profile-card-name')]/a";
    String USER_LOGOUT = "//a[text()='Log Out']";

    //Navigation section
    String HOME_LINK = "//one-app-nav-bar-item-root[@data-id='home']";
    String ACCOUNTS_LINK = "//one-app-nav-bar-item-root[@data-id='Account']";
    String ACOUNTS_CHEVRONDOWN = ACCOUNTS_LINK + "//one-app-nav-bar-menu-button";
    String ACCOUNT_ALL_ACCOUNTS_LINK = ACCOUNTS_LINK + "//one-app-nav-bar-menu-item[contains(.,'Všechny subjekty')]";

    @Click(value = USER_PROFILE_LINK, andWait = @Wait(value = USER_LOGOUT, explicitWaitSeconds = 1, until = Until.VISIBLE))
    @Click(value = USER_LOGOUT, andWait = @Wait(explicitWaitSeconds = 1))
    void logoutUser();
}
