package cz.moneta.test.dsl.cagw.api.cbl.psd.pisp.my;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.api.cbl.psd.pisp.my.payments.Payment;
import cz.moneta.test.dsl.cagw.api.cbl.psd.pisp.my.payments.PaymentsBuilder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;

public class MyBuilder {
    private final Harness harness;

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

    public PaymentsBuilder payments() {
        return new PaymentsBuilder(harness);
    }

    public Payment preparePaymentRequest() {
        return getBuilder(Payment.class);
    }

    private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
        return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
    }
}