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

import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.support.web.*;

public interface PaymentEngineCreateInhouseIfcyPayment extends WebFlow<PaymentEngineCreateInhouseIfcyPayment>, StoreAccessor {
    String INVALID_ICON = "//ancestor::div[@class='x-form-field-wrap']//following-sibling::div";
    String AMOUNT = "//input[@name = 'amount']";
    String CHANNEL_ID = "//input[@name = 'channelIdent']//following-sibling::input";
    String INVALID_CHANNEL_ID = CHANNEL_ID + INVALID_ICON;
    String CURRENCY = "//input[@name = 'curr']/following-sibling::input";
    String INVALID_CURRENCY = CURRENCY + INVALID_ICON;
    String DEBTOR_ACCOUNT_PANEL = "//input[@name = 'orAccIdent']/following-sibling::img";
    String ACCOUNT_INPUT = "//input[@name = 'accIdent']";
    String SEARCH = "//button[text() = 'Hledat']";
    String SELECT = "//div[@class = 'x-grid3-row-checker']";
    String OK_BUTTON = "//div[@class='x-window-body x-border-layout-ct']//button[text() = 'OK']";
    String CREDITOR_ACCOUNT_PANEL = "//input[@name = 'cpAccIdent']/following-sibling::img";
    String VARIABLE_SYMBOL = "//input[@name = 'ceeSymbolVs']";
    String SPECIFIC_SYMBOL = "//input[@name = 'ceeSymbolSs']";
    String CONSTANT_SYMBOL = "//input[@name = 'ceeSymbolKs']";
    String IDENTIFICATION1 = "//textArea[@name = 'czOrIdent']";
    String IDENTIFICATION2 = "//textArea[@name = 'czCpIdent']";
    String MESSAGE1 = "//textArea[@name = 'cpAgentInstr']";
    String MESSAGE2 = "//textArea[@name = 'rmtInfUnstr']";
    String ICBS_PROFILE = "//input[@name = 'icbsProfile']//following-sibling::input";
    String INVALID_ICBS_PROFILE = ICBS_PROFILE + INVALID_ICON;
    String EXCHANGE_BUTTON = "//input[@name = 'virtXchgrate']/following-sibling::img";
    String ACCEPT_BUTTON = "//div[@class='x-plain-bwrap']//button[text() = 'OK']";
    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(value = CURRENCY, andWait = @Wait(value = INVALID_CURRENCY, until = Until.GONE)), @TypeInto(value = ICBS_PROFILE, andWait = @Wait(value = INVALID_ICBS_PROFILE, until = Until.GONE))})
    PaymentEngineCreateInhouseIfcyPayment fillMandatoryData(String amount, String currency, String icbsProfile);

    @TypeInto(value = CHANNEL_ID, andWait = @Wait(value = INVALID_CHANNEL_ID, until = Until.GONE))
    PaymentEngineCreateInhouseIfcyPayment fillChannelId(String channelId);

    @TypeIntos({@TypeInto(VARIABLE_SYMBOL), @TypeInto(SPECIFIC_SYMBOL), @TypeInto(CONSTANT_SYMBOL), @TypeInto(IDENTIFICATION1), @TypeInto(IDENTIFICATION2), @TypeInto(MESSAGE1), @TypeInto(MESSAGE2)})
    PaymentEngineCreateInhouseIfcyPayment fillOptionalData(String variableSymbol, String specificSymbol, String constantSymbol, String identification1, String identification2, String message1, String message2);

    @Click(value = DEBTOR_ACCOUNT_PANEL, andWait = @Wait(value = ACCOUNT_INPUT, until = Until.VISIBLE))
    PaymentEngineCreateInhouseIfcyPayment clickOnDebtorAccountPanel();

    @Click(value = CREDITOR_ACCOUNT_PANEL, andWait = @Wait(value = ACCOUNT_INPUT, until = Until.VISIBLE))
    PaymentEngineCreateInhouseIfcyPayment clickOnCreditorAccountPanel();

    @TypeInto(ACCOUNT_INPUT)
    @Click(value = SEARCH, andWait = @Wait(value = SELECT, until = Until.VISIBLE))
    PaymentEngineCreateInhouseIfcyPayment searchAccount(String account);

    @Click(value = SELECT, andWait = @Wait(value = OK_BUTTON, until = Until.CLICKABLE))
    PaymentEngineCreateInhouseIfcyPayment clickOnSelectAccount();

    @Click(value = OK_BUTTON, andWait = @Wait(value = OK_BUTTON, until = Until.GONE))
    PaymentEngineCreateInhouseIfcyPayment clickOnOk();

    @Click(value = EXCHANGE_BUTTON)
    PaymentEngineCreateInhouseIfcyPayment clickOnExchange();

    @Click(value = ACCEPT_BUTTON, andWait = @Wait(value = NO_BUTTON, until = Until.VISIBLE))
    PaymentEngineCreateInhouseIfcyPayment clickAccept();

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

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