package cz.moneta.test.dsl.ufo.banka.pages.products.consolidation;

import cz.moneta.test.dsl.ufo.banka.pages.loans.NEP002_S001_ApplicantPage;
import cz.moneta.test.dsl.ufo.banka.pages.main.DOK001_S001_SelectionOfSubmittedDocumentsPage;
import cz.moneta.test.harness.support.web.*;

import static cz.moneta.test.dsl.ufo.banka.pages.products.consolidation.UDC002_S001_ConsolidationBindingApplicationPartOne.PAGE_ID;

@Wait(value = {PAGE_ID}, waitSecondsForElement = 30)
public interface UDC002_S001_ConsolidationBindingApplicationPartOne extends WebFlow<UDC002_S001_ConsolidationBindingApplicationPartOne> {
    String PAGE_ID = "UDC002_S001_X001";
    String TOTAL_LOAN_AMOUNT = "UDC002_S001_E006";
    String PAYMENT_CALCULATION_BUTTON = "UDC002_S001_B004";
    String LOADER_XPATH = "/html/body/div[@class='gwt-PopupPanel']/div[@class='popupContent']/img[@class='gwt-Image']/@src";
    String CONTINUE_BUTTON = "UDC002_S001_B002";
    String MONTHLY_PAYMENT_INPUT_XPATH = "//input[@name='UDC002_S001_E007' and not(@value = '')]";

    @TypeInto(TOTAL_LOAN_AMOUNT)
    UDC002_S001_ConsolidationBindingApplicationPartOne typeIntoTotalLoanAmount(int totalLoanAmount);

    @Click(value = PAYMENT_CALCULATION_BUTTON, andWait = @Wait(value = MONTHLY_PAYMENT_INPUT_XPATH, waitSecondsForElement = 15, by = Lookup.XPATH))
    UDC002_S001_ConsolidationBindingApplicationPartOne clickPaymentCalculationButton();

    @Click(CONTINUE_BUTTON)
    DOK001_S001_SelectionOfSubmittedDocumentsPage clickContinueButtonToIdSelectionPage();

    @Click(CONTINUE_BUTTON)
    NEP002_S001_ApplicantPage clickContinueButtonToApplicantPage();
}