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

package com.azure.resourcemanager.dashboard.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.dashboard.models.ApiKey;
import com.azure.resourcemanager.dashboard.models.AzureMonitorWorkspaceIntegration;
import com.azure.resourcemanager.dashboard.models.DeterministicOutboundIp;
import com.azure.resourcemanager.dashboard.models.GrafanaIntegrations;
import com.azure.resourcemanager.dashboard.models.ManagedGrafanaPropertiesUpdateParameters;
import com.azure.resourcemanager.dashboard.models.PublicNetworkAccess;
import com.azure.resourcemanager.dashboard.models.ZoneRedundancy;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class ManagedGrafanaPropertiesUpdateParametersTests {
    @Test
    public void testDeserialize() {
        ManagedGrafanaPropertiesUpdateParameters model =
            BinaryData
                .fromString(
                    "{\"zoneRedundancy\":\"Disabled\",\"apiKey\":\"Enabled\",\"deterministicOutboundIP\":\"Enabled\",\"publicNetworkAccess\":\"Enabled\",\"grafanaIntegrations\":{\"azureMonitorWorkspaceIntegrations\":[{\"azureMonitorWorkspaceResourceId\":\"bl\"},{\"azureMonitorWorkspaceResourceId\":\"gpbtoqcjmklj\"},{\"azureMonitorWorkspaceResourceId\":\"bqidtqaj\"},{\"azureMonitorWorkspaceResourceId\":\"ulpkudjkrl\"}]}}")
                .toObject(ManagedGrafanaPropertiesUpdateParameters.class);
        Assertions.assertEquals(ZoneRedundancy.DISABLED, model.zoneRedundancy());
        Assertions.assertEquals(ApiKey.ENABLED, model.apiKey());
        Assertions.assertEquals(DeterministicOutboundIp.ENABLED, model.deterministicOutboundIp());
        Assertions.assertEquals(PublicNetworkAccess.ENABLED, model.publicNetworkAccess());
        Assertions
            .assertEquals(
                "bl",
                model
                    .grafanaIntegrations()
                    .azureMonitorWorkspaceIntegrations()
                    .get(0)
                    .azureMonitorWorkspaceResourceId());
    }

    @Test
    public void testSerialize() {
        ManagedGrafanaPropertiesUpdateParameters model =
            new ManagedGrafanaPropertiesUpdateParameters()
                .withZoneRedundancy(ZoneRedundancy.DISABLED)
                .withApiKey(ApiKey.ENABLED)
                .withDeterministicOutboundIp(DeterministicOutboundIp.ENABLED)
                .withPublicNetworkAccess(PublicNetworkAccess.ENABLED)
                .withGrafanaIntegrations(
                    new GrafanaIntegrations()
                        .withAzureMonitorWorkspaceIntegrations(
                            Arrays
                                .asList(
                                    new AzureMonitorWorkspaceIntegration().withAzureMonitorWorkspaceResourceId("bl"),
                                    new AzureMonitorWorkspaceIntegration()
                                        .withAzureMonitorWorkspaceResourceId("gpbtoqcjmklj"),
                                    new AzureMonitorWorkspaceIntegration()
                                        .withAzureMonitorWorkspaceResourceId("bqidtqaj"),
                                    new AzureMonitorWorkspaceIntegration()
                                        .withAzureMonitorWorkspaceResourceId("ulpkudjkrl"))));
        model = BinaryData.fromObject(model).toObject(ManagedGrafanaPropertiesUpdateParameters.class);
        Assertions.assertEquals(ZoneRedundancy.DISABLED, model.zoneRedundancy());
        Assertions.assertEquals(ApiKey.ENABLED, model.apiKey());
        Assertions.assertEquals(DeterministicOutboundIp.ENABLED, model.deterministicOutboundIp());
        Assertions.assertEquals(PublicNetworkAccess.ENABLED, model.publicNetworkAccess());
        Assertions
            .assertEquals(
                "bl",
                model
                    .grafanaIntegrations()
                    .azureMonitorWorkspaceIntegrations()
                    .get(0)
                    .azureMonitorWorkspaceResourceId());
    }
}
