package cz.moneta.test.dsl.ib.loans.expressloan.loanSummary;

import cz.moneta.test.dsl.ib.IbPageFlow;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.Lookup;
import cz.moneta.test.harness.support.web.Until;
import cz.moneta.test.harness.support.web.Wait;

import static cz.moneta.test.dsl.ib.loans.expressloan.loanSummary.IbSummaryExpressLoanPage.APPROVED_LOAN_AMOUNT;
import static cz.moneta.test.dsl.ib.loans.expressloan.loanSummary.IbSummaryExpressLoanPage.APPROVED_LOAN_RATE;
import static cz.moneta.test.dsl.ib.loans.expressloan.loanSummary.IbSummaryExpressLoanPage.APPROVED_LOAN_RPSN;
import static cz.moneta.test.dsl.ib.loans.expressloan.loanSummary.IbSummaryExpressLoanPage.APPROVED_LOAN_TERM;
import static cz.moneta.test.dsl.ib.loans.expressloan.loanSummary.IbSummaryExpressLoanPage.APPROVED_LOAN_TOTAL;
import static cz.moneta.test.dsl.ib.loans.expressloan.loanSummary.IbSummaryExpressLoanPage.APPROVED_MONTHLY_AMOUNT;

@Wait(value = {APPROVED_LOAN_AMOUNT, APPROVED_LOAN_TERM, APPROVED_MONTHLY_AMOUNT, APPROVED_LOAN_RATE, APPROVED_LOAN_RPSN, APPROVED_LOAN_TOTAL}, by = Lookup.ID)
public interface IbSummaryExpressLoanPage extends IbPageFlow<IbSummaryExpressLoanPage> {
    String APPROVED_LOAN_AMOUNT = "approvedLoanAmount";
    String APPROVED_LOAN_TERM = "approvedLoanTerm";

    String APPROVED_MONTHLY_AMOUNT = "approvedMonthlyAmount";
    String APPROVED_LOAN_RATE = "approvedLoanRate";
    String APPROVED_LOAN_RPSN = "approvedLoanRPSN";
    String APPROVED_LOAN_TOTAL = "approvedLoanTotal";
    String SIGN_BUTTON = "signApprovedButton";
    String WAITING_TEXT = "//*[contains(text(), 'Za malou chvíli se dozvíte, zda Vám můžeme poskytnout požadovanou půjčku')]";

    @Wait(value = WAITING_TEXT, until = Until.GONE)
    @Wait(value = SIGN_BUTTON, by = Lookup.ID)
    @Wait(value = BUSY_LOADER, until = Until.GONE)
    @Click(value = SIGN_BUTTON, by = Lookup.ID, jsClick = true)
    IbInsuranceExpressLoanPage wantInsurance();
}