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

package com.azure.resourcemanager.kusto.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.kusto.fluent.models.AttachedDatabaseConfigurationProperties;
import com.azure.resourcemanager.kusto.models.DefaultPrincipalsModificationKind;
import com.azure.resourcemanager.kusto.models.TableLevelSharingProperties;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class AttachedDatabaseConfigurationPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AttachedDatabaseConfigurationProperties model =
            BinaryData
                .fromString(
                    "{\"provisioningState\":\"Running\",\"databaseName\":\"orgjhxbldt\",\"clusterResourceId\":\"wwrlkdmtncv\",\"attachedDatabaseNames\":[\"tllxdyhgsyocogj\",\"tdtbnnhadooc\",\"kvci\"],\"defaultPrincipalsModificationKind\":\"Replace\",\"tableLevelSharingProperties\":{\"tablesToInclude\":[\"amqgxqquezikyw\"],\"tablesToExclude\":[\"kallatmel\",\"uipiccjzk\"],\"externalTablesToInclude\":[\"gvvcnayrhyr\"],\"externalTablesToExclude\":[\"mueedndrdvstk\",\"qqtch\"],\"materializedViewsToInclude\":[\"mfmtdaaygdvw\",\"gpiohgwxrtfudxe\",\"xg\"],\"materializedViewsToExclude\":[\"gvr\",\"mnpkukghimdblxg\",\"imfnjhfjx\"],\"functionsToInclude\":[\"zk\",\"foqreyfkzik\",\"jawneaiv\"],\"functionsToExclude\":[\"zel\",\"c\",\"r\"]},\"databaseNameOverride\":\"sfeaenwabfat\",\"databaseNamePrefix\":\"ddxbjhwuaanoz\"}")
                .toObject(AttachedDatabaseConfigurationProperties.class);
        Assertions.assertEquals("orgjhxbldt", model.databaseName());
        Assertions.assertEquals("wwrlkdmtncv", model.clusterResourceId());
        Assertions.assertEquals(DefaultPrincipalsModificationKind.REPLACE, model.defaultPrincipalsModificationKind());
        Assertions.assertEquals("amqgxqquezikyw", model.tableLevelSharingProperties().tablesToInclude().get(0));
        Assertions.assertEquals("kallatmel", model.tableLevelSharingProperties().tablesToExclude().get(0));
        Assertions.assertEquals("gvvcnayrhyr", model.tableLevelSharingProperties().externalTablesToInclude().get(0));
        Assertions.assertEquals("mueedndrdvstk", model.tableLevelSharingProperties().externalTablesToExclude().get(0));
        Assertions
            .assertEquals("mfmtdaaygdvw", model.tableLevelSharingProperties().materializedViewsToInclude().get(0));
        Assertions.assertEquals("gvr", model.tableLevelSharingProperties().materializedViewsToExclude().get(0));
        Assertions.assertEquals("zk", model.tableLevelSharingProperties().functionsToInclude().get(0));
        Assertions.assertEquals("zel", model.tableLevelSharingProperties().functionsToExclude().get(0));
        Assertions.assertEquals("sfeaenwabfat", model.databaseNameOverride());
        Assertions.assertEquals("ddxbjhwuaanoz", model.databaseNamePrefix());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AttachedDatabaseConfigurationProperties model =
            new AttachedDatabaseConfigurationProperties()
                .withDatabaseName("orgjhxbldt")
                .withClusterResourceId("wwrlkdmtncv")
                .withDefaultPrincipalsModificationKind(DefaultPrincipalsModificationKind.REPLACE)
                .withTableLevelSharingProperties(
                    new TableLevelSharingProperties()
                        .withTablesToInclude(Arrays.asList("amqgxqquezikyw"))
                        .withTablesToExclude(Arrays.asList("kallatmel", "uipiccjzk"))
                        .withExternalTablesToInclude(Arrays.asList("gvvcnayrhyr"))
                        .withExternalTablesToExclude(Arrays.asList("mueedndrdvstk", "qqtch"))
                        .withMaterializedViewsToInclude(Arrays.asList("mfmtdaaygdvw", "gpiohgwxrtfudxe", "xg"))
                        .withMaterializedViewsToExclude(Arrays.asList("gvr", "mnpkukghimdblxg", "imfnjhfjx"))
                        .withFunctionsToInclude(Arrays.asList("zk", "foqreyfkzik", "jawneaiv"))
                        .withFunctionsToExclude(Arrays.asList("zel", "c", "r")))
                .withDatabaseNameOverride("sfeaenwabfat")
                .withDatabaseNamePrefix("ddxbjhwuaanoz");
        model = BinaryData.fromObject(model).toObject(AttachedDatabaseConfigurationProperties.class);
        Assertions.assertEquals("orgjhxbldt", model.databaseName());
        Assertions.assertEquals("wwrlkdmtncv", model.clusterResourceId());
        Assertions.assertEquals(DefaultPrincipalsModificationKind.REPLACE, model.defaultPrincipalsModificationKind());
        Assertions.assertEquals("amqgxqquezikyw", model.tableLevelSharingProperties().tablesToInclude().get(0));
        Assertions.assertEquals("kallatmel", model.tableLevelSharingProperties().tablesToExclude().get(0));
        Assertions.assertEquals("gvvcnayrhyr", model.tableLevelSharingProperties().externalTablesToInclude().get(0));
        Assertions.assertEquals("mueedndrdvstk", model.tableLevelSharingProperties().externalTablesToExclude().get(0));
        Assertions
            .assertEquals("mfmtdaaygdvw", model.tableLevelSharingProperties().materializedViewsToInclude().get(0));
        Assertions.assertEquals("gvr", model.tableLevelSharingProperties().materializedViewsToExclude().get(0));
        Assertions.assertEquals("zk", model.tableLevelSharingProperties().functionsToInclude().get(0));
        Assertions.assertEquals("zel", model.tableLevelSharingProperties().functionsToExclude().get(0));
        Assertions.assertEquals("sfeaenwabfat", model.databaseNameOverride());
        Assertions.assertEquals("ddxbjhwuaanoz", model.databaseNamePrefix());
    }
}
