package cz.moneta.test.dsl.newib.payments;

import cz.moneta.test.dsl.newib.NewIbPageFlow;
import cz.moneta.test.harness.support.web.*;

import static cz.moneta.test.dsl.newib.payments.SipoOrderPage.*;

@Wait(value = {SIPO_NUMBER_INPUT_XPATH, SIPO_LIMIT_INPUT_XPATH, END_DATE_INPUT_XPATH}, waitSecondsForElement = 30)
public interface SipoOrderPage extends NewIbPageFlow<SipoOrderPage> {
    String SIPO_NUMBER_INPUT_XPATH = "//input[@id='sipoNumber']";
    String SIPO_LIMIT_INPUT_XPATH = "//input[@id='amountLimit']";
    String END_DATE_INPUT_XPATH = "//input[@id='endDate']";
    String CONTINUE_BUTTON_XPATH = "//button[@data-testid='submit']";
    String AMOUNT_NOT_DIVISIBLE_ERROR_XPATH = "//div[@id='amountLimit_errorMessage' and contains(@class, 'f-validationMsg--invalid') and normalize-space(text())='Zadaná hodnota není dělitelná 100.']";

    @TypeInto(value = SIPO_NUMBER_INPUT_XPATH, clear = true)
    SipoOrderPage setSipoNumber(String sipoNumber);

    @TypeInto(value = SIPO_LIMIT_INPUT_XPATH, clear = true)
    SipoOrderPage setSipoLimit(String sipoLimit);

    @TypeInto(END_DATE_INPUT_XPATH)
    SipoOrderPage setSipoEndDate(String sipoEndDate);

    @Click(value = CONTINUE_BUTTON_XPATH, jsClick = true, andWait = @Wait(explicitWaitSeconds = 1))
    SipoOrderSummaryPage clickOnContinue();

    @TypeInto(SIPO_LIMIT_INPUT_XPATH)
    SipoOrderPage setValueNotDivisible100(String number);

    @CheckElementPresent(AMOUNT_NOT_DIVISIBLE_ERROR_XPATH)
    SipoOrderPage checkAmountNotDivisibleError();
}
