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

import cz.moneta.test.dsl.payment_engine.home.PaymentEngineHomePage;
import cz.moneta.test.harness.support.web.*;

public interface PaymentEngineClientsStandingOrderCZ extends WebFlow<PaymentEngineClientsStandingOrderCZ> {
    String PREFIX = "//div[@id='Trvalé příkazy / Nový trvalý příkaz CZ']";
    String NAME = PREFIX + "//input[@type='text' and @name='name']";
    String DESCRIPTION = PREFIX + "//input[@type='text' and @name='description']";
    String TRANSACTION_TYPE = PREFIX + "//input[@name='stordTrnTypeId']/following-sibling::input";
    String AMOUNT = PREFIX + "//input[@type='text' and @name='amount']";
    String BRANCH_CODE = PREFIX + "//input[@type='text' and @name='gembOrBranchCode']";
    String VARIABLE_SYMBOL = PREFIX + "//input[@name = 'ceeSymbolVs']";
    String SPECIFIC_SYMBOL = PREFIX + "//input[@name = 'ceeSymbolSs']";
    String CONSTANT_SYMBOL = PREFIX + "//input[@name = 'ceeSymbolKs']";
    String DEBTOR_ACC_PANEL = PREFIX + "//input[@name = 'orAccIdent']/following-sibling::img";
    String ACC_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_ACC_PANEL = PREFIX + "//input[@name = 'cpAccIdent']/following-sibling::img";
    String IDENTIFICATION = PREFIX + "//textArea[@name = 'czCpIdent']";
    String MESSAGE1 = PREFIX + "//textArea[@name = 'cpAgentInstr']";
    String MESSAGE2 = PREFIX + "//textArea[@name = 'rmtInfUnstr']";
    String PERIOD = PREFIX + "//input[@name = 'period']/following-sibling::input";
    String DAY_MONTH = PREFIX + "//input[@name='dayMonth']";
    String ACCEPT_BUTTON = "//button[@type='submit']";
    String START_DATE_BUTTON = "//label[text() = 'Počáteční datum']//following-sibling::div[@class='x-form-element']//img";
    String START_DATE_VALUE = "//td[@title='Dnes']//following-sibling::td[1]/a";
    String AJAX_LOADING = "//div[text()='Načítám...']";

    @TypeIntos({@TypeInto(TRANSACTION_TYPE), @TypeInto(AMOUNT), @TypeInto(PERIOD), @TypeInto(DAY_MONTH)})
    PaymentEngineClientsStandingOrderCZ fillMandatoryData(String transactionType, String amount, String period, String dayMonth);

    @TypeIntos({@TypeInto(NAME), @TypeInto(DESCRIPTION), @TypeInto(BRANCH_CODE), @TypeInto(VARIABLE_SYMBOL), @TypeInto(SPECIFIC_SYMBOL), @TypeInto(CONSTANT_SYMBOL), @TypeInto(IDENTIFICATION), @TypeInto(MESSAGE1), @TypeInto(MESSAGE2)})
    PaymentEngineClientsStandingOrderCZ fillOptionalData(String name, String description, String branchCode, String variableSymbol, String specificSymbol, String constantSymbol, String identification, String message1, String message2);

    @Click(value = DEBTOR_ACC_PANEL, andWait = @Wait(value = ACC_INPUT, until = Until.VISIBLE))
    PaymentEngineClientsStandingOrderCZ clickOnDebtorPanel();

    @Click(value = CREDITOR_ACC_PANEL, andWait = @Wait(value = ACC_INPUT, until = Until.VISIBLE))
    PaymentEngineClientsStandingOrderCZ clickOnCreditorPanel();

    @TypeInto(ACC_INPUT)
    @Click(value = SEARCH, andWait = @Wait(value = AJAX_LOADING, until = Until.GONE))
    PaymentEngineClientsStandingOrderCZ searchAccount(String account);

    @Click(SELECT)
    PaymentEngineClientsStandingOrderCZ clickOnSelectAccount();

    @Click(value = OK_BUTTON, andWait = @Wait(value = OK_BUTTON, until = Until.GONE))
    PaymentEngineClientsStandingOrderCZ selectAccount();

    @Click(START_DATE_BUTTON)
    PaymentEngineClientsStandingOrderCZ clickOnStartDate();

    @Wait(value = START_DATE_VALUE, until = Until.VISIBLE)
    @Click(START_DATE_VALUE)
    PaymentEngineClientsStandingOrderCZ chooseStartDate();

    @Click(value = ACCEPT_BUTTON, andWait = @Wait(value = ACCEPT_BUTTON, until = Until.GONE))
    PaymentEngineHomePage clickAccept();
}
