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

import cz.moneta.test.dsl.ib.IbPageFlow;
import cz.moneta.test.dsl.ib.loans.flexicredit.FlexicreditApplicationPage;
import cz.moneta.test.dsl.ib.loans.flexicredit.FlexicreditFinalPage;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.TypeInto;
import cz.moneta.test.harness.support.web.Wait;

import static cz.moneta.test.dsl.ib.loans.flexicredit.contract.FlexicreditPreparedToSignPage.HEADER_PREPARED_TO_SIGN;

@Wait({HEADER_PREPARED_TO_SIGN})
public interface FlexicreditPreparedToSignPage extends IbPageFlow<FlexicreditPreparedToSignPage>, FlexicreditApplicationPage {
    String HEADER_PREPARED_TO_SIGN = "//span[text() = 'Dokumenty jsou připraveny k podpisu']";
    String TO_READ_CONTRACT_BUTTON = "//span[text() = 'Přečíst']//parent::button";
    String SIGN_DOCUMENTS = "//span[text() = 'Podepsat dokumenty']";

    String SMS_CODE = "//input[@placeholder = 'Opište kód z SMS']";

    @Click(TO_READ_CONTRACT_BUTTON)
    FlexicreditContractInformationPage readContract();

    @Wait(SIGN_DOCUMENTS)
    @Click(value = SIGN_DOCUMENTS, jsClick = true, andWait = @Wait(SMS_CODE))
    FlexicreditPreparedToSignPage signDocuments();

    @Wait(SMS_CODE)
    @TypeInto(value = SMS_CODE, andWait = @Wait(SIGN_DOCUMENTS))
    @Click(SIGN_DOCUMENTS)
    FlexicreditFinalPage typeSmsCodeAndSignDocuments(String smsCode);
}
