// 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.AutoGeneratedDomainNameLabelScope;
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.ManagedGrafanaProperties;
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 ManagedGrafanaPropertiesTests {
    @Test
    public void testDeserialize() {
        ManagedGrafanaProperties model =
            BinaryData
                .fromString(
                    "{\"provisioningState\":\"Deleted\",\"grafanaVersion\":\"hxbnjbiksqrg\",\"endpoint\":\"sainqpjwnzl\",\"publicNetworkAccess\":\"Enabled\",\"zoneRedundancy\":\"Enabled\",\"apiKey\":\"Enabled\",\"deterministicOutboundIP\":\"Enabled\",\"outboundIPs\":[\"gxsabkyq\",\"uujitcjc\"],\"privateEndpointConnections\":[{\"properties\":{\"groupIds\":[],\"provisioningState\":\"Succeeded\"},\"id\":\"rwpdappdsbdkvwrw\",\"name\":\"feusnhut\",\"type\":\"eltmrldhugjzzdat\"},{\"properties\":{\"groupIds\":[],\"provisioningState\":\"Deleting\"},\"id\":\"eablg\",\"name\":\"huticndvkao\",\"type\":\"wyiftyhxhur\"},{\"properties\":{\"groupIds\":[],\"provisioningState\":\"Failed\"},\"id\":\"lniwpwcukjfkgiaw\",\"name\":\"klryplwck\",\"type\":\"asy\"},{\"properties\":{\"groupIds\":[],\"provisioningState\":\"Failed\"},\"id\":\"gcbacphejkot\",\"name\":\"nqgoulzndli\",\"type\":\"wyqkgfgibm\"}],\"autoGeneratedDomainNameLabelScope\":\"TenantReuse\",\"grafanaIntegrations\":{\"azureMonitorWorkspaceIntegrations\":[{\"azureMonitorWorkspaceResourceId\":\"s\"},{\"azureMonitorWorkspaceResourceId\":\"yb\"},{\"azureMonitorWorkspaceResourceId\":\"qedqytbciqfoufl\"},{\"azureMonitorWorkspaceResourceId\":\"nkzsmodmglou\"}]}}")
                .toObject(ManagedGrafanaProperties.class);
        Assertions.assertEquals(PublicNetworkAccess.ENABLED, model.publicNetworkAccess());
        Assertions.assertEquals(ZoneRedundancy.ENABLED, model.zoneRedundancy());
        Assertions.assertEquals(ApiKey.ENABLED, model.apiKey());
        Assertions.assertEquals(DeterministicOutboundIp.ENABLED, model.deterministicOutboundIp());
        Assertions
            .assertEquals(AutoGeneratedDomainNameLabelScope.TENANT_REUSE, model.autoGeneratedDomainNameLabelScope());
        Assertions
            .assertEquals(
                "s",
                model
                    .grafanaIntegrations()
                    .azureMonitorWorkspaceIntegrations()
                    .get(0)
                    .azureMonitorWorkspaceResourceId());
    }

    @Test
    public void testSerialize() {
        ManagedGrafanaProperties model =
            new ManagedGrafanaProperties()
                .withPublicNetworkAccess(PublicNetworkAccess.ENABLED)
                .withZoneRedundancy(ZoneRedundancy.ENABLED)
                .withApiKey(ApiKey.ENABLED)
                .withDeterministicOutboundIp(DeterministicOutboundIp.ENABLED)
                .withAutoGeneratedDomainNameLabelScope(AutoGeneratedDomainNameLabelScope.TENANT_REUSE)
                .withGrafanaIntegrations(
                    new GrafanaIntegrations()
                        .withAzureMonitorWorkspaceIntegrations(
                            Arrays
                                .asList(
                                    new AzureMonitorWorkspaceIntegration().withAzureMonitorWorkspaceResourceId("s"),
                                    new AzureMonitorWorkspaceIntegration().withAzureMonitorWorkspaceResourceId("yb"),
                                    new AzureMonitorWorkspaceIntegration()
                                        .withAzureMonitorWorkspaceResourceId("qedqytbciqfoufl"),
                                    new AzureMonitorWorkspaceIntegration()
                                        .withAzureMonitorWorkspaceResourceId("nkzsmodmglou"))));
        model = BinaryData.fromObject(model).toObject(ManagedGrafanaProperties.class);
        Assertions.assertEquals(PublicNetworkAccess.ENABLED, model.publicNetworkAccess());
        Assertions.assertEquals(ZoneRedundancy.ENABLED, model.zoneRedundancy());
        Assertions.assertEquals(ApiKey.ENABLED, model.apiKey());
        Assertions.assertEquals(DeterministicOutboundIp.ENABLED, model.deterministicOutboundIp());
        Assertions
            .assertEquals(AutoGeneratedDomainNameLabelScope.TENANT_REUSE, model.autoGeneratedDomainNameLabelScope());
        Assertions
            .assertEquals(
                "s",
                model
                    .grafanaIntegrations()
                    .azureMonitorWorkspaceIntegrations()
                    .get(0)
                    .azureMonitorWorkspaceResourceId());
    }
}
