// 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.fluent.models.InternalNetworkInner;
import com.azure.resourcemanager.managednetworkfabric.models.AllowASOverride;
import com.azure.resourcemanager.managednetworkfabric.models.BgpConfiguration;
import com.azure.resourcemanager.managednetworkfabric.models.BooleanEnumProperty;
import com.azure.resourcemanager.managednetworkfabric.models.ConnectedSubnet;
import com.azure.resourcemanager.managednetworkfabric.models.StaticRouteConfiguration;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class InternalNetworkInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        InternalNetworkInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"disabledOnResources\":[\"xobbcswsrt\",\"riplrbpbewtg\",\"fgb\"],\"administrativeState\":\"Enabled\",\"bgpDisabledOnResources\":[\"zvlvqhjkbegib\",\"nmxiebwwaloayqc\",\"wrtz\",\"uzgwyzmhtx\"],\"bfdDisabledOnResources\":[\"mtsavjcbpwxqp\",\"rknftguvriuhprwm\",\"yvxqtayriwwroy\",\"bexrmcq\"],\"bfdForStaticRoutesDisabledOnResources\":[\"cnojvknmefqsg\",\"vah\",\"pjyzhpv\",\"qzcjrvxdj\"],\"provisioningState\":\"Deleting\",\"vlanId\":1413734297,\"mtu\":391686670,\"connectedIPv4Subnets\":[{\"prefix\":\"gfhzovawjvzunlut\",\"annotation\":\"n\"}],\"connectedIPv6Subnets\":[{\"prefix\":\"i\",\"annotation\":\"ilpjzuaejxdult\"},{\"prefix\":\"zbbtdzumveek\",\"annotation\":\"wozuhkf\"}],\"staticRouteConfiguration\":{\"ipv4Routes\":[],\"ipv6Routes\":[]},\"bgpConfiguration\":{\"defaultRouteOriginate\":\"False\",\"allowAS\":522774709,\"allowASOverride\":\"Disable\",\"fabricASN\":1422945070,\"peerASN\":648396636,\"ipv4ListenRangePrefixes\":[\"boekqvkel\",\"smv\"],\"ipv6ListenRangePrefixes\":[\"yjsflhhcaalnji\",\"isxyawjoyaqcslyj\",\"kiidzyex\",\"nelixhnrztfo\"],\"ipv4NeighborAddress\":[],\"ipv6NeighborAddress\":[],\"annotation\":\"nalaulppg\"},\"importRoutePolicyId\":\"tpnapnyiropuhpig\",\"exportRoutePolicyId\":\"gylgqgitxmedjvcs\",\"annotation\":\"n\"},\"id\":\"wncwzzhxgktrmg\",\"name\":\"cnapkteoell\",\"type\":\"pt\"}")
                .toObject(InternalNetworkInner.class);
        Assertions.assertEquals(1413734297, model.vlanId());
        Assertions.assertEquals(391686670, model.mtu());
        Assertions.assertEquals("n", model.connectedIPv4Subnets().get(0).annotation());
        Assertions.assertEquals("gfhzovawjvzunlut", model.connectedIPv4Subnets().get(0).prefix());
        Assertions.assertEquals("ilpjzuaejxdult", model.connectedIPv6Subnets().get(0).annotation());
        Assertions.assertEquals("i", model.connectedIPv6Subnets().get(0).prefix());
        Assertions.assertEquals("nalaulppg", model.bgpConfiguration().annotation());
        Assertions.assertEquals(BooleanEnumProperty.FALSE, model.bgpConfiguration().defaultRouteOriginate());
        Assertions.assertEquals(522774709, model.bgpConfiguration().allowAS());
        Assertions.assertEquals(AllowASOverride.DISABLE, model.bgpConfiguration().allowASOverride());
        Assertions.assertEquals(648396636, model.bgpConfiguration().peerAsn());
        Assertions.assertEquals("boekqvkel", model.bgpConfiguration().ipv4ListenRangePrefixes().get(0));
        Assertions.assertEquals("yjsflhhcaalnji", model.bgpConfiguration().ipv6ListenRangePrefixes().get(0));
        Assertions.assertEquals("tpnapnyiropuhpig", model.importRoutePolicyId());
        Assertions.assertEquals("gylgqgitxmedjvcs", model.exportRoutePolicyId());
        Assertions.assertEquals("n", model.annotation());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        InternalNetworkInner model =
            new InternalNetworkInner()
                .withVlanId(1413734297)
                .withMtu(391686670)
                .withConnectedIPv4Subnets(
                    Arrays.asList(new ConnectedSubnet().withAnnotation("n").withPrefix("gfhzovawjvzunlut")))
                .withConnectedIPv6Subnets(
                    Arrays
                        .asList(
                            new ConnectedSubnet().withAnnotation("ilpjzuaejxdult").withPrefix("i"),
                            new ConnectedSubnet().withAnnotation("wozuhkf").withPrefix("zbbtdzumveek")))
                .withStaticRouteConfiguration(
                    new StaticRouteConfiguration().withIpv4Routes(Arrays.asList()).withIpv6Routes(Arrays.asList()))
                .withBgpConfiguration(
                    new BgpConfiguration()
                        .withAnnotation("nalaulppg")
                        .withDefaultRouteOriginate(BooleanEnumProperty.FALSE)
                        .withAllowAS(522774709)
                        .withAllowASOverride(AllowASOverride.DISABLE)
                        .withPeerAsn(648396636)
                        .withIpv4ListenRangePrefixes(Arrays.asList("boekqvkel", "smv"))
                        .withIpv6ListenRangePrefixes(
                            Arrays.asList("yjsflhhcaalnji", "isxyawjoyaqcslyj", "kiidzyex", "nelixhnrztfo"))
                        .withIpv4NeighborAddress(Arrays.asList())
                        .withIpv6NeighborAddress(Arrays.asList()))
                .withImportRoutePolicyId("tpnapnyiropuhpig")
                .withExportRoutePolicyId("gylgqgitxmedjvcs")
                .withAnnotation("n");
        model = BinaryData.fromObject(model).toObject(InternalNetworkInner.class);
        Assertions.assertEquals(1413734297, model.vlanId());
        Assertions.assertEquals(391686670, model.mtu());
        Assertions.assertEquals("n", model.connectedIPv4Subnets().get(0).annotation());
        Assertions.assertEquals("gfhzovawjvzunlut", model.connectedIPv4Subnets().get(0).prefix());
        Assertions.assertEquals("ilpjzuaejxdult", model.connectedIPv6Subnets().get(0).annotation());
        Assertions.assertEquals("i", model.connectedIPv6Subnets().get(0).prefix());
        Assertions.assertEquals("nalaulppg", model.bgpConfiguration().annotation());
        Assertions.assertEquals(BooleanEnumProperty.FALSE, model.bgpConfiguration().defaultRouteOriginate());
        Assertions.assertEquals(522774709, model.bgpConfiguration().allowAS());
        Assertions.assertEquals(AllowASOverride.DISABLE, model.bgpConfiguration().allowASOverride());
        Assertions.assertEquals(648396636, model.bgpConfiguration().peerAsn());
        Assertions.assertEquals("boekqvkel", model.bgpConfiguration().ipv4ListenRangePrefixes().get(0));
        Assertions.assertEquals("yjsflhhcaalnji", model.bgpConfiguration().ipv6ListenRangePrefixes().get(0));
        Assertions.assertEquals("tpnapnyiropuhpig", model.importRoutePolicyId());
        Assertions.assertEquals("gylgqgitxmedjvcs", model.exportRoutePolicyId());
        Assertions.assertEquals("n", model.annotation());
    }
}
