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

package type.union.discriminated.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 type.union.discriminated.DiscriminatedClientBuilder;
import type.union.discriminated.EnvelopeObjectCustomPropertiesClient;
import type.union.discriminated.EnvelopeObjectDefaultClient;
import type.union.discriminated.NoEnvelopeCustomDiscriminatorClient;
import type.union.discriminated.NoEnvelopeDefaultClient;

class DiscriminatedClientTestBase extends TestProxyTestBase {
    protected EnvelopeObjectDefaultClient envelopeObjectDefaultClient;

    protected EnvelopeObjectCustomPropertiesClient envelopeObjectCustomPropertiesClient;

    protected NoEnvelopeDefaultClient noEnvelopeDefaultClient;

    protected NoEnvelopeCustomDiscriminatorClient noEnvelopeCustomDiscriminatorClient;

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

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

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

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

    }
}
