package cz.moneta.test.dsl.ufo.banka.pages.term.deposit;

import cz.moneta.test.dsl.ufo.banka.pages.products.debit.card.SIF004_S001_ContactSettingsForSendingEmailsPage;
import cz.moneta.test.harness.support.web.*;

import static cz.moneta.test.dsl.ufo.banka.pages.term.deposit.RTV001_S001_TermDepositPage.*;
import static cz.moneta.test.dsl.ufo.operations.shared.SharedElements.LOAD_IMG_DIV_CLASS;

@Wait(value = RTV001_S001_PAGE_LABEL_XPATH, by = Lookup.XPATH, waitSecondsForElement = 60)
@Wait(SEND_BUTTON)
public interface RTV001_S001_TermDepositPage extends WebFlow<RTV001_S001_TermDepositPage> {
    String RTV001_S001_PAGE_LABEL_XPATH = "//div[text()='RTV001_S001']";

    String SEND_BUTTON = "RTV001_S001_B001";

    String PRODUCT_SELECT = "RTV001_S001_C001";
    String DEPOSIT_ACCOUNT_SELECT = "RTV001_S001_C002";
    String FIRST_DEPOSIT_ACCOUNT_XPATH_SELECT = "//*[@id='RTV001_S001_C002']/option[2]";
    String INTEREST_ACCOUNT_SELECT = "RTV001_S001_C003";
    String FIRST_INTEREST_ACCOUNT_XPATH_SELECT = "//*[@id='RTV001_S001_C003']/option[2]";
    String STATEMENT_PERIODICITY_SELECT = "RTV001_S001_C006";
    String STATEMENT_DISTRIBUTION_SELECT = "RTV001_S001_C007";
    String CORRESPONDENCE_ADDRESS_SELECT = "RTV001_S001_C008";
    String ACCOUNT_WHEN_FOUNDED_SELECT = "RTV001_S001_C009";
    String FIRST_ACCOUNT_WHEN_FOUNDED_XPATH_SELECT = "//*[@id='RTV001_S001_C009']/option[2]";
    String PERIOD_SELECT = "RTV001_S001_C020";

    String INITIAL_AMOUNT_INPUT = "RTV001_S001_E001";

    @Select(value = PRODUCT_SELECT, andWait = @Wait(value = LOAD_IMG_DIV_CLASS, by = Lookup.CLASSNAME, until = Until.GONE, waitSecondsForElement = 80))
    RTV001_S001_TermDepositPage selectProduct(String termDepositProduct);

    @TypeInto(INITIAL_AMOUNT_INPUT)
    RTV001_S001_TermDepositPage fillInitialAmount(String initialAmount);

    @Select(value = PERIOD_SELECT, andWait = @Wait(value = LOAD_IMG_DIV_CLASS, by = Lookup.CLASSNAME, until = Until.GONE, waitSecondsForElement = 80))
    RTV001_S001_TermDepositPage selectPeriod(String termDepositPeriod);

    @Click(ACCOUNT_WHEN_FOUNDED_SELECT)
    @Click(value = FIRST_ACCOUNT_WHEN_FOUNDED_XPATH_SELECT, by = Lookup.XPATH, andWait = @Wait(value = LOAD_IMG_DIV_CLASS, by = Lookup.CLASSNAME, until = Until.GONE, waitSecondsForElement = 80))
    RTV001_S001_TermDepositPage selectFirstAccountWhenFounded();

    @Click(DEPOSIT_ACCOUNT_SELECT)
    @Click(value = FIRST_DEPOSIT_ACCOUNT_XPATH_SELECT, by = Lookup.XPATH)
    RTV001_S001_TermDepositPage selectFirstDepositAccount();

    @Click(INTEREST_ACCOUNT_SELECT)
    @Click(value = FIRST_INTEREST_ACCOUNT_XPATH_SELECT, by = Lookup.XPATH)
    RTV001_S001_TermDepositPage selectFirstInterestAccount();

    @Select(value = STATEMENT_DISTRIBUTION_SELECT, andWait = @Wait(value = LOAD_IMG_DIV_CLASS, by = Lookup.CLASSNAME, until = Until.GONE, waitSecondsForElement = 60))
    RTV001_S001_TermDepositPage selectStatementDistribution(String statementDistribution);

    @Select(STATEMENT_PERIODICITY_SELECT)
    RTV001_S001_TermDepositPage selectStatementPeriodicity(String statementPeriodicity);

    @Select(CORRESPONDENCE_ADDRESS_SELECT)
    RTV001_S001_TermDepositPage selectCorrespondenceAddress(String correspondenceAddress);

    @Click(SEND_BUTTON)
    SIF004_S001_ContactSettingsForSendingEmailsPage clickSendToContactSettingsForSendingEmailsPage();
}
