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

package com.azure.resourcemanager.paloaltonetworks.ngfw.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.EgressNat;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.IpAddress;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.IpAddressSpace;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.NetworkProfile;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.NetworkType;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.VnetConfiguration;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.VwanConfiguration;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class NetworkProfileTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        NetworkProfile model =
            BinaryData
                .fromString(
                    "{\"vnetConfiguration\":{\"vnet\":{\"resourceId\":\"ab\",\"addressSpace\":\"oefki\"},\"trustSubnet\":{\"resourceId\":\"vtpuqujmqlgk\",\"addressSpace\":\"tndoaongbjc\"},\"unTrustSubnet\":{\"resourceId\":\"ujitcjedftww\",\"addressSpace\":\"zkoj\"},\"ipOfTrustSubnetForUdr\":{\"resourceId\":\"pzfoqoui\",\"address\":\"bxarzgszufoxci\"}},\"vwanConfiguration\":{\"networkVirtualApplianceId\":\"idoamciodhkha\",\"vHub\":{\"resourceId\":\"khnzbonlw\",\"addressSpace\":\"oegokdwbwh\"},\"trustSubnet\":{\"resourceId\":\"zcmrvexztvb\",\"addressSpace\":\"gsfraoyzkoow\"},\"unTrustSubnet\":{\"resourceId\":\"nguxawqaldsy\",\"addressSpace\":\"ximerqfobwyznk\"},\"ipOfTrustSubnetForUdr\":{\"resourceId\":\"utwpfhp\",\"address\":\"m\"}},\"networkType\":\"VNET\",\"publicIps\":[{\"resourceId\":\"dsnfdsdoakgtdl\",\"address\":\"kzevdlhewpusds\"},{\"resourceId\":\"wvogvbbejdc\",\"address\":\"qqmoaku\"},{\"resourceId\":\"m\",\"address\":\"rwr\"},{\"resourceId\":\"rtwaenuuzko\",\"address\":\"minrfdw\"}],\"enableEgressNat\":\"DISABLED\",\"egressNatIp\":[{\"resourceId\":\"ziuiefozbhdm\",\"address\":\"l\"},{\"resourceId\":\"qhoftrmaequiah\",\"address\":\"cslfaoqzpiyylha\"}]}")
                .toObject(NetworkProfile.class);
        Assertions.assertEquals("ab", model.vnetConfiguration().vnet().resourceId());
        Assertions.assertEquals("oefki", model.vnetConfiguration().vnet().addressSpace());
        Assertions.assertEquals("vtpuqujmqlgk", model.vnetConfiguration().trustSubnet().resourceId());
        Assertions.assertEquals("tndoaongbjc", model.vnetConfiguration().trustSubnet().addressSpace());
        Assertions.assertEquals("ujitcjedftww", model.vnetConfiguration().unTrustSubnet().resourceId());
        Assertions.assertEquals("zkoj", model.vnetConfiguration().unTrustSubnet().addressSpace());
        Assertions.assertEquals("pzfoqoui", model.vnetConfiguration().ipOfTrustSubnetForUdr().resourceId());
        Assertions.assertEquals("bxarzgszufoxci", model.vnetConfiguration().ipOfTrustSubnetForUdr().address());
        Assertions.assertEquals("idoamciodhkha", model.vwanConfiguration().networkVirtualApplianceId());
        Assertions.assertEquals("khnzbonlw", model.vwanConfiguration().vHub().resourceId());
        Assertions.assertEquals("oegokdwbwh", model.vwanConfiguration().vHub().addressSpace());
        Assertions.assertEquals("zcmrvexztvb", model.vwanConfiguration().trustSubnet().resourceId());
        Assertions.assertEquals("gsfraoyzkoow", model.vwanConfiguration().trustSubnet().addressSpace());
        Assertions.assertEquals("nguxawqaldsy", model.vwanConfiguration().unTrustSubnet().resourceId());
        Assertions.assertEquals("ximerqfobwyznk", model.vwanConfiguration().unTrustSubnet().addressSpace());
        Assertions.assertEquals("utwpfhp", model.vwanConfiguration().ipOfTrustSubnetForUdr().resourceId());
        Assertions.assertEquals("m", model.vwanConfiguration().ipOfTrustSubnetForUdr().address());
        Assertions.assertEquals(NetworkType.VNET, model.networkType());
        Assertions.assertEquals("dsnfdsdoakgtdl", model.publicIps().get(0).resourceId());
        Assertions.assertEquals("kzevdlhewpusds", model.publicIps().get(0).address());
        Assertions.assertEquals(EgressNat.DISABLED, model.enableEgressNat());
        Assertions.assertEquals("ziuiefozbhdm", model.egressNatIp().get(0).resourceId());
        Assertions.assertEquals("l", model.egressNatIp().get(0).address());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        NetworkProfile model =
            new NetworkProfile()
                .withVnetConfiguration(
                    new VnetConfiguration()
                        .withVnet(new IpAddressSpace().withResourceId("ab").withAddressSpace("oefki"))
                        .withTrustSubnet(
                            new IpAddressSpace().withResourceId("vtpuqujmqlgk").withAddressSpace("tndoaongbjc"))
                        .withUnTrustSubnet(new IpAddressSpace().withResourceId("ujitcjedftww").withAddressSpace("zkoj"))
                        .withIpOfTrustSubnetForUdr(
                            new IpAddress().withResourceId("pzfoqoui").withAddress("bxarzgszufoxci")))
                .withVwanConfiguration(
                    new VwanConfiguration()
                        .withNetworkVirtualApplianceId("idoamciodhkha")
                        .withVHub(new IpAddressSpace().withResourceId("khnzbonlw").withAddressSpace("oegokdwbwh"))
                        .withTrustSubnet(
                            new IpAddressSpace().withResourceId("zcmrvexztvb").withAddressSpace("gsfraoyzkoow"))
                        .withUnTrustSubnet(
                            new IpAddressSpace().withResourceId("nguxawqaldsy").withAddressSpace("ximerqfobwyznk"))
                        .withIpOfTrustSubnetForUdr(new IpAddress().withResourceId("utwpfhp").withAddress("m")))
                .withNetworkType(NetworkType.VNET)
                .withPublicIps(
                    Arrays
                        .asList(
                            new IpAddress().withResourceId("dsnfdsdoakgtdl").withAddress("kzevdlhewpusds"),
                            new IpAddress().withResourceId("wvogvbbejdc").withAddress("qqmoaku"),
                            new IpAddress().withResourceId("m").withAddress("rwr"),
                            new IpAddress().withResourceId("rtwaenuuzko").withAddress("minrfdw")))
                .withEnableEgressNat(EgressNat.DISABLED)
                .withEgressNatIp(
                    Arrays
                        .asList(
                            new IpAddress().withResourceId("ziuiefozbhdm").withAddress("l"),
                            new IpAddress().withResourceId("qhoftrmaequiah").withAddress("cslfaoqzpiyylha")));
        model = BinaryData.fromObject(model).toObject(NetworkProfile.class);
        Assertions.assertEquals("ab", model.vnetConfiguration().vnet().resourceId());
        Assertions.assertEquals("oefki", model.vnetConfiguration().vnet().addressSpace());
        Assertions.assertEquals("vtpuqujmqlgk", model.vnetConfiguration().trustSubnet().resourceId());
        Assertions.assertEquals("tndoaongbjc", model.vnetConfiguration().trustSubnet().addressSpace());
        Assertions.assertEquals("ujitcjedftww", model.vnetConfiguration().unTrustSubnet().resourceId());
        Assertions.assertEquals("zkoj", model.vnetConfiguration().unTrustSubnet().addressSpace());
        Assertions.assertEquals("pzfoqoui", model.vnetConfiguration().ipOfTrustSubnetForUdr().resourceId());
        Assertions.assertEquals("bxarzgszufoxci", model.vnetConfiguration().ipOfTrustSubnetForUdr().address());
        Assertions.assertEquals("idoamciodhkha", model.vwanConfiguration().networkVirtualApplianceId());
        Assertions.assertEquals("khnzbonlw", model.vwanConfiguration().vHub().resourceId());
        Assertions.assertEquals("oegokdwbwh", model.vwanConfiguration().vHub().addressSpace());
        Assertions.assertEquals("zcmrvexztvb", model.vwanConfiguration().trustSubnet().resourceId());
        Assertions.assertEquals("gsfraoyzkoow", model.vwanConfiguration().trustSubnet().addressSpace());
        Assertions.assertEquals("nguxawqaldsy", model.vwanConfiguration().unTrustSubnet().resourceId());
        Assertions.assertEquals("ximerqfobwyznk", model.vwanConfiguration().unTrustSubnet().addressSpace());
        Assertions.assertEquals("utwpfhp", model.vwanConfiguration().ipOfTrustSubnetForUdr().resourceId());
        Assertions.assertEquals("m", model.vwanConfiguration().ipOfTrustSubnetForUdr().address());
        Assertions.assertEquals(NetworkType.VNET, model.networkType());
        Assertions.assertEquals("dsnfdsdoakgtdl", model.publicIps().get(0).resourceId());
        Assertions.assertEquals("kzevdlhewpusds", model.publicIps().get(0).address());
        Assertions.assertEquals(EgressNat.DISABLED, model.enableEgressNat());
        Assertions.assertEquals("ziuiefozbhdm", model.egressNatIp().get(0).resourceId());
        Assertions.assertEquals("l", model.egressNatIp().get(0).address());
    }
}
