package cz.moneta.test.dsl.oauth2.web;

import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.endpoints.oauth2.web.Oauth2WebEndpoint;
import cz.moneta.test.harness.support.web.CustomAction;
import cz.moneta.test.harness.support.web.Page;
import cz.moneta.test.harness.support.web.WebFlow;

public interface Oauth2WebTransitions extends WebFlow<Oauth2WebTransitions>, StoreAccessor {
    String APPROVE_ACCESS_TO_ACCOUNT_PAGE_GENERAL_URL = "oauth2/auth?response_type=code&scope=ALL&state=ABCD&client_id=%s";

    @CustomAction
    @Page(ApproveAccessToAccountPage.class)
    default ApproveAccessToAccountPage openApproveAccessToAccountPage(String clientId) {
            Oauth2WebEndpoint endpoint = getEndpoint(Oauth2WebEndpoint.class);
            endpoint.changePath(String.format(APPROVE_ACCESS_TO_ACCOUNT_PAGE_GENERAL_URL, clientId));
        return null;
    }
}