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

import cz.moneta.test.dsl.newib.NewIbPageFlow;
import cz.moneta.test.dsl.newib.components.HorizontalMainMenu;
import cz.moneta.test.dsl.newib.components.VerticalMainMenu;
import cz.moneta.test.harness.support.web.CheckElementPresent;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.TypeInto;
import cz.moneta.test.harness.support.web.Wait;

import static cz.moneta.test.dsl.newib.payments.StandingOrderSummaryPage.*;

@Wait(value = {TITLE_SUMMARY_PAGE_XPATH, EDIT_BUTTON_XPATH, CONFIRM_BUTTON_XPATH}, waitSecondsForElement = 30)
public interface StandingOrderSummaryPage extends NewIbPageFlow<StandingOrderSummaryPage>, VerticalMainMenu, HorizontalMainMenu {
    String TITLE_SUMMARY_PAGE_XPATH = "//h1[@class='t-title t-title--h3'][text()='Souhrn']";
    String EDIT_BUTTON_XPATH = "//button[@data-testid='back']";
    String CONFIRM_BUTTON_XPATH = "//button[@data-testid='submit']";
    String MOBILE_KEY_INPUT_XPATH = "//label[@for='mobileKey']//following-sibling::div//input[@id='mobileKey']";
    String MOBILE_KEY_SEND_BTN_XPATH = "//button[@data-testid='secondFactorSend']";
    String FROM_ACCOUNT_XPATH = "//tr[.//th[normalize-space()='Z účtu']]//td//span[contains(text(), '%s')]";
    String TO_ACCOUNT_XPATH = "//tr[.//th[normalize-space()='Na účet']]//td//span[contains(text(), '%s')]";
    String NAME_OF_THE_STANDING_ORDER_XPATH = "//tr[.//th[normalize-space()='Název trvalého příkazu']]//td//span[contains(text(), '%s')]";
    String AMOUNT_XPATH = "//tr[.//th[normalize-space()='Částka']]//td//span[contains(text(), '%s')]";
    String DATE_OF_FIRST_PAYMENT_XPATH = "//tr[.//th[normalize-space()='Datum první platby']]//td//span[contains(text(), '%s')]";
    String DATE_OF_LAST_PAYMENT_XPATH = "//tr[.//th[normalize-space()='Datum ukončení']]//td//span[contains(text(), '%s')]";
    String FREQUENCY_XPATH = "//tr[.//th[normalize-space()='Frekvence']]//td//span[contains(text(), '%s')]";
    String VARIABLE_SYMBOL_XPATH = "//tr[.//th[normalize-space()='Variabilní symbol']]//td//span[contains(text(), '%s')]";
    String CONSTANT_SYMBOL_XPATH = "//tr[.//th[normalize-space()='Konstantní symbol']]//td//span[contains(text(), '%s')]";
    String SPECIFIC_SYMBOL_XPATH = "//tr[.//th[normalize-space()='Specifický symbol']]//td//span[contains(text(), '%s')]";
    String RECIPIENT_MESSAGE_XPATH = "//tr[.//th[normalize-space()='Zpráva pro příjemce']]//td//span[contains(text(), '%s')]";

    @Click(CONFIRM_BUTTON_XPATH)
    StandingOrderSummaryPage clickOnConfirm();

    @CheckElementPresent(value = FROM_ACCOUNT_XPATH, isStringDynamicXpath = true)
    StandingOrderSummaryPage checkFromAccount(String fromAccount);

    @CheckElementPresent(value = TO_ACCOUNT_XPATH, isStringDynamicXpath = true)
    StandingOrderSummaryPage checkToAccount(String toAccount);

    @CheckElementPresent(value = NAME_OF_THE_STANDING_ORDER_XPATH, isStringDynamicXpath = true)
    StandingOrderSummaryPage checkNameOfTheStandingOrder(String nameOfTheStandingOrder);

    @CheckElementPresent(value = AMOUNT_XPATH, isStringDynamicXpath = true)
    StandingOrderSummaryPage checkAmount(String amount);

    @CheckElementPresent(value = DATE_OF_FIRST_PAYMENT_XPATH, isStringDynamicXpath = true)
    StandingOrderSummaryPage checkDateOfFirstPayment(String dateOfFirstPayment);

    @CheckElementPresent(value = DATE_OF_LAST_PAYMENT_XPATH, isStringDynamicXpath = true)
    StandingOrderSummaryPage checkDateOfLastPayment(String dateOfLastPayment);

    @CheckElementPresent(value = FREQUENCY_XPATH, isStringDynamicXpath = true)
    StandingOrderSummaryPage checkFrequency(String frequency);

    @CheckElementPresent(value = VARIABLE_SYMBOL_XPATH, isStringDynamicXpath = true)
    StandingOrderSummaryPage checkVariableSymbol(String variableSymbol);

    @CheckElementPresent(value = CONSTANT_SYMBOL_XPATH, isStringDynamicXpath = true)
    StandingOrderSummaryPage checkConstantSymbol(String constantSymbol);

    @CheckElementPresent(value = SPECIFIC_SYMBOL_XPATH, isStringDynamicXpath = true)
    StandingOrderSummaryPage checkSpecificSymbol(String specificSymbol);

    @CheckElementPresent(value = RECIPIENT_MESSAGE_XPATH, isStringDynamicXpath = true)
    StandingOrderSummaryPage checkRecipientMessage(String recipientMessage);

    @TypeInto(MOBILE_KEY_INPUT_XPATH)
    StandingOrderSummaryPage setMobileKey(String mobileKey);

    @Click(MOBILE_KEY_SEND_BTN_XPATH)
    StandingOrderVictoryPage clickOnContinueMobileKey();
}
