// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package service.multipleservices.servicea.generated;

// The Java test files under 'generated' package are generated for your reference.
// If you wish to modify these files, please copy them out of the 'generated' package, and modify there.
// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test.

import com.azure.core.http.policy.HttpLogDetailLevel;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.test.TestMode;
import com.azure.core.test.TestProxyTestBase;
import com.azure.core.util.Configuration;
import service.multipleservices.servicea.AOperationsClient;
import service.multipleservices.servicea.ASubNamespaceClient;
import service.multipleservices.servicea.ServiceAClientBuilder;
import service.multipleservices.serviceb.BOperationsClient;
import service.multipleservices.serviceb.BSubNamespaceClient;
import service.multipleservices.serviceb.ServiceBClientBuilder;

class ServiceAClientTestBase extends TestProxyTestBase {
    protected ASubNamespaceClient aSubNamespaceClient;

    protected AOperationsClient aOperationsClient;

    protected BSubNamespaceClient bSubNamespaceClient;

    protected BOperationsClient bOperationsClient;

    @Override
    protected void beforeTest() {
        ServiceAClientBuilder aSubNamespaceClientbuilder = new ServiceAClientBuilder()
            .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000"))
            .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null)))
            .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC));
        if (getTestMode() == TestMode.RECORD) {
            aSubNamespaceClientbuilder.addPolicy(interceptorManager.getRecordPolicy());
        }
        aSubNamespaceClient = aSubNamespaceClientbuilder.buildASubNamespaceClient();

        ServiceAClientBuilder aOperationsClientbuilder = new ServiceAClientBuilder()
            .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000"))
            .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null)))
            .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC));
        if (getTestMode() == TestMode.RECORD) {
            aOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy());
        }
        aOperationsClient = aOperationsClientbuilder.buildAOperationsClient();

        ServiceBClientBuilder bSubNamespaceClientbuilder = new ServiceBClientBuilder()
            .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000"))
            .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null)))
            .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC));
        if (getTestMode() == TestMode.RECORD) {
            bSubNamespaceClientbuilder.addPolicy(interceptorManager.getRecordPolicy());
        }
        bSubNamespaceClient = bSubNamespaceClientbuilder.buildBSubNamespaceClient();

        ServiceBClientBuilder bOperationsClientbuilder = new ServiceBClientBuilder()
            .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000"))
            .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null)))
            .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC));
        if (getTestMode() == TestMode.RECORD) {
            bOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy());
        }
        bOperationsClient = bOperationsClientbuilder.buildBOperationsClient();

    }
}
