// 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.BfdConfiguration;
import com.azure.resourcemanager.managednetworkfabric.models.ManagementNetworkConfigurationProperties;
import com.azure.resourcemanager.managednetworkfabric.models.OptionBProperties;
import com.azure.resourcemanager.managednetworkfabric.models.PeeringOption;
import com.azure.resourcemanager.managednetworkfabric.models.RouteTargetInformation;
import com.azure.resourcemanager.managednetworkfabric.models.VpnConfigurationProperties;
import com.azure.resourcemanager.managednetworkfabric.models.VpnConfigurationPropertiesOptionAProperties;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ManagementNetworkConfigurationPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ManagementNetworkConfigurationProperties model =
            BinaryData
                .fromString(
                    "{\"infrastructureVpnConfiguration\":{\"networkToNetworkInterconnectId\":\"mkwjfbotl\",\"administrativeState\":\"Disabled\",\"peeringOption\":\"OptionA\",\"optionBProperties\":{\"importRouteTargets\":[\"ursuivuxcjk\"],\"exportRouteTargets\":[\"w\",\"z\"],\"routeTargets\":{\"importIpv4RouteTargets\":[\"rizfwihvaang\",\"tnhjrfdmfd\",\"bbaex\"],\"importIpv6RouteTargets\":[\"wtgdfkkaui\",\"vmuafmc\",\"fedyuep\",\"vpltidajjvy\"],\"exportIpv4RouteTargets\":[\"cfkumcfjxo\",\"yelsyasvfnk\",\"myg\",\"jekrknfd\"],\"exportIpv6RouteTargets\":[\"jqy\",\"kgtxkrdtulcrcj\",\"k\",\"otcsu\"]}},\"optionAProperties\":{\"primaryIpv4Prefix\":\"oonsvobchkxfp\",\"primaryIpv6Prefix\":\"dyslbklglmnn\",\"secondaryIpv4Prefix\":\"wayqshwyqxrid\",\"secondaryIpv6Prefix\":\"bsaqjm\",\"mtu\":1855919116,\"vlanId\":761443572,\"peerASN\":1689956278909975813,\"bfdConfiguration\":{\"administrativeState\":\"Disabled\",\"intervalInMilliSeconds\":1377813110,\"multiplier\":1139650083}}},\"workloadVpnConfiguration\":{\"networkToNetworkInterconnectId\":\"iizevjykofvez\",\"administrativeState\":\"Enabled\",\"peeringOption\":\"OptionB\",\"optionBProperties\":{\"importRouteTargets\":[\"wqlepjj\"],\"exportRouteTargets\":[\"as\"],\"routeTargets\":{\"importIpv4RouteTargets\":[\"ntogffjwajnrt\"],\"importIpv6RouteTargets\":[\"aqkifmxawostfz\",\"nhrkmjqncfvdsc\",\"hemvwfnqqwypvnd\",\"wbgodtggrssg\"],\"exportIpv4RouteTargets\":[\"kainjmuymvecvzt\"],\"exportIpv6RouteTargets\":[\"gmusaictdscnkzzo\",\"nrddclzeqoz\",\"ehlbzqixbnjrqvzy\"]}},\"optionAProperties\":{\"primaryIpv4Prefix\":\"ozonynp\",\"primaryIpv6Prefix\":\"eudpab\",\"secondaryIpv4Prefix\":\"euwzosgyjxvc\",\"secondaryIpv6Prefix\":\"sormrex\",\"mtu\":1882838506,\"vlanId\":158915629,\"peerASN\":8483386639744134100,\"bfdConfiguration\":{\"administrativeState\":\"Disabled\",\"intervalInMilliSeconds\":472275599,\"multiplier\":2139027754}}}}")
                .toObject(ManagementNetworkConfigurationProperties.class);
        Assertions.assertEquals("mkwjfbotl", model.infrastructureVpnConfiguration().networkToNetworkInterconnectId());
        Assertions.assertEquals(PeeringOption.OPTIONA, model.infrastructureVpnConfiguration().peeringOption());
        Assertions
            .assertEquals(
                "ursuivuxcjk", model.infrastructureVpnConfiguration().optionBProperties().importRouteTargets().get(0));
        Assertions
            .assertEquals("w", model.infrastructureVpnConfiguration().optionBProperties().exportRouteTargets().get(0));
        Assertions
            .assertEquals(
                "rizfwihvaang",
                model
                    .infrastructureVpnConfiguration()
                    .optionBProperties()
                    .routeTargets()
                    .importIpv4RouteTargets()
                    .get(0));
        Assertions
            .assertEquals(
                "wtgdfkkaui",
                model
                    .infrastructureVpnConfiguration()
                    .optionBProperties()
                    .routeTargets()
                    .importIpv6RouteTargets()
                    .get(0));
        Assertions
            .assertEquals(
                "cfkumcfjxo",
                model
                    .infrastructureVpnConfiguration()
                    .optionBProperties()
                    .routeTargets()
                    .exportIpv4RouteTargets()
                    .get(0));
        Assertions
            .assertEquals(
                "jqy",
                model
                    .infrastructureVpnConfiguration()
                    .optionBProperties()
                    .routeTargets()
                    .exportIpv6RouteTargets()
                    .get(0));
        Assertions.assertEquals(1855919116, model.infrastructureVpnConfiguration().optionAProperties().mtu());
        Assertions.assertEquals(761443572, model.infrastructureVpnConfiguration().optionAProperties().vlanId());
        Assertions
            .assertEquals(1689956278909975813L, model.infrastructureVpnConfiguration().optionAProperties().peerAsn());
        Assertions
            .assertEquals(
                1377813110,
                model.infrastructureVpnConfiguration().optionAProperties().bfdConfiguration().intervalInMilliSeconds());
        Assertions
            .assertEquals(
                1139650083, model.infrastructureVpnConfiguration().optionAProperties().bfdConfiguration().multiplier());
        Assertions
            .assertEquals(
                "oonsvobchkxfp", model.infrastructureVpnConfiguration().optionAProperties().primaryIpv4Prefix());
        Assertions
            .assertEquals(
                "dyslbklglmnn", model.infrastructureVpnConfiguration().optionAProperties().primaryIpv6Prefix());
        Assertions
            .assertEquals(
                "wayqshwyqxrid", model.infrastructureVpnConfiguration().optionAProperties().secondaryIpv4Prefix());
        Assertions
            .assertEquals("bsaqjm", model.infrastructureVpnConfiguration().optionAProperties().secondaryIpv6Prefix());
        Assertions.assertEquals("iizevjykofvez", model.workloadVpnConfiguration().networkToNetworkInterconnectId());
        Assertions.assertEquals(PeeringOption.OPTIONB, model.workloadVpnConfiguration().peeringOption());
        Assertions
            .assertEquals("wqlepjj", model.workloadVpnConfiguration().optionBProperties().importRouteTargets().get(0));
        Assertions.assertEquals("as", model.workloadVpnConfiguration().optionBProperties().exportRouteTargets().get(0));
        Assertions
            .assertEquals(
                "ntogffjwajnrt",
                model.workloadVpnConfiguration().optionBProperties().routeTargets().importIpv4RouteTargets().get(0));
        Assertions
            .assertEquals(
                "aqkifmxawostfz",
                model.workloadVpnConfiguration().optionBProperties().routeTargets().importIpv6RouteTargets().get(0));
        Assertions
            .assertEquals(
                "kainjmuymvecvzt",
                model.workloadVpnConfiguration().optionBProperties().routeTargets().exportIpv4RouteTargets().get(0));
        Assertions
            .assertEquals(
                "gmusaictdscnkzzo",
                model.workloadVpnConfiguration().optionBProperties().routeTargets().exportIpv6RouteTargets().get(0));
        Assertions.assertEquals(1882838506, model.workloadVpnConfiguration().optionAProperties().mtu());
        Assertions.assertEquals(158915629, model.workloadVpnConfiguration().optionAProperties().vlanId());
        Assertions.assertEquals(8483386639744134100L, model.workloadVpnConfiguration().optionAProperties().peerAsn());
        Assertions
            .assertEquals(
                472275599,
                model.workloadVpnConfiguration().optionAProperties().bfdConfiguration().intervalInMilliSeconds());
        Assertions
            .assertEquals(
                2139027754, model.workloadVpnConfiguration().optionAProperties().bfdConfiguration().multiplier());
        Assertions.assertEquals("ozonynp", model.workloadVpnConfiguration().optionAProperties().primaryIpv4Prefix());
        Assertions.assertEquals("eudpab", model.workloadVpnConfiguration().optionAProperties().primaryIpv6Prefix());
        Assertions
            .assertEquals("euwzosgyjxvc", model.workloadVpnConfiguration().optionAProperties().secondaryIpv4Prefix());
        Assertions.assertEquals("sormrex", model.workloadVpnConfiguration().optionAProperties().secondaryIpv6Prefix());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ManagementNetworkConfigurationProperties model =
            new ManagementNetworkConfigurationProperties()
                .withInfrastructureVpnConfiguration(
                    new VpnConfigurationProperties()
                        .withNetworkToNetworkInterconnectId("mkwjfbotl")
                        .withPeeringOption(PeeringOption.OPTIONA)
                        .withOptionBProperties(
                            new OptionBProperties()
                                .withImportRouteTargets(Arrays.asList("ursuivuxcjk"))
                                .withExportRouteTargets(Arrays.asList("w", "z"))
                                .withRouteTargets(
                                    new RouteTargetInformation()
                                        .withImportIpv4RouteTargets(
                                            Arrays.asList("rizfwihvaang", "tnhjrfdmfd", "bbaex"))
                                        .withImportIpv6RouteTargets(
                                            Arrays.asList("wtgdfkkaui", "vmuafmc", "fedyuep", "vpltidajjvy"))
                                        .withExportIpv4RouteTargets(
                                            Arrays.asList("cfkumcfjxo", "yelsyasvfnk", "myg", "jekrknfd"))
                                        .withExportIpv6RouteTargets(
                                            Arrays.asList("jqy", "kgtxkrdtulcrcj", "k", "otcsu"))))
                        .withOptionAProperties(
                            new VpnConfigurationPropertiesOptionAProperties()
                                .withMtu(1855919116)
                                .withVlanId(761443572)
                                .withPeerAsn(1689956278909975813L)
                                .withBfdConfiguration(
                                    new BfdConfiguration()
                                        .withIntervalInMilliSeconds(1377813110)
                                        .withMultiplier(1139650083))
                                .withPrimaryIpv4Prefix("oonsvobchkxfp")
                                .withPrimaryIpv6Prefix("dyslbklglmnn")
                                .withSecondaryIpv4Prefix("wayqshwyqxrid")
                                .withSecondaryIpv6Prefix("bsaqjm")))
                .withWorkloadVpnConfiguration(
                    new VpnConfigurationProperties()
                        .withNetworkToNetworkInterconnectId("iizevjykofvez")
                        .withPeeringOption(PeeringOption.OPTIONB)
                        .withOptionBProperties(
                            new OptionBProperties()
                                .withImportRouteTargets(Arrays.asList("wqlepjj"))
                                .withExportRouteTargets(Arrays.asList("as"))
                                .withRouteTargets(
                                    new RouteTargetInformation()
                                        .withImportIpv4RouteTargets(Arrays.asList("ntogffjwajnrt"))
                                        .withImportIpv6RouteTargets(
                                            Arrays
                                                .asList(
                                                    "aqkifmxawostfz",
                                                    "nhrkmjqncfvdsc",
                                                    "hemvwfnqqwypvnd",
                                                    "wbgodtggrssg"))
                                        .withExportIpv4RouteTargets(Arrays.asList("kainjmuymvecvzt"))
                                        .withExportIpv6RouteTargets(
                                            Arrays.asList("gmusaictdscnkzzo", "nrddclzeqoz", "ehlbzqixbnjrqvzy"))))
                        .withOptionAProperties(
                            new VpnConfigurationPropertiesOptionAProperties()
                                .withMtu(1882838506)
                                .withVlanId(158915629)
                                .withPeerAsn(8483386639744134100L)
                                .withBfdConfiguration(
                                    new BfdConfiguration()
                                        .withIntervalInMilliSeconds(472275599)
                                        .withMultiplier(2139027754))
                                .withPrimaryIpv4Prefix("ozonynp")
                                .withPrimaryIpv6Prefix("eudpab")
                                .withSecondaryIpv4Prefix("euwzosgyjxvc")
                                .withSecondaryIpv6Prefix("sormrex")));
        model = BinaryData.fromObject(model).toObject(ManagementNetworkConfigurationProperties.class);
        Assertions.assertEquals("mkwjfbotl", model.infrastructureVpnConfiguration().networkToNetworkInterconnectId());
        Assertions.assertEquals(PeeringOption.OPTIONA, model.infrastructureVpnConfiguration().peeringOption());
        Assertions
            .assertEquals(
                "ursuivuxcjk", model.infrastructureVpnConfiguration().optionBProperties().importRouteTargets().get(0));
        Assertions
            .assertEquals("w", model.infrastructureVpnConfiguration().optionBProperties().exportRouteTargets().get(0));
        Assertions
            .assertEquals(
                "rizfwihvaang",
                model
                    .infrastructureVpnConfiguration()
                    .optionBProperties()
                    .routeTargets()
                    .importIpv4RouteTargets()
                    .get(0));
        Assertions
            .assertEquals(
                "wtgdfkkaui",
                model
                    .infrastructureVpnConfiguration()
                    .optionBProperties()
                    .routeTargets()
                    .importIpv6RouteTargets()
                    .get(0));
        Assertions
            .assertEquals(
                "cfkumcfjxo",
                model
                    .infrastructureVpnConfiguration()
                    .optionBProperties()
                    .routeTargets()
                    .exportIpv4RouteTargets()
                    .get(0));
        Assertions
            .assertEquals(
                "jqy",
                model
                    .infrastructureVpnConfiguration()
                    .optionBProperties()
                    .routeTargets()
                    .exportIpv6RouteTargets()
                    .get(0));
        Assertions.assertEquals(1855919116, model.infrastructureVpnConfiguration().optionAProperties().mtu());
        Assertions.assertEquals(761443572, model.infrastructureVpnConfiguration().optionAProperties().vlanId());
        Assertions
            .assertEquals(1689956278909975813L, model.infrastructureVpnConfiguration().optionAProperties().peerAsn());
        Assertions
            .assertEquals(
                1377813110,
                model.infrastructureVpnConfiguration().optionAProperties().bfdConfiguration().intervalInMilliSeconds());
        Assertions
            .assertEquals(
                1139650083, model.infrastructureVpnConfiguration().optionAProperties().bfdConfiguration().multiplier());
        Assertions
            .assertEquals(
                "oonsvobchkxfp", model.infrastructureVpnConfiguration().optionAProperties().primaryIpv4Prefix());
        Assertions
            .assertEquals(
                "dyslbklglmnn", model.infrastructureVpnConfiguration().optionAProperties().primaryIpv6Prefix());
        Assertions
            .assertEquals(
                "wayqshwyqxrid", model.infrastructureVpnConfiguration().optionAProperties().secondaryIpv4Prefix());
        Assertions
            .assertEquals("bsaqjm", model.infrastructureVpnConfiguration().optionAProperties().secondaryIpv6Prefix());
        Assertions.assertEquals("iizevjykofvez", model.workloadVpnConfiguration().networkToNetworkInterconnectId());
        Assertions.assertEquals(PeeringOption.OPTIONB, model.workloadVpnConfiguration().peeringOption());
        Assertions
            .assertEquals("wqlepjj", model.workloadVpnConfiguration().optionBProperties().importRouteTargets().get(0));
        Assertions.assertEquals("as", model.workloadVpnConfiguration().optionBProperties().exportRouteTargets().get(0));
        Assertions
            .assertEquals(
                "ntogffjwajnrt",
                model.workloadVpnConfiguration().optionBProperties().routeTargets().importIpv4RouteTargets().get(0));
        Assertions
            .assertEquals(
                "aqkifmxawostfz",
                model.workloadVpnConfiguration().optionBProperties().routeTargets().importIpv6RouteTargets().get(0));
        Assertions
            .assertEquals(
                "kainjmuymvecvzt",
                model.workloadVpnConfiguration().optionBProperties().routeTargets().exportIpv4RouteTargets().get(0));
        Assertions
            .assertEquals(
                "gmusaictdscnkzzo",
                model.workloadVpnConfiguration().optionBProperties().routeTargets().exportIpv6RouteTargets().get(0));
        Assertions.assertEquals(1882838506, model.workloadVpnConfiguration().optionAProperties().mtu());
        Assertions.assertEquals(158915629, model.workloadVpnConfiguration().optionAProperties().vlanId());
        Assertions.assertEquals(8483386639744134100L, model.workloadVpnConfiguration().optionAProperties().peerAsn());
        Assertions
            .assertEquals(
                472275599,
                model.workloadVpnConfiguration().optionAProperties().bfdConfiguration().intervalInMilliSeconds());
        Assertions
            .assertEquals(
                2139027754, model.workloadVpnConfiguration().optionAProperties().bfdConfiguration().multiplier());
        Assertions.assertEquals("ozonynp", model.workloadVpnConfiguration().optionAProperties().primaryIpv4Prefix());
        Assertions.assertEquals("eudpab", model.workloadVpnConfiguration().optionAProperties().primaryIpv6Prefix());
        Assertions
            .assertEquals("euwzosgyjxvc", model.workloadVpnConfiguration().optionAProperties().secondaryIpv4Prefix());
        Assertions.assertEquals("sormrex", model.workloadVpnConfiguration().optionAProperties().secondaryIpv6Prefix());
    }
}
