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.NewForeignPaymentSummaryPage.*;

@Wait(value = {TITLE_SUMMARY_PAGE_XPATH, EDIT_BUTTON_XPATH}, waitSecondsForElement = 60)
public interface NewForeignPaymentSummaryPage extends NewIbPageFlow<NewForeignPaymentSummaryPage>, 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 TO_ACCOUNT_XPATH = "//tr[.//span[text()='Na účet']]//td//span[text()='%s']";
    String AMOUNT_XPATH = "//tr[.//span[text()='Částka']]//td//div[contains(text(),'%s')]";
    String CURRENCY_XPATH = "//tr[.//span[text()='Částka']]//td//span[contains(normalize-space(),'%s')]";
    String TYPE_OF_CHARGE_XPATH = "//tr[.//span[text()='Typ poplatku']]//td//span[contains(normalize-space(),'%s')]";
    String BANK_CODE_BIC_XPATH = "//tr[.//span[text()='Kód banky BIC (SWIFT)']]//td//span[text()='%s']";
    String BANK_COUNTRY_XPATH = "//tr[.//span[text()='Země banky']]//td//span[text()='%s']";
    String NAME_ADDRESS_OF_BANK_XPATH = "//tr[.//span[text()='Jméno a adresa banky']]//td//div[starts-with(normalize-space(), '%s')]";
    String RECIPIENT_NAME_XPATH = "//tr[.//span[text()='Jméno příjemce']]//td//div[starts-with(normalize-space(), '%s')]";
    String RECIPIENT_COUNTRY_XPATH = "//tr[.//span[text()='Země příjemce']]//td//span[@data-testid='TextComponent' and text()='%s']";
    String RECIPIENT_MESSAGE_XPATH = "//tr[.//span[text()='Zpráva pro příjemce']]//td//div[@data-testid='TextComponent' and text()='%s']";
    String PAYMENT_CONFIRMATION_EMAIL_XPATH = "//tr[.//span[text()='Poslat potvrzení o platbě na e-mail']]//td//span[@data-testid='TextComponent' and text()='%s']";
    String OVER_LIMIT_ALERT_XPATH = "//p[.//small[contains(text(), 'Zadaná částka překračuje Váš %s limit pro platby')]]";
    String FEE_FOREIGN_PRIORITY_PAYMENT_SUMMARY_XPATH = "//tr[.//th//span[text()='Poplatek za prioritní platbu'] and .//td//div[contains(., '%s')] and .//td//span[contains(., 'CZK')]]";
    String FEE_TYPE_XPATH = "//tr[.//th//span[text()='Typ poplatku'] and .//td//span[contains(., '%s')]]";

    @Click(CONFIRM_BUTTON_XPATH)
    NewForeignPaymentSummaryPage clickOnConfirm();

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

    @CheckElementPresent(value = CURRENCY_XPATH, isStringDynamicXpath = true)
    NewForeignPaymentSummaryPage checkCurrency(String currency);

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

    @CheckElementPresent(value = TYPE_OF_CHARGE_XPATH, isStringDynamicXpath = true)
    NewForeignPaymentSummaryPage checkTypeOfCharge(String typeOfCharge);

    @CheckElementPresent(value = BANK_CODE_BIC_XPATH, isStringDynamicXpath = true)
    NewForeignPaymentSummaryPage checkBankCode(String bankCode);

    @CheckElementPresent(value = BANK_COUNTRY_XPATH, isStringDynamicXpath = true)
    NewForeignPaymentSummaryPage checkBankCountry(String bankCountry);

    @CheckElementPresent(value = NAME_ADDRESS_OF_BANK_XPATH, isStringDynamicXpath = true)
    NewForeignPaymentSummaryPage checkNameAddressOfBank(String nameAddressOfBank);

    @CheckElementPresent(value = RECIPIENT_NAME_XPATH, isStringDynamicXpath = true)
    NewForeignPaymentSummaryPage checkRecipientName(String recipientName);

    @CheckElementPresent(value = RECIPIENT_COUNTRY_XPATH, isStringDynamicXpath = true)
    NewForeignPaymentSummaryPage checkRecipientCountry(String recipientCountry);

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

    @CheckElementPresent(value = PAYMENT_CONFIRMATION_EMAIL_XPATH, isStringDynamicXpath = true)
    NewForeignPaymentSummaryPage checkConfirmationEmail(String confirmationEmail);

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

    @Click(MOBILE_KEY_SEND_BTN_XPATH)
    NewForeignPaymentVictoryPage clickOnContinueMobileKey();

    @CheckElementPresent(value = OVER_LIMIT_ALERT_XPATH, isStringDynamicXpath = true)
    NewForeignPaymentSummaryPage checkAlertOverLimit(String limit);

    @CheckElementPresent(value = FEE_FOREIGN_PRIORITY_PAYMENT_SUMMARY_XPATH, isStringDynamicXpath = true)
    NewForeignPaymentSummaryPage checkFeeForeignPriorityPaymentSummary(String feeForeignPriorityPaymentSummary);

    @CheckElementPresent(value = FEE_TYPE_XPATH, isStringDynamicXpath = true)
    NewForeignPaymentSummaryPage checkFeeType(String feeType);

    @Click(EDIT_BUTTON_XPATH)
    NewForeignPaymentPage clickOnEdit();
}