// 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.NetworkToNetworkInterconnectInner;
import com.azure.resourcemanager.managednetworkfabric.models.BooleanEnumProperty;
import com.azure.resourcemanager.managednetworkfabric.models.Layer2Configuration;
import com.azure.resourcemanager.managednetworkfabric.models.Layer3Configuration;
import com.azure.resourcemanager.managednetworkfabric.models.NniType;
import org.junit.jupiter.api.Assertions;

public final class NetworkToNetworkInterconnectInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        NetworkToNetworkInterconnectInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"nniType\":\"NPB\",\"administrativeState\":\"Disabled\",\"isManagementType\":\"True\",\"useOptionB\":\"True\",\"layer2Configuration\":{\"portCount\":1844509739,\"mtu\":497478941,\"interfaces\":[\"ecuijpxtxs\",\"wprtu\"]},\"layer3Configuration\":{\"importRoutePolicyId\":\"awddjibab\",\"exportRoutePolicyId\":\"ititvtzeexavoxt\",\"peerASN\":165499088,\"vlanId\":420576736,\"fabricASN\":36693026,\"primaryIpv4Prefix\":\"qbw\",\"primaryIpv6Prefix\":\"pqtgsfjac\",\"secondaryIpv4Prefix\":\"lhhxudbxvodhtnsi\",\"secondaryIpv6Prefix\":\"dhzmmesckdlp\"},\"provisioningState\":\"Failed\"},\"id\":\"cxfailcfxwmdboxd\",\"name\":\"gsftufqobrjlnacg\",\"type\":\"ckknhxkizvy\"}")
                .toObject(NetworkToNetworkInterconnectInner.class);
        Assertions.assertEquals(NniType.NPB, model.nniType());
        Assertions.assertEquals(BooleanEnumProperty.TRUE, model.isManagementType());
        Assertions.assertEquals(BooleanEnumProperty.TRUE, model.useOptionB());
        Assertions.assertEquals(1844509739, model.layer2Configuration().portCount());
        Assertions.assertEquals(497478941, model.layer2Configuration().mtu());
        Assertions.assertEquals("qbw", model.layer3Configuration().primaryIpv4Prefix());
        Assertions.assertEquals("pqtgsfjac", model.layer3Configuration().primaryIpv6Prefix());
        Assertions.assertEquals("lhhxudbxvodhtnsi", model.layer3Configuration().secondaryIpv4Prefix());
        Assertions.assertEquals("dhzmmesckdlp", model.layer3Configuration().secondaryIpv6Prefix());
        Assertions.assertEquals("awddjibab", model.layer3Configuration().importRoutePolicyId());
        Assertions.assertEquals("ititvtzeexavoxt", model.layer3Configuration().exportRoutePolicyId());
        Assertions.assertEquals(165499088, model.layer3Configuration().peerAsn());
        Assertions.assertEquals(420576736, model.layer3Configuration().vlanId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        NetworkToNetworkInterconnectInner model =
            new NetworkToNetworkInterconnectInner()
                .withNniType(NniType.NPB)
                .withIsManagementType(BooleanEnumProperty.TRUE)
                .withUseOptionB(BooleanEnumProperty.TRUE)
                .withLayer2Configuration(new Layer2Configuration().withPortCount(1844509739).withMtu(497478941))
                .withLayer3Configuration(
                    new Layer3Configuration()
                        .withPrimaryIpv4Prefix("qbw")
                        .withPrimaryIpv6Prefix("pqtgsfjac")
                        .withSecondaryIpv4Prefix("lhhxudbxvodhtnsi")
                        .withSecondaryIpv6Prefix("dhzmmesckdlp")
                        .withImportRoutePolicyId("awddjibab")
                        .withExportRoutePolicyId("ititvtzeexavoxt")
                        .withPeerAsn(165499088)
                        .withVlanId(420576736));
        model = BinaryData.fromObject(model).toObject(NetworkToNetworkInterconnectInner.class);
        Assertions.assertEquals(NniType.NPB, model.nniType());
        Assertions.assertEquals(BooleanEnumProperty.TRUE, model.isManagementType());
        Assertions.assertEquals(BooleanEnumProperty.TRUE, model.useOptionB());
        Assertions.assertEquals(1844509739, model.layer2Configuration().portCount());
        Assertions.assertEquals(497478941, model.layer2Configuration().mtu());
        Assertions.assertEquals("qbw", model.layer3Configuration().primaryIpv4Prefix());
        Assertions.assertEquals("pqtgsfjac", model.layer3Configuration().primaryIpv6Prefix());
        Assertions.assertEquals("lhhxudbxvodhtnsi", model.layer3Configuration().secondaryIpv4Prefix());
        Assertions.assertEquals("dhzmmesckdlp", model.layer3Configuration().secondaryIpv6Prefix());
        Assertions.assertEquals("awddjibab", model.layer3Configuration().importRoutePolicyId());
        Assertions.assertEquals("ititvtzeexavoxt", model.layer3Configuration().exportRoutePolicyId());
        Assertions.assertEquals(165499088, model.layer3Configuration().peerAsn());
        Assertions.assertEquals(420576736, model.layer3Configuration().vlanId());
    }
}
