package cz.moneta.test.dsl.cashman;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cashman.pages.CashmanHomePage;
import cz.moneta.test.harness.endpoints.cashman.CashmanEndpoint;
import cz.moneta.test.harness.support.web.Builders;

public class Cashman {

    private final Harness harness;
    private CashmanEndpoint cashmanEndpoint;

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

    public CashmanHomePage openCashmanHomePage() {
        cashmanEndpoint = harness.getEndpoint(CashmanEndpoint.class);
        cashmanEndpoint.openApplication();
        return Builders.newWebFlowBuilder(CashmanHomePage.class, cashmanEndpoint, harness);
    }

    public void closeCashman() {
        harness.closeEndpoint(harness.getEndpoint(CashmanEndpoint.class));
    }
}