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

package com.azure.resourcemanager.managednetworkfabric.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.managednetworkfabric.models.ManagementNetworkConfiguration;
import com.azure.resourcemanager.managednetworkfabric.models.OptionAProperties;
import com.azure.resourcemanager.managednetworkfabric.models.OptionBPropertiesAutoGenerated;
import com.azure.resourcemanager.managednetworkfabric.models.PeeringOption;
import com.azure.resourcemanager.managednetworkfabric.models.VpnConfigurationProperties;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ManagementNetworkConfigurationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ManagementNetworkConfiguration model =
            BinaryData
                .fromString(
                    "{\"infrastructureVpnConfiguration\":{\"administrativeState\":\"Disabled\",\"networkToNetworkInterconnectId\":\"vekqvgqo\",\"peeringOption\":\"OptionA\",\"optionBProperties\":{\"importRouteTargets\":[\"zmpjwyiv\",\"ikf\",\"cvhrfsp\"],\"exportRouteTargets\":[\"agr\",\"tikteusqczkvykl\",\"ubyjaffmmf\",\"lcqcuubgqibrt\"]},\"optionAProperties\":{\"mtu\":1749229509,\"vlanId\":1690066547,\"peerASN\":1172631030,\"primaryIpv4Prefix\":\"slqxi\",\"primaryIpv6Prefix\":\"rmooizqse\",\"secondaryIpv4Prefix\":\"xiutcx\",\"secondaryIpv6Prefix\":\"zhyrpeto\"}},\"workloadVpnConfiguration\":{\"administrativeState\":\"Enabled\",\"networkToNetworkInterconnectId\":\"oxslh\",\"peeringOption\":\"OptionA\",\"optionBProperties\":{\"importRouteTargets\":[\"abrqnkkzj\",\"jb\",\"rgaehvvibrxjj\",\"toqbeitpkxztmoob\"],\"exportRouteTargets\":[\"ft\",\"dgfcwqmp\",\"maqxzhemjyh\",\"hujswtwkozzwcul\"]},\"optionAProperties\":{\"mtu\":1258117952,\"vlanId\":2128381794,\"peerASN\":23704541,\"primaryIpv4Prefix\":\"wltlwtjjguktalh\",\"primaryIpv6Prefix\":\"vkcdmxzr\",\"secondaryIpv4Prefix\":\"aimlnwiaaom\",\"secondaryIpv6Prefix\":\"weazul\"}}}")
                .toObject(ManagementNetworkConfiguration.class);
        Assertions.assertEquals(PeeringOption.OPTIONA, model.infrastructureVpnConfiguration().peeringOption());
        Assertions
            .assertEquals(
                "zmpjwyiv", model.infrastructureVpnConfiguration().optionBProperties().importRouteTargets().get(0));
        Assertions
            .assertEquals(
                "agr", model.infrastructureVpnConfiguration().optionBProperties().exportRouteTargets().get(0));
        Assertions
            .assertEquals("slqxi", model.infrastructureVpnConfiguration().optionAProperties().primaryIpv4Prefix());
        Assertions
            .assertEquals("rmooizqse", model.infrastructureVpnConfiguration().optionAProperties().primaryIpv6Prefix());
        Assertions
            .assertEquals("xiutcx", model.infrastructureVpnConfiguration().optionAProperties().secondaryIpv4Prefix());
        Assertions
            .assertEquals("zhyrpeto", model.infrastructureVpnConfiguration().optionAProperties().secondaryIpv6Prefix());
        Assertions.assertEquals(1749229509, model.infrastructureVpnConfiguration().optionAProperties().mtu());
        Assertions.assertEquals(1690066547, model.infrastructureVpnConfiguration().optionAProperties().vlanId());
        Assertions.assertEquals(1172631030, model.infrastructureVpnConfiguration().optionAProperties().peerAsn());
        Assertions.assertEquals(PeeringOption.OPTIONA, model.workloadVpnConfiguration().peeringOption());
        Assertions
            .assertEquals(
                "abrqnkkzj", model.workloadVpnConfiguration().optionBProperties().importRouteTargets().get(0));
        Assertions.assertEquals("ft", model.workloadVpnConfiguration().optionBProperties().exportRouteTargets().get(0));
        Assertions
            .assertEquals("wltlwtjjguktalh", model.workloadVpnConfiguration().optionAProperties().primaryIpv4Prefix());
        Assertions.assertEquals("vkcdmxzr", model.workloadVpnConfiguration().optionAProperties().primaryIpv6Prefix());
        Assertions
            .assertEquals("aimlnwiaaom", model.workloadVpnConfiguration().optionAProperties().secondaryIpv4Prefix());
        Assertions.assertEquals("weazul", model.workloadVpnConfiguration().optionAProperties().secondaryIpv6Prefix());
        Assertions.assertEquals(1258117952, model.workloadVpnConfiguration().optionAProperties().mtu());
        Assertions.assertEquals(2128381794, model.workloadVpnConfiguration().optionAProperties().vlanId());
        Assertions.assertEquals(23704541, model.workloadVpnConfiguration().optionAProperties().peerAsn());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ManagementNetworkConfiguration model =
            new ManagementNetworkConfiguration()
                .withInfrastructureVpnConfiguration(
                    new VpnConfigurationProperties()
                        .withPeeringOption(PeeringOption.OPTIONA)
                        .withOptionBProperties(
                            new OptionBPropertiesAutoGenerated()
                                .withImportRouteTargets(Arrays.asList("zmpjwyiv", "ikf", "cvhrfsp"))
                                .withExportRouteTargets(
                                    Arrays.asList("agr", "tikteusqczkvykl", "ubyjaffmmf", "lcqcuubgqibrt")))
                        .withOptionAProperties(
                            new OptionAProperties()
                                .withPrimaryIpv4Prefix("slqxi")
                                .withPrimaryIpv6Prefix("rmooizqse")
                                .withSecondaryIpv4Prefix("xiutcx")
                                .withSecondaryIpv6Prefix("zhyrpeto")
                                .withMtu(1749229509)
                                .withVlanId(1690066547)
                                .withPeerAsn(1172631030)))
                .withWorkloadVpnConfiguration(
                    new VpnConfigurationProperties()
                        .withPeeringOption(PeeringOption.OPTIONA)
                        .withOptionBProperties(
                            new OptionBPropertiesAutoGenerated()
                                .withImportRouteTargets(
                                    Arrays.asList("abrqnkkzj", "jb", "rgaehvvibrxjj", "toqbeitpkxztmoob"))
                                .withExportRouteTargets(
                                    Arrays.asList("ft", "dgfcwqmp", "maqxzhemjyh", "hujswtwkozzwcul")))
                        .withOptionAProperties(
                            new OptionAProperties()
                                .withPrimaryIpv4Prefix("wltlwtjjguktalh")
                                .withPrimaryIpv6Prefix("vkcdmxzr")
                                .withSecondaryIpv4Prefix("aimlnwiaaom")
                                .withSecondaryIpv6Prefix("weazul")
                                .withMtu(1258117952)
                                .withVlanId(2128381794)
                                .withPeerAsn(23704541)));
        model = BinaryData.fromObject(model).toObject(ManagementNetworkConfiguration.class);
        Assertions.assertEquals(PeeringOption.OPTIONA, model.infrastructureVpnConfiguration().peeringOption());
        Assertions
            .assertEquals(
                "zmpjwyiv", model.infrastructureVpnConfiguration().optionBProperties().importRouteTargets().get(0));
        Assertions
            .assertEquals(
                "agr", model.infrastructureVpnConfiguration().optionBProperties().exportRouteTargets().get(0));
        Assertions
            .assertEquals("slqxi", model.infrastructureVpnConfiguration().optionAProperties().primaryIpv4Prefix());
        Assertions
            .assertEquals("rmooizqse", model.infrastructureVpnConfiguration().optionAProperties().primaryIpv6Prefix());
        Assertions
            .assertEquals("xiutcx", model.infrastructureVpnConfiguration().optionAProperties().secondaryIpv4Prefix());
        Assertions
            .assertEquals("zhyrpeto", model.infrastructureVpnConfiguration().optionAProperties().secondaryIpv6Prefix());
        Assertions.assertEquals(1749229509, model.infrastructureVpnConfiguration().optionAProperties().mtu());
        Assertions.assertEquals(1690066547, model.infrastructureVpnConfiguration().optionAProperties().vlanId());
        Assertions.assertEquals(1172631030, model.infrastructureVpnConfiguration().optionAProperties().peerAsn());
        Assertions.assertEquals(PeeringOption.OPTIONA, model.workloadVpnConfiguration().peeringOption());
        Assertions
            .assertEquals(
                "abrqnkkzj", model.workloadVpnConfiguration().optionBProperties().importRouteTargets().get(0));
        Assertions.assertEquals("ft", model.workloadVpnConfiguration().optionBProperties().exportRouteTargets().get(0));
        Assertions
            .assertEquals("wltlwtjjguktalh", model.workloadVpnConfiguration().optionAProperties().primaryIpv4Prefix());
        Assertions.assertEquals("vkcdmxzr", model.workloadVpnConfiguration().optionAProperties().primaryIpv6Prefix());
        Assertions
            .assertEquals("aimlnwiaaom", model.workloadVpnConfiguration().optionAProperties().secondaryIpv4Prefix());
        Assertions.assertEquals("weazul", model.workloadVpnConfiguration().optionAProperties().secondaryIpv6Prefix());
        Assertions.assertEquals(1258117952, model.workloadVpnConfiguration().optionAProperties().mtu());
        Assertions.assertEquals(2128381794, model.workloadVpnConfiguration().optionAProperties().vlanId());
        Assertions.assertEquals(23704541, model.workloadVpnConfiguration().optionAProperties().peerAsn());
    }
}
