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

package com.azure.resourcemanager.synapse.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.synapse.fluent.models.AttachedDatabaseConfigurationProperties;
import com.azure.resourcemanager.synapse.models.DefaultPrincipalsModificationKind;
import com.azure.resourcemanager.synapse.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\":\"Canceled\",\"databaseName\":\"aclkiexhajlfnt\",\"clusterResourceId\":\"iqfyuttdi\",\"attachedDatabaseNames\":[\"pvn\"],\"defaultPrincipalsModificationKind\":\"Union\",\"tableLevelSharingProperties\":{\"tablesToInclude\":[\"xkyctwwgzwx\",\"l\",\"ecvo\",\"ygzyvneezaifght\"],\"tablesToExclude\":[\"qtlffhzbk\",\"kjj\",\"avfqnvhnqoewdogi\",\"etesypvidbztjhqt\"],\"externalTablesToInclude\":[\"vnynkb\",\"etnjuhpsprkz\",\"aupia\",\"cxnafbwqrooh\"],\"externalTablesToExclude\":[\"vmaonurjt\",\"mghihp\",\"ecmslclbl\"],\"materializedViewsToInclude\":[\"lt\",\"sjuscvsfxigctmg\",\"uupb\"],\"materializedViewsToExclude\":[\"ccyd\",\"tce\",\"kdqkkyihzt\",\"eq\"]}}")
                .toObject(AttachedDatabaseConfigurationProperties.class);
        Assertions.assertEquals("aclkiexhajlfnt", model.databaseName());
        Assertions.assertEquals("iqfyuttdi", model.kustoPoolResourceId());
        Assertions.assertEquals(DefaultPrincipalsModificationKind.UNION, model.defaultPrincipalsModificationKind());
        Assertions.assertEquals("xkyctwwgzwx", model.tableLevelSharingProperties().tablesToInclude().get(0));
        Assertions.assertEquals("qtlffhzbk", model.tableLevelSharingProperties().tablesToExclude().get(0));
        Assertions.assertEquals("vnynkb", model.tableLevelSharingProperties().externalTablesToInclude().get(0));
        Assertions.assertEquals("vmaonurjt", model.tableLevelSharingProperties().externalTablesToExclude().get(0));
        Assertions.assertEquals("lt", model.tableLevelSharingProperties().materializedViewsToInclude().get(0));
        Assertions.assertEquals("ccyd", model.tableLevelSharingProperties().materializedViewsToExclude().get(0));
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AttachedDatabaseConfigurationProperties model =
            new AttachedDatabaseConfigurationProperties()
                .withDatabaseName("aclkiexhajlfnt")
                .withKustoPoolResourceId("iqfyuttdi")
                .withDefaultPrincipalsModificationKind(DefaultPrincipalsModificationKind.UNION)
                .withTableLevelSharingProperties(
                    new TableLevelSharingProperties()
                        .withTablesToInclude(Arrays.asList("xkyctwwgzwx", "l", "ecvo", "ygzyvneezaifght"))
                        .withTablesToExclude(Arrays.asList("qtlffhzbk", "kjj", "avfqnvhnqoewdogi", "etesypvidbztjhqt"))
                        .withExternalTablesToInclude(Arrays.asList("vnynkb", "etnjuhpsprkz", "aupia", "cxnafbwqrooh"))
                        .withExternalTablesToExclude(Arrays.asList("vmaonurjt", "mghihp", "ecmslclbl"))
                        .withMaterializedViewsToInclude(Arrays.asList("lt", "sjuscvsfxigctmg", "uupb"))
                        .withMaterializedViewsToExclude(Arrays.asList("ccyd", "tce", "kdqkkyihzt", "eq")));
        model = BinaryData.fromObject(model).toObject(AttachedDatabaseConfigurationProperties.class);
        Assertions.assertEquals("aclkiexhajlfnt", model.databaseName());
        Assertions.assertEquals("iqfyuttdi", model.kustoPoolResourceId());
        Assertions.assertEquals(DefaultPrincipalsModificationKind.UNION, model.defaultPrincipalsModificationKind());
        Assertions.assertEquals("xkyctwwgzwx", model.tableLevelSharingProperties().tablesToInclude().get(0));
        Assertions.assertEquals("qtlffhzbk", model.tableLevelSharingProperties().tablesToExclude().get(0));
        Assertions.assertEquals("vnynkb", model.tableLevelSharingProperties().externalTablesToInclude().get(0));
        Assertions.assertEquals("vmaonurjt", model.tableLevelSharingProperties().externalTablesToExclude().get(0));
        Assertions.assertEquals("lt", model.tableLevelSharingProperties().materializedViewsToInclude().get(0));
        Assertions.assertEquals("ccyd", model.tableLevelSharingProperties().materializedViewsToExclude().get(0));
    }
}
