package cz.moneta.test.dsl.ufo.banka.pages.loans;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.ufo.banka.pages.search.HLO001_S001_ClientSearchPage;
import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.endpoints.ufo.UfoEndpoint;
import cz.moneta.test.harness.support.web.CustomAction;
import cz.moneta.test.harness.support.web.Wait;
import cz.moneta.test.harness.support.web.WebFlow;

import static cz.moneta.test.dsl.ufo.banka.pages.loans.VER014_S004_VerificationSuccessfulPage.OK_BUTTON;

@Wait(OK_BUTTON)
public interface VER014_S004_VerificationSuccessfulPage extends WebFlow<VER014_S004_VerificationSuccessfulPage>, StoreAccessor {

    String OK_BUTTON = "VER014_S004_B001";

    @CustomAction
    default HLO001_S001_ClientSearchPage clickOkAndCloseWindow() {
        UfoEndpoint endpoint = getEndpoint(UfoEndpoint.class, Harness.getSecondBankerToken());
        endpoint.click(() -> OK_BUTTON);
        endpoint.closePopup(20);
        return null;
    }

}
