package cz.moneta.test.dsl.auto.smartauto.df;

import cz.moneta.test.dsl.auto.smartauto.SmartAutoFlow;
import cz.moneta.test.harness.support.web.CheckElementPresent;
import cz.moneta.test.harness.support.web.CheckElementsPresent;
import cz.moneta.test.harness.support.web.Wait;

import static cz.moneta.test.dsl.auto.smartauto.shared.CommonElements.ACTIVE_FILTERS_BUTTON;
import static cz.moneta.test.dsl.auto.smartauto.shared.CommonElements.COLUMNS_BUTTON;
import static cz.moneta.test.dsl.auto.smartauto.shared.CommonElements.DF_MENU_DASHBOARD;
import static cz.moneta.test.dsl.auto.smartauto.shared.CommonElements.DF_MENU_FINANCING;
import static cz.moneta.test.dsl.auto.smartauto.shared.CommonElements.DF_MENU_INVOICES;
import static cz.moneta.test.dsl.auto.smartauto.shared.CommonElements.DF_MENU_MESSAGES;
import static cz.moneta.test.dsl.auto.smartauto.shared.CommonElements.EXPORT_BUTTON;
import static cz.moneta.test.dsl.auto.smartauto.shared.CommonElements.NEXT_PAGE_BUTTON;
import static cz.moneta.test.dsl.auto.smartauto.shared.CommonElements.PREVIOUS_PAGE_BUTTON;
import static cz.moneta.test.dsl.auto.smartauto.shared.CommonElements.SORT_ACTIVITY_BUTTON;

@Wait(value = {DF_MENU_DASHBOARD, DF_MENU_FINANCING, DF_MENU_INVOICES, DF_MENU_MESSAGES}, waitSecondsForElement = 40)
public interface DashboardPage extends SmartAutoFlow<DashboardPage> {

    String CURRENT_INTEREST_RATE_TEXT = "//strong[contains(text(), 'Aktuální úroková sazba')]";
    String TOTAL_LIMIT_TEXT = "//span[contains(text(), 'Limit')]";
    String TOTAL_DEPLETED_TEXT = "//span[contains(text(), 'Vyčerpáno')]";
    String TOTAL_AVAILABLE_LIMIT_TEXT = "//span[contains(text(), 'Volný limit')]";
    String FOR_PAYMENT_TEXT = "//span[contains(text(), 'K úhradě')]";
    String OVERDUE_PAYMENT_TEXT = "//span[contains(text(), 'Z toho po splatnosti')]";
    String PRODUCT_LIST_TITLE = "//h6[contains(text(), 'Produkty')]";
    String ALL_CONTRACT_BUTTON = "//span[contains(text(), 'Všechny zakázky')]";

    @CheckElementsPresent(value = {
            @CheckElementPresent(CURRENT_INTEREST_RATE_TEXT),
            @CheckElementPresent(TOTAL_LIMIT_TEXT),
            @CheckElementPresent(TOTAL_DEPLETED_TEXT),
            @CheckElementPresent(TOTAL_AVAILABLE_LIMIT_TEXT),
            @CheckElementPresent(FOR_PAYMENT_TEXT),
            @CheckElementPresent(OVERDUE_PAYMENT_TEXT),
            })
    DashboardPage checkDashboardTexts();

    @CheckElementsPresent(value = {
            @CheckElementPresent(PRODUCT_LIST_TITLE)})
    DashboardPage checkDashboardTitles();

    @CheckElementsPresent(value = {
            @CheckElementPresent(ALL_CONTRACT_BUTTON),
            @CheckElementPresent(ACTIVE_FILTERS_BUTTON),
            @CheckElementPresent(SORT_ACTIVITY_BUTTON),
            @CheckElementPresent(COLUMNS_BUTTON),
            @CheckElementPresent(EXPORT_BUTTON),
            @CheckElementPresent(PREVIOUS_PAGE_BUTTON),
            @CheckElementPresent(NEXT_PAGE_BUTTON)})
    DashboardPage checkDashboardButtons();
}