package cz.moneta.test.dsl.ufo.banka.pages.products.current.account;

import cz.moneta.test.dsl.ufo.banka.pages.main.*;
import cz.moneta.test.dsl.ufo.banka.pages.products.current.account.transasctional.PKU005_S010_PostedTransactionsPage;
import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.endpoints.ufo.UfoEndpoint;
import cz.moneta.test.harness.support.web.*;

import static cz.moneta.test.dsl.ufo.banka.pages.products.current.account.HPO001_S001_CurrentAccountDetailsPage.HPO001_S001_PAGE_LABEL_XPATH;

@Wait(value = HPO001_S001_PAGE_LABEL_XPATH, by = Lookup.XPATH)
@Wait(value = HPO001_S001_CurrentAccountDetailsPage.TRANSACTION_MENU_DIV, waitSecondsForElement = 90)
public interface HPO001_S001_CurrentAccountDetailsPage extends WebFlow<HPO001_S001_CurrentAccountDetailsPage>, StoreAccessor {

    String BACK_TO_CLIENT_BUTTON = "HPO001_S001_S014";
    String HPO001_S001_PAGE_LABEL_XPATH = "//div[text()='HPO001_S001']";
    String TRANSACTION_MENU_DIV = "HPO001_S001_I001";
    String CREATE_PAYMENT_ORDER_DIV = "HPO001_S001_B027";
    String CREATE_DIRECT_DEBIT_DIV = "HPO001_S001_B016";
    String CREATE_STANDING_ORDER_DIV = "HPO001_S001_B010";
    String LIST_OF_STANDING_ORDERS_DIV = "HPO001_S001_B015";
    String CREATE_SIPO_PAYMENT_DIV = "HPO001_S001_B018";
    String CREATE_FOREIGN_PAYMENT = "HPO001_S001_B020";
    String TRANSACTIONS = "HPO001_S001_I012";
    String POSTED = "HPO001_S001_B013";
    String DISPO_BALANCE = "HPO001_S001_L001";
    String DISPO_BALANCE_KEY = "DISPO_BALANCE_KEY";
    String ACC_BALANCE = "HPO001_S001_L002";
    String ACC_BALANCE_KEY = "ACC_BALANCE_KEY";
    String ACC_CURRENCY = "HPO001_S001_L015";
    String PRODUCT_LABEL = "HPO001_S001_L017";
    String OPENING_DATE_LABEL = "HPO001_S001_L019";
    String PAYMENT_METHOD_LABEL = "HPO001_S001_L013";

    @Click(TRANSACTION_MENU_DIV)
    @Click(CREATE_PAYMENT_ORDER_DIV)
    PKU001_S002_CreatePaymentOrderPage openCreatePaymentOrderPage();

    @Click(TRANSACTION_MENU_DIV)
    @Click(CREATE_DIRECT_DEBIT_DIV)
    INK001_S002_ListOfAuthorizationForDirectDebitsPage openListOfDirectDebitsPage();

    @Click(TRANSACTION_MENU_DIV)
    @Click(CREATE_STANDING_ORDER_DIV)
    TRP001_S004_CreateNewStandingOrderPage openCreateStandingOrderPage();

    @Click(TRANSACTION_MENU_DIV)
    @Click(LIST_OF_STANDING_ORDERS_DIV)
    TRP001_S002_ListOfStandingOrdersPage openListOfStandingOrdersPage();

    @Click(TRANSACTION_MENU_DIV)
    @Click(CREATE_FOREIGN_PAYMENT)
    ZPL006_S002_ListOfForeignPaymentsPage openListOfForeignPaymentsPage();

    @Click(TRANSACTION_MENU_DIV)
    @Click(CREATE_SIPO_PAYMENT_DIV)
    SIP001_S002_ListOfSIPOPayments openListOfSIPOPayments();

    @CustomAction
    default PKU005_S010_PostedTransactionsPage openPostedTransactions() {
        UfoEndpoint endpoint = getEndpoint(UfoEndpoint.class);
        endpoint.moveToElementAndClickToOtherElement(TRANSACTIONS, POSTED);
        return null;
    }

    @Click(BACK_TO_CLIENT_BUTTON)
    HKO101_S001_MainClientPage clickBackToClient();

    @Click(DISPO_BALANCE)
    HPO001_S001_CurrentAccountDetailsPage assertAccountBalance(String balance);

    @Click(ACC_CURRENCY)
    HPO001_S001_CurrentAccountDetailsPage assertAccountCurrency(String currency);

    @Click(PRODUCT_LABEL)
    HPO001_S001_CurrentAccountDetailsPage assertProduct(String product);

    @Click(OPENING_DATE_LABEL)
    HPO001_S001_CurrentAccountDetailsPage assertAccountOpeningDate(String date);

    @Click(PAYMENT_METHOD_LABEL)
    HPO001_S001_CurrentAccountDetailsPage assertPaymentMethod(String feePlan);

    @StoreElementContent(value = DISPO_BALANCE, storeKey = DISPO_BALANCE_KEY)
    HPO001_S001_CurrentAccountDetailsPage storeDispoBalance();

    @StoreElementContent(value = ACC_BALANCE, storeKey = ACC_BALANCE_KEY)
    HPO001_S001_CurrentAccountDetailsPage storeAccBalance();
}
