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

package com.azure.resourcemanager.security.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.security.models.DefenderForDatabasesGcpOffering;
import com.azure.resourcemanager.security.models.DefenderForDatabasesGcpOfferingArcAutoProvisioning;
import com.azure.resourcemanager.security.models.DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration;
import com.azure.resourcemanager.security.models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning;
import org.junit.jupiter.api.Assertions;

public final class DefenderForDatabasesGcpOfferingTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DefenderForDatabasesGcpOffering model =
            BinaryData
                .fromString(
                    "{\"offeringType\":\"DefenderForDatabasesGcp\",\"arcAutoProvisioning\":{\"enabled\":true,\"configuration\":{\"proxy\":\"fv\",\"privateLinkScope\":\"vqkxiuxqggvq\"}},\"defenderForDatabasesArcAutoProvisioning\":{\"serviceAccountEmailAddress\":\"yhlwcjsqg\",\"workloadIdentityProviderId\":\"hffbxrq\"},\"description\":\"ijpeuql\"}")
                .toObject(DefenderForDatabasesGcpOffering.class);
        Assertions.assertEquals(true, model.arcAutoProvisioning().enabled());
        Assertions.assertEquals("fv", model.arcAutoProvisioning().configuration().proxy());
        Assertions.assertEquals("vqkxiuxqggvq", model.arcAutoProvisioning().configuration().privateLinkScope());
        Assertions
            .assertEquals("yhlwcjsqg", model.defenderForDatabasesArcAutoProvisioning().serviceAccountEmailAddress());
        Assertions
            .assertEquals("hffbxrq", model.defenderForDatabasesArcAutoProvisioning().workloadIdentityProviderId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DefenderForDatabasesGcpOffering model =
            new DefenderForDatabasesGcpOffering()
                .withArcAutoProvisioning(
                    new DefenderForDatabasesGcpOfferingArcAutoProvisioning()
                        .withEnabled(true)
                        .withConfiguration(
                            new DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration()
                                .withProxy("fv")
                                .withPrivateLinkScope("vqkxiuxqggvq")))
                .withDefenderForDatabasesArcAutoProvisioning(
                    new DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning()
                        .withServiceAccountEmailAddress("yhlwcjsqg")
                        .withWorkloadIdentityProviderId("hffbxrq"));
        model = BinaryData.fromObject(model).toObject(DefenderForDatabasesGcpOffering.class);
        Assertions.assertEquals(true, model.arcAutoProvisioning().enabled());
        Assertions.assertEquals("fv", model.arcAutoProvisioning().configuration().proxy());
        Assertions.assertEquals("vqkxiuxqggvq", model.arcAutoProvisioning().configuration().privateLinkScope());
        Assertions
            .assertEquals("yhlwcjsqg", model.defenderForDatabasesArcAutoProvisioning().serviceAccountEmailAddress());
        Assertions
            .assertEquals("hffbxrq", model.defenderForDatabasesArcAutoProvisioning().workloadIdentityProviderId());
    }
}
