package cz.moneta.test.dsl.ufo.banka.pages.main.client.settings;

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.Until;
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.main.client.settings.TIS051_S001_DispositionGeneratePage.GENERATE_LATER_BUTTON;
import static cz.moneta.test.dsl.ufo.banka.pages.main.client.settings.TIS051_S001_DispositionGeneratePage.GENERATE_NOW_BUTTON;

@Wait(value = {GENERATE_LATER_BUTTON, GENERATE_NOW_BUTTON}, waitSecondsForElement = 80, until = Until.CLICKABLE)
public interface TIS051_S001_DispositionGeneratePage extends WebFlow<TIS051_S001_DispositionGeneratePage>, StoreAccessor {

    String GENERATE_LATER_BUTTON = "TIS051_S001_B001";
    String GENERATE_NOW_BUTTON = "TIS051_S001_B003";

    @CustomAction
    default TIS051_S001_DispositionGeneratePageTransitions clickGenerateLater() {
        UfoEndpoint endpoint = getEndpoint(UfoEndpoint.class);
        endpoint.moveToElement(GENERATE_LATER_BUTTON);
        endpoint.click(() -> GENERATE_LATER_BUTTON);
        return null;
    }

    @CustomAction
    default TIS051_S001_DispositionGeneratePageTransitions clickGenerateNow() {
        UfoEndpoint endpoint = getEndpoint(UfoEndpoint.class);
        endpoint.moveToElement(GENERATE_NOW_BUTTON);
        endpoint.click(() -> GENERATE_NOW_BUTTON);
        return null;
    }
}