package cz.moneta.test.dsl.newib.payments;

import cz.moneta.test.dsl.newib.NewIbPageFlow;
import cz.moneta.test.harness.support.web.CheckElementPresent;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.TypeInto;

public interface AdvicePage extends NewIbPageFlow<AdvicePage> {
    String PAYMENT_REFERENCE_XPATH = "//p[@class='u-colorSecondary' and text()='Reference platby, datum a typ platby']";
    String AMOUNT_XPATH = "//p[@class='u-colorSecondary' and text()=' Částka']";
    String PREVIEW_OF_ADVICE_XPATH = "//tr[@class='c-contentTableRow c-contentTableRow--clickable']";
    String TITLE_ADVICE_XPATH = "//h1[@class='t-title t-title--h3 u-mb--0' and text()='Avízo k zahraniční platbě']";
    String DOWNLOAD_BUTTON_XPATH = "//button[@aria-label='Stáhnout']";
    String PRINT_BUTTON_XPATH = "//button[@aria-label='Vytisknout']";
    String CLOSE_BUTTON_XPATH = "//button[@aria-label='Zavřít']";
    String FILTER_DATE_FROM_XPATH = "//input[@id='dateFrom']";
    String FILTER_DATE_TO_XPATH = "//input[@id='dateTo']";
    String SHOW_MORE_ADVICES_BUTTON_XPATH = "//button[@data-testid='show-more-advices-btn']";
    String GRAPHS_TAB_XPATH = "//span[@data-testid='graphs-tab' and text()='Grafy']";
    String PLANNED_TAB_XPATH = "//span[@data-testid='planned-tab' and text()='Budoucí platby']";
    String STATEMENTS_TAB_XPATH = "//span[@data-testid='statements-tab' and text()='Výpisy']";
    String HISTORY_TAB_XPATH = "//span[@data-testid='history-tab' and text()='Historie']";
    String ADVANCED_SEARCH_XPATH = "//button[@data-testid='advanced-search']";
    String PAYMENT_TYPE_XPATH = "//button[@id='paymentType_button']";
    String PAYMENT_TYPE_OPTION_XPATH = "//div[@class='c-dropdown__itemContent' and text()='%s']";
    String ADVANCED_FILTER_SEARCH_BUTTON_XPATH = "//button[@data-testid='advanced-filter-search' and text()='Hledat']";
    String TRANSACTION_XPATH = "//h2[@class='t-title t-title--h6 c-contentTableRow__title' and text()='%s']";
    String ADVICE_BUTTON_XPATH = "//button[@class='c-btn c-btn--small c-btn--border c-btn--primary' and normalize-space()='Avízo']";

    @CheckElementPresent(PAYMENT_REFERENCE_XPATH)
    AdvicePage checkPaymentReference();

    @CheckElementPresent(AMOUNT_XPATH)
    AdvicePage checkAmount();

    @Click(PREVIEW_OF_ADVICE_XPATH)
    AdvicePage clickOnPreviewOfAdvice();

    @CheckElementPresent(TITLE_ADVICE_XPATH)
    AdvicePage checkTitleAdvice();

    @CheckElementPresent(DOWNLOAD_BUTTON_XPATH)
    AdvicePage checkDownloadButton();

    @CheckElementPresent(PRINT_BUTTON_XPATH)
    AdvicePage checkPrintButton();

    @Click(CLOSE_BUTTON_XPATH)
    AdvicePage clickOnCloseButton();

    @TypeInto(FILTER_DATE_FROM_XPATH)
    AdvicePage fillInDate(String date);

    @TypeInto(FILTER_DATE_TO_XPATH)
    AdvicePage fillToDate(String date);

    @Click(SHOW_MORE_ADVICES_BUTTON_XPATH)
    AdvicePage clickOnShowMoreAdvices();

    @Click(GRAPHS_TAB_XPATH)
    AdvicePage clickOnGraphsTab();

    @Click(PLANNED_TAB_XPATH)
    AdvicePage clickOnPlannedTab();

    @Click(STATEMENTS_TAB_XPATH)
    AdvicePage clickOnStatementsTab();

    @Click(HISTORY_TAB_XPATH)
    AdvicePage clickOnHistoryTab();

    @Click(ADVANCED_SEARCH_XPATH)
    AdvicePage clickOnAdvancedSearch();

    @Click(PAYMENT_TYPE_XPATH)
    AdvicePage clickOnPaymentType();

    @Click(value = PAYMENT_TYPE_OPTION_XPATH, isStringDynamicXpath = true)
    AdvicePage clickPaymentTypeOption(String paymentType);

    @Click(ADVANCED_FILTER_SEARCH_BUTTON_XPATH)
    AdvicePage clickOnAdvancedFilterSearchButton();

    @Click(value = TRANSACTION_XPATH, isStringDynamicXpath = true)
    AdvicePage clickOnTransaction(String transaction);

    @Click(ADVICE_BUTTON_XPATH)
    AdvicePage clickOnAdviceButton();
}