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

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.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.expressloan.signLoan.IbSignExpressLoanPage.SIGN_TEXT;

@Wait(SIGN_TEXT)
public interface IbSignExpressLoanPage extends IbPageFlow<IbSignExpressLoanPage> {
    String SIGN_TEXT = "//td[text() = 'Podpis smlouvy']";
    String CONTINUE_BUTTON = "//a[text() = 'POKRAČOVAT']";
    String MOBILE_KEY_INPUT = "mobileKey";
    String SEND_BUTTON = "mobileKeySubmitBtn";

    @Wait(CONTINUE_BUTTON)
    @Click(value = CONTINUE_BUTTON, jsClick = true, andWait = @Wait(value = BUSY_LOADER, until = Until.GONE))
    IbSignExpressLoanPage continueToSign();

    @Wait(value = MOBILE_KEY_INPUT, by = Lookup.ID)
    @TypeInto(value = MOBILE_KEY_INPUT, by = Lookup.ID)
    @Wait(value = BUSY_LOADER, until = Until.GONE)
    IbSignExpressLoanPage typeMobileKey(String mobileKey);

    @Wait(value = SEND_BUTTON, by = Lookup.ID)
    @Wait(value = BUSY_LOADER, until = Until.GONE)
    @Click(value = SEND_BUTTON, by = Lookup.ID, jsClick = true)
    IbSentExpressLoanPage sendLoanRequest();
}