package cz.moneta.test.dsl.ib.loan.creditcard;

import cz.moneta.test.dsl.ib.IbPageFlow;
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.loan.creditcard.CCContractPage.AGREE_AND_SIGN_BUTTON;

@Wait(value = AGREE_AND_SIGN_BUTTON, waitSecondsForElement = 180)
public interface CCContractPage extends IbPageFlow<CCContractPage> {
    String PREVIOUS_PAGE_OF_CONTRACT_BUTTON = "//span[@data-test-id='previous-page']";
    String NEXT_PAGE_OF_CONTRACT_BUTTON = "//span[@data-test-id='next-page']";
    String AGREE_AND_SIGN_BUTTON = "//button[@data-test-id='agree-button']";
    String SIGN_AGREEMENT_BUTTON = "//button[@data-test-id='verify-button']";
    String VERIFICATION_CODE = "//input[@data-test-id='verification-code']";
    //TODO fix xpath for leaving process after update of test-id on elements (LAB3-3637)
    //String LEAVE_PROCESS = "//*[@id='root']/div/div/div/div[2]/div[1]/button";

    @Click(PREVIOUS_PAGE_OF_CONTRACT_BUTTON)
    CCContractPage clickOnPreviousPageOfContract();

    @Click(NEXT_PAGE_OF_CONTRACT_BUTTON)
    CCContractPage clickOnNextPageOfContract();

    @Click(AGREE_AND_SIGN_BUTTON)
    CCContractPage clickContinueToSignature();

    @Click(SIGN_AGREEMENT_BUTTON)
    CCContractPage clickSignAgreement();

    @TypeInto(value = VERIFICATION_CODE, clear = true)
    CCContractPage insertVerificationCode(String verificationCode);

    //Dont use until fix in LAB3-3637
    //@Click(LEAVE_PROCESS)
    //CCContractPage clickLeaveProcess();
}
