package cz.moneta.test.dsl.monetaportal.more;

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

import static cz.moneta.test.dsl.monetaportal.more.ExchangeRatesPage.EXCHANGE_RATES_TABLE;

@Wait(EXCHANGE_RATES_TABLE)
public interface ExchangeRatesPage extends WebFlow<ExchangeRatesPage> {
    //Exchange rates
    String EXCHANGE_RATES_DIV = "//div[contains(@id, 'ExchangeRates')]";
    String EXCHANGE_RATES_FROM_INPUT = "(" + EXCHANGE_RATES_DIV + "//input[@type='tel'])[1]";
    String EXCHANGE_RATES_TO_INPUT = "(" + EXCHANGE_RATES_DIV + "//input[@type='tel'])[2]";
    String EXCHANGE_RATES_FROM_CURRENCY_SELECT = "(" + EXCHANGE_RATES_DIV + "//select)[1]";
    String EXCHANGE_RATES_TO_CURRENCY_SELECT = "(" + EXCHANGE_RATES_DIV + "//select)[2]";
    String EXCHANGE_RATES_TABLE = EXCHANGE_RATES_DIV + "//section[contains(@id, 'portlet_ExchangeRatesTable_INSTANCE_')]//div[contains(@class, 'Tabs__ContentWrapper-')]";

    @CheckElementPresent(EXCHANGE_RATES_TABLE)
    ExchangeRatesPage checkExchangeRatesTable();

    @TypeInto(value = EXCHANGE_RATES_FROM_INPUT, clear = true)
    ExchangeRatesPage fillEchangeRatesAmount(String amount);

    @Select(EXCHANGE_RATES_FROM_CURRENCY_SELECT)
    ExchangeRatesPage selectExchangeRatesCurrencyFrom(String currency);

    @Select(EXCHANGE_RATES_TO_CURRENCY_SELECT)
    ExchangeRatesPage selectExchangeRatesCurrencyTo(String currency);
}