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

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.api.cbl.psd.aisp.my.accounts.Account;
import cz.moneta.test.dsl.cagw.api.cbl.psd.aisp.my.accounts.AccountsBuilder;
import cz.moneta.test.dsl.cagw.api.cbl.psd.aisp.my.accounts.AccountsWithParams;
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 AccountsBuilder accounts() {
        return new AccountsBuilder(harness);
    }

    public Account prepareAccountsRequest() {
        return getBuilder(Account.class);
    }

    public AccountsWithParams prepareAccountsWithParamsRequest() {
        return getBuilder(AccountsWithParams.class);
    }

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