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

import cz.moneta.test.dsl.ib.IbPageFlow;
import cz.moneta.test.dsl.newib.components.HorizontalMainMenu;
import cz.moneta.test.dsl.newib.components.VerticalMainMenu;
import cz.moneta.test.harness.support.web.*;

public interface FuturePaymentsPage extends IbPageFlow<FuturePaymentsPage>, VerticalMainMenu, HorizontalMainMenu, AccountsTabs {
    String FUTURE_ORDER_PAYMENT_XPATH = "//div[contains(@class, 't-amount') and contains(., '%s')]/ancestor::tr";
    String FUTURE_TRANSACTION_TO_ACCOUNT_XPATH = "//tr[th[contains(normalize-space(), 'Číslo účtu')]]/td//span[normalize-space()='%s']";
    String DATE_OF_PAYMENT = "//tr[th[contains(normalize-space(), 'Datum splatnosti')]]/td//span[normalize-space()='%s']";
    String VARIABLE_SYMBOL_XPATH = "//tr[th[contains(normalize-space(), 'Variabilní symbol')]]/td//span[normalize-space()='%s']";
    String CONSTANT_SYMBOL_XPATH = "//tr[th[contains(normalize-space(), 'Konstantní symbol')]]/td//span[normalize-space()='%s']";
    String SPECIFIC_SYMBOL_XPATH = "//tr[th[contains(normalize-space(), 'Specifický symbol')]]/td//span[normalize-space()='%s']";
    String MY_NOTE_XPATH = "//tr[th[contains(normalize-space(), 'Zpráva pro mě')]]/td//*[normalize-space()='%s']";
    String RECIPIENT_NOTE_XPATH = "//tr[th[contains(normalize-space(), 'Zpráva pro příjemce')]]/td//*[normalize-space()='%s']";
    String CANCEL_PAYMENT_BUTTON_XPATH = "//button[@data-testid='delete-payment-button' and text()='Zrušit platbu']";
    String CONFIRM_CANCEL_PAYMENT_BUTTON_XPATH = "//button[@data-testid='confirm-payment-delete' and text()='Zrušit']";
    String CANCEL_VICTORY_TEXT_XPATH = "//h2[contains(text(), 'Zrušení platby proběhlo v pořádku.')]";

    @Click(value = FUTURE_ORDER_PAYMENT_XPATH, isStringDynamicXpath = true,  andWait = @Wait(value = CANCEL_PAYMENT_BUTTON_XPATH, until = Until.VISIBLE))
    FuturePaymentsPage clickOnFutureOrderPayment(String amount);

    @CheckElementPresent(value = FUTURE_TRANSACTION_TO_ACCOUNT_XPATH, isStringDynamicXpath = true)
    FuturePaymentsPage checkToAccount(String toAccount);

    @CheckElementPresent(value = DATE_OF_PAYMENT, isStringDynamicXpath = true)
    FuturePaymentsPage checkDateOfPayment(String toAccount);

    @CheckElementPresent(value = VARIABLE_SYMBOL_XPATH, isStringDynamicXpath = true)
    FuturePaymentsPage checkVariableSymbol(String toAccount);

    @CheckElementPresent(value = CONSTANT_SYMBOL_XPATH, isStringDynamicXpath = true)
    FuturePaymentsPage checkConstantSymbol(String toAccount);

    @CheckElementPresent(value = SPECIFIC_SYMBOL_XPATH, isStringDynamicXpath = true)
    FuturePaymentsPage checkSpecificSymbol(String toAccount);

    @CheckElementPresent(value = RECIPIENT_NOTE_XPATH, isStringDynamicXpath = true)
    FuturePaymentsPage checkRecipientMessage(String toAccount);

    @CheckElementPresent(value = MY_NOTE_XPATH, isStringDynamicXpath = true)
    FuturePaymentsPage checkMyNote(String toAccount);

    @CheckElementPresent(value = FUTURE_ORDER_PAYMENT_XPATH, isStringDynamicXpath = true)
    FuturePaymentsPage checkFuturePaymentVisible(String amount);

    @Click(CANCEL_PAYMENT_BUTTON_XPATH)
    FuturePaymentsPage clickOnCancelPaymentButton();

    @Click(CONFIRM_CANCEL_PAYMENT_BUTTON_XPATH)
    FuturePaymentsPage clickOnConfirmCancelPaymentButton();

    @CheckElementPresent(CANCEL_VICTORY_TEXT_XPATH)
    FuturePaymentsPage checkCancelVictoryText();
}
