// 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.AttachedDatabaseConfigurationInner;
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 AttachedDatabaseConfigurationInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AttachedDatabaseConfigurationInner model =
            BinaryData
                .fromString(
                    "{\"location\":\"dtmhrkwofyyvoqa\",\"properties\":{\"provisioningState\":\"Canceled\",\"databaseName\":\"xpbtgiwbwo\",\"clusterResourceId\":\"nwashrtd\",\"attachedDatabaseNames\":[\"nqxwbp\",\"kulpiujwaasi\",\"qiiobyuqer\",\"qlpqwcciuq\"],\"defaultPrincipalsModificationKind\":\"Replace\",\"tableLevelSharingProperties\":{\"tablesToInclude\":[\"t\",\"uvfbtkuwh\"],\"tablesToExclude\":[\"ykojoxafnndlpic\",\"koymkcd\",\"h\",\"pkkpw\"],\"externalTablesToInclude\":[\"q\",\"ovvqfovljxywsu\",\"syrsndsytgadgvra\"],\"externalTablesToExclude\":[\"neqn\"],\"materializedViewsToInclude\":[\"rwlqu\",\"ijfqkacewiipfp\",\"bjibwwiftohq\",\"vpuvks\"],\"materializedViewsToExclude\":[\"saknynfsyn\"],\"functionsToInclude\":[\"huopxodlqiynto\"],\"functionsToExclude\":[\"hleosjsw\",\"rmslyzrpzbchckqq\"]},\"databaseNameOverride\":\"ioxiysuiizyn\",\"databaseNamePrefix\":\"dy\"},\"id\":\"trwyhqmib\",\"name\":\"yhwitsmypyynpcdp\",\"type\":\"mnzgmwznmabi\"}")
                .toObject(AttachedDatabaseConfigurationInner.class);
        Assertions.assertEquals("dtmhrkwofyyvoqa", model.location());
        Assertions.assertEquals("xpbtgiwbwo", model.databaseName());
        Assertions.assertEquals("nwashrtd", model.clusterResourceId());
        Assertions.assertEquals(DefaultPrincipalsModificationKind.REPLACE, model.defaultPrincipalsModificationKind());
        Assertions.assertEquals("t", model.tableLevelSharingProperties().tablesToInclude().get(0));
        Assertions.assertEquals("ykojoxafnndlpic", model.tableLevelSharingProperties().tablesToExclude().get(0));
        Assertions.assertEquals("q", model.tableLevelSharingProperties().externalTablesToInclude().get(0));
        Assertions.assertEquals("neqn", model.tableLevelSharingProperties().externalTablesToExclude().get(0));
        Assertions.assertEquals("rwlqu", model.tableLevelSharingProperties().materializedViewsToInclude().get(0));
        Assertions.assertEquals("saknynfsyn", model.tableLevelSharingProperties().materializedViewsToExclude().get(0));
        Assertions.assertEquals("huopxodlqiynto", model.tableLevelSharingProperties().functionsToInclude().get(0));
        Assertions.assertEquals("hleosjsw", model.tableLevelSharingProperties().functionsToExclude().get(0));
        Assertions.assertEquals("ioxiysuiizyn", model.databaseNameOverride());
        Assertions.assertEquals("dy", model.databaseNamePrefix());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AttachedDatabaseConfigurationInner model =
            new AttachedDatabaseConfigurationInner()
                .withLocation("dtmhrkwofyyvoqa")
                .withDatabaseName("xpbtgiwbwo")
                .withClusterResourceId("nwashrtd")
                .withDefaultPrincipalsModificationKind(DefaultPrincipalsModificationKind.REPLACE)
                .withTableLevelSharingProperties(
                    new TableLevelSharingProperties()
                        .withTablesToInclude(Arrays.asList("t", "uvfbtkuwh"))
                        .withTablesToExclude(Arrays.asList("ykojoxafnndlpic", "koymkcd", "h", "pkkpw"))
                        .withExternalTablesToInclude(Arrays.asList("q", "ovvqfovljxywsu", "syrsndsytgadgvra"))
                        .withExternalTablesToExclude(Arrays.asList("neqn"))
                        .withMaterializedViewsToInclude(
                            Arrays.asList("rwlqu", "ijfqkacewiipfp", "bjibwwiftohq", "vpuvks"))
                        .withMaterializedViewsToExclude(Arrays.asList("saknynfsyn"))
                        .withFunctionsToInclude(Arrays.asList("huopxodlqiynto"))
                        .withFunctionsToExclude(Arrays.asList("hleosjsw", "rmslyzrpzbchckqq")))
                .withDatabaseNameOverride("ioxiysuiizyn")
                .withDatabaseNamePrefix("dy");
        model = BinaryData.fromObject(model).toObject(AttachedDatabaseConfigurationInner.class);
        Assertions.assertEquals("dtmhrkwofyyvoqa", model.location());
        Assertions.assertEquals("xpbtgiwbwo", model.databaseName());
        Assertions.assertEquals("nwashrtd", model.clusterResourceId());
        Assertions.assertEquals(DefaultPrincipalsModificationKind.REPLACE, model.defaultPrincipalsModificationKind());
        Assertions.assertEquals("t", model.tableLevelSharingProperties().tablesToInclude().get(0));
        Assertions.assertEquals("ykojoxafnndlpic", model.tableLevelSharingProperties().tablesToExclude().get(0));
        Assertions.assertEquals("q", model.tableLevelSharingProperties().externalTablesToInclude().get(0));
        Assertions.assertEquals("neqn", model.tableLevelSharingProperties().externalTablesToExclude().get(0));
        Assertions.assertEquals("rwlqu", model.tableLevelSharingProperties().materializedViewsToInclude().get(0));
        Assertions.assertEquals("saknynfsyn", model.tableLevelSharingProperties().materializedViewsToExclude().get(0));
        Assertions.assertEquals("huopxodlqiynto", model.tableLevelSharingProperties().functionsToInclude().get(0));
        Assertions.assertEquals("hleosjsw", model.tableLevelSharingProperties().functionsToExclude().get(0));
        Assertions.assertEquals("ioxiysuiizyn", model.databaseNameOverride());
        Assertions.assertEquals("dy", model.databaseNamePrefix());
    }
}
