package cz.moneta.test.dsl.ib.loans.flexicredit;

import cz.moneta.test.dsl.ib.IbPageFlow;
import cz.moneta.test.dsl.ib.loans.flexicredit.request.RequestAdressFlexicreditApplicationPage;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.TypeInto;
import cz.moneta.test.harness.support.web.Until;
import cz.moneta.test.harness.support.web.Wait;

import static cz.moneta.test.dsl.ib.loans.flexicredit.OfferFlexicreditApplicationPage.FIRST_HEADER_TEXT;

@Wait(FIRST_HEADER_TEXT)
public interface OfferFlexicreditApplicationPage extends IbPageFlow<OfferFlexicreditApplicationPage>, FlexicreditApplicationPage {
    String FIRST_HEADER_TEXT = "//span[text()='Nastavte si kontokorent pro svůj účet']";

    String CURRENT_ACCOUNT = "//span[text()='Běžný účet']//parent::label//following::div[contains(text(), '%s')]";
    String LOAN_AMOUNT = "//span[text()='Výše rezervy']//parent::label//following::input[@name= 'loanAmount']";

    @TypeInto(value = LOAN_AMOUNT, clear = true, andWait = @Wait(value = MONETA_LOGO_SPINER, until = Until.GONE))
    OfferFlexicreditApplicationPage setLoanAmount(String amount);

    @Wait(CONTINUE_BUTTON)
    @Click(value = CONTINUE_BUTTON, jsClick = true)
    RequestAdressFlexicreditApplicationPage clickContinueButton();

}
