// 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.DefenderFoDatabasesAwsOffering;
import com.azure.resourcemanager.security.models.DefenderFoDatabasesAwsOfferingArcAutoProvisioning;
import com.azure.resourcemanager.security.models.DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration;
import com.azure.resourcemanager.security.models.DefenderFoDatabasesAwsOfferingDatabasesDspm;
import com.azure.resourcemanager.security.models.DefenderFoDatabasesAwsOfferingRds;
import org.junit.jupiter.api.Assertions;

public final class DefenderFoDatabasesAwsOfferingTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DefenderFoDatabasesAwsOffering model =
            BinaryData
                .fromString(
                    "{\"offeringType\":\"DefenderForDatabasesAws\",\"arcAutoProvisioning\":{\"enabled\":true,\"cloudRoleArn\":\"mbqdabzfivfo\",\"configuration\":{\"proxy\":\"sthhzagjfwy\",\"privateLinkScope\":\"lhgenuzejgvkv\"}},\"rds\":{\"enabled\":false,\"cloudRoleArn\":\"zllrz\"},\"databasesDspm\":{\"enabled\":true,\"cloudRoleArn\":\"qgmihzpimcqrhnxt\"},\"description\":\"nklogxsvtzarhzv\"}")
                .toObject(DefenderFoDatabasesAwsOffering.class);
        Assertions.assertEquals(true, model.arcAutoProvisioning().enabled());
        Assertions.assertEquals("mbqdabzfivfo", model.arcAutoProvisioning().cloudRoleArn());
        Assertions.assertEquals("sthhzagjfwy", model.arcAutoProvisioning().configuration().proxy());
        Assertions.assertEquals("lhgenuzejgvkv", model.arcAutoProvisioning().configuration().privateLinkScope());
        Assertions.assertEquals(false, model.rds().enabled());
        Assertions.assertEquals("zllrz", model.rds().cloudRoleArn());
        Assertions.assertEquals(true, model.databasesDspm().enabled());
        Assertions.assertEquals("qgmihzpimcqrhnxt", model.databasesDspm().cloudRoleArn());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DefenderFoDatabasesAwsOffering model =
            new DefenderFoDatabasesAwsOffering()
                .withArcAutoProvisioning(
                    new DefenderFoDatabasesAwsOfferingArcAutoProvisioning()
                        .withEnabled(true)
                        .withCloudRoleArn("mbqdabzfivfo")
                        .withConfiguration(
                            new DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration()
                                .withProxy("sthhzagjfwy")
                                .withPrivateLinkScope("lhgenuzejgvkv")))
                .withRds(new DefenderFoDatabasesAwsOfferingRds().withEnabled(false).withCloudRoleArn("zllrz"))
                .withDatabasesDspm(
                    new DefenderFoDatabasesAwsOfferingDatabasesDspm()
                        .withEnabled(true)
                        .withCloudRoleArn("qgmihzpimcqrhnxt"));
        model = BinaryData.fromObject(model).toObject(DefenderFoDatabasesAwsOffering.class);
        Assertions.assertEquals(true, model.arcAutoProvisioning().enabled());
        Assertions.assertEquals("mbqdabzfivfo", model.arcAutoProvisioning().cloudRoleArn());
        Assertions.assertEquals("sthhzagjfwy", model.arcAutoProvisioning().configuration().proxy());
        Assertions.assertEquals("lhgenuzejgvkv", model.arcAutoProvisioning().configuration().privateLinkScope());
        Assertions.assertEquals(false, model.rds().enabled());
        Assertions.assertEquals("zllrz", model.rds().cloudRoleArn());
        Assertions.assertEquals(true, model.databasesDspm().enabled());
        Assertions.assertEquals("qgmihzpimcqrhnxt", model.databasesDspm().cloudRoleArn());
    }
}
