package cz.moneta.test.dsl.brokerportal;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.harness.endpoints.hypos.BrokerPortalEndpoint;
import cz.moneta.test.harness.support.web.Builders;

public class BrokerPortal {

    private final Harness harness;

    public BrokerPortal(Harness harness) {
        this.harness = harness;
    }

    public BrokerPortalLoginPage openLoginPage() {
        BrokerPortalEndpoint brokerPortalEndpoint = harness.getEndpoint(BrokerPortalEndpoint.class);
        brokerPortalEndpoint.openApplication();

        return Builders.newWebFlowBuilder(BrokerPortalLoginPage.class, brokerPortalEndpoint, harness)
                .acceptCookies();
    }

    public void closeLoginPage() {
        harness.closeEndpoint(harness.getEndpoint(BrokerPortalEndpoint.class));
    }
}