// 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.EventGridConnectionProperties;
import com.azure.resourcemanager.kusto.models.BlobStorageEventType;
import com.azure.resourcemanager.kusto.models.DatabaseRouting;
import com.azure.resourcemanager.kusto.models.EventGridDataFormat;
import org.junit.jupiter.api.Assertions;

public final class EventGridConnectionPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        EventGridConnectionProperties model =
            BinaryData
                .fromString(
                    "{\"storageAccountResourceId\":\"shfwpracstwity\",\"eventGridResourceId\":\"evxccedcp\",\"eventHubResourceId\":\"md\",\"consumerGroup\":\"odn\",\"tableName\":\"xltjcvnhltiu\",\"mappingRuleName\":\"xnavvwxq\",\"dataFormat\":\"MULTIJSON\",\"ignoreFirstRecord\":false,\"blobStorageEventType\":\"Microsoft.Storage.BlobCreated\",\"managedIdentityResourceId\":\"wxwlmdjrkvfgb\",\"managedIdentityObjectId\":\"vpdbodaciz\",\"databaseRouting\":\"Single\",\"provisioningState\":\"Succeeded\"}")
                .toObject(EventGridConnectionProperties.class);
        Assertions.assertEquals("shfwpracstwity", model.storageAccountResourceId());
        Assertions.assertEquals("evxccedcp", model.eventGridResourceId());
        Assertions.assertEquals("md", model.eventHubResourceId());
        Assertions.assertEquals("odn", model.consumerGroup());
        Assertions.assertEquals("xltjcvnhltiu", model.tableName());
        Assertions.assertEquals("xnavvwxq", model.mappingRuleName());
        Assertions.assertEquals(EventGridDataFormat.MULTIJSON, model.dataFormat());
        Assertions.assertEquals(false, model.ignoreFirstRecord());
        Assertions.assertEquals(BlobStorageEventType.MICROSOFT_STORAGE_BLOB_CREATED, model.blobStorageEventType());
        Assertions.assertEquals("wxwlmdjrkvfgb", model.managedIdentityResourceId());
        Assertions.assertEquals(DatabaseRouting.SINGLE, model.databaseRouting());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        EventGridConnectionProperties model =
            new EventGridConnectionProperties()
                .withStorageAccountResourceId("shfwpracstwity")
                .withEventGridResourceId("evxccedcp")
                .withEventHubResourceId("md")
                .withConsumerGroup("odn")
                .withTableName("xltjcvnhltiu")
                .withMappingRuleName("xnavvwxq")
                .withDataFormat(EventGridDataFormat.MULTIJSON)
                .withIgnoreFirstRecord(false)
                .withBlobStorageEventType(BlobStorageEventType.MICROSOFT_STORAGE_BLOB_CREATED)
                .withManagedIdentityResourceId("wxwlmdjrkvfgb")
                .withDatabaseRouting(DatabaseRouting.SINGLE);
        model = BinaryData.fromObject(model).toObject(EventGridConnectionProperties.class);
        Assertions.assertEquals("shfwpracstwity", model.storageAccountResourceId());
        Assertions.assertEquals("evxccedcp", model.eventGridResourceId());
        Assertions.assertEquals("md", model.eventHubResourceId());
        Assertions.assertEquals("odn", model.consumerGroup());
        Assertions.assertEquals("xltjcvnhltiu", model.tableName());
        Assertions.assertEquals("xnavvwxq", model.mappingRuleName());
        Assertions.assertEquals(EventGridDataFormat.MULTIJSON, model.dataFormat());
        Assertions.assertEquals(false, model.ignoreFirstRecord());
        Assertions.assertEquals(BlobStorageEventType.MICROSOFT_STORAGE_BLOB_CREATED, model.blobStorageEventType());
        Assertions.assertEquals("wxwlmdjrkvfgb", model.managedIdentityResourceId());
        Assertions.assertEquals(DatabaseRouting.SINGLE, model.databaseRouting());
    }
}
