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

package encode.bytes.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 encode.bytes.BytesClientBuilder;
import encode.bytes.HeaderClient;
import encode.bytes.PropertyClient;
import encode.bytes.QueryClient;
import encode.bytes.RequestBodyClient;
import encode.bytes.ResponseBodyClient;

class BytesClientTestBase extends TestProxyTestBase {
    protected QueryClient queryClient;

    protected PropertyClient propertyClient;

    protected HeaderClient headerClient;

    protected RequestBodyClient requestBodyClient;

    protected ResponseBodyClient responseBodyClient;

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

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

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

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

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

    }
}
