package cz.moneta.test.dsl.payment_engine.parts_of_menu.menu_transaction;

import cz.moneta.test.dsl.payment_engine.enums.ForeignChannelIdentities;
import cz.moneta.test.dsl.payment_engine.enums.ForeignPaymentType;
import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.support.web.*;

public interface PaymentEngineManualCreateOutgoingSctPage extends WebFlow<PaymentEngineManualCreateOutgoingSctPage>, StoreAccessor {
    String AMOUNT = "//input[@name = 'amount']";
    String DEBETOR_IBAN = "//input[@name = 'orAccIban']";
    String CREDITOR_IBAN = "//input[@name = 'cpAccIban']";
    String MESSAGE = "//label[text() = 'Zpráva']//following-sibling::div/input";
    String SELECT_PAYMENT_TYPE = "//input[@name = 'trnType']//following-sibling::img";
    String SELECT_CHANNEL_ID = "//input[@name = 'channelIdent']//following-sibling::img";
    String CHOOSEN_VALUE = "//div[text() = '%s']";
    String SUBMIT_BUTTON = "//button[text() = 'OK']";
    String EXECUTION_DATE_CALENDAR = "//input[@name = 'execDateReq']//following-sibling::img";
    String CALENDAR_TODAY = "//button[text() = 'Dnes']";
    String NO_BUTTON = "//button[text() = 'Ne']";

    String TRANSACTION_ID_KEY = "TRANSACTION_ID_KEY";
    String TRANSACTION_ID_XPATH = "//div[@class = 'ext-mb-content']/span[@class = 'ext-mb-text']";

    @TypeIntos({@TypeInto(AMOUNT), @TypeInto(DEBETOR_IBAN), @TypeInto(CREDITOR_IBAN), @TypeInto(MESSAGE)})
    PaymentEngineManualCreateOutgoingSctPage fillManualData(String amount, String debtorIban, String creditorIban, String message);

    @Click(SELECT_PAYMENT_TYPE)
    PaymentEngineManualCreateOutgoingSctPage clickOnPaymentScheme();

    @Wait(value = CHOOSEN_VALUE)
    @Click(value = CHOOSEN_VALUE)
    PaymentEngineManualCreateOutgoingSctPage selectPaymentScheme(ForeignPaymentType foreignPaymentType);

    @Click(SELECT_CHANNEL_ID)
    PaymentEngineManualCreateOutgoingSctPage clickOnChannelIdentity();

    @Wait(value = CHOOSEN_VALUE)
    @Click(value = CHOOSEN_VALUE)
    PaymentEngineManualCreateOutgoingSctPage selectChannelIdentity(ForeignChannelIdentities foreignChannelIds);

    @Click(value = SUBMIT_BUTTON, andWait = @Wait(value = TRANSACTION_ID_XPATH, until = Until.VISIBLE))
    PaymentEngineManualCreateOutgoingSctPage clickSubmit();

    @Click(value = EXECUTION_DATE_CALENDAR, andWait = @Wait(CALENDAR_TODAY))
    PaymentEngineManualCreateOutgoingSctPage clickOnExecutionDateCalendar();

    @Click(CALENDAR_TODAY)
    PaymentEngineManualCreateOutgoingSctPage chooseTodayExecution();

    @StoreElementContent(storeKey = TRANSACTION_ID_KEY, value = TRANSACTION_ID_XPATH, by = Lookup.XPATH)
    PaymentEngineManualCreateOutgoingSctPage storeTransactionId();

    @Wait(value = NO_BUTTON, until = Until.VISIBLE)
    @Click(value = NO_BUTTON, andWait = @Wait(value = NO_BUTTON, until = Until.GONE))
    PaymentEngineManualCreateOutgoingSctPage clickNo();
}
