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

package tsptest.visibility.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 tsptest.visibility.VisibilityClient;
import tsptest.visibility.VisibilityClientBuilder;
import tsptest.visibility.VisibilityReadClient;
import tsptest.visibility.VisibilityWriteClient;

class VisibilityClientTestBase extends TestProxyTestBase {
    protected VisibilityClient visibilityClient;

    protected VisibilityReadClient visibilityReadClient;

    protected VisibilityWriteClient visibilityWriteClient;

    @Override
    protected void beforeTest() {
        VisibilityClientBuilder visibilityClientbuilder
            = new VisibilityClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint"))
                .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null)))
                .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC));
        if (getTestMode() == TestMode.RECORD) {
            visibilityClientbuilder.addPolicy(interceptorManager.getRecordPolicy());
        }
        visibilityClient = visibilityClientbuilder.buildClient();

        VisibilityClientBuilder visibilityReadClientbuilder
            = new VisibilityClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint"))
                .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null)))
                .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC));
        if (getTestMode() == TestMode.RECORD) {
            visibilityReadClientbuilder.addPolicy(interceptorManager.getRecordPolicy());
        }
        visibilityReadClient = visibilityReadClientbuilder.buildVisibilityReadClient();

        VisibilityClientBuilder visibilityWriteClientbuilder
            = new VisibilityClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint"))
                .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null)))
                .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC));
        if (getTestMode() == TestMode.RECORD) {
            visibilityWriteClientbuilder.addPolicy(interceptorManager.getRecordPolicy());
        }
        visibilityWriteClient = visibilityWriteClientbuilder.buildVisibilityWriteClient();

    }
}
