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

package com.azure.resourcemanager.hybridcontainerservice.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.hybridcontainerservice.models.VirtualNetworksProperties;
import com.azure.resourcemanager.hybridcontainerservice.models.VirtualNetworksPropertiesInfraVnetProfile;
import com.azure.resourcemanager.hybridcontainerservice.models.VirtualNetworksPropertiesInfraVnetProfileHci;
import com.azure.resourcemanager.hybridcontainerservice.models.VirtualNetworksPropertiesInfraVnetProfileNetworkCloud;
import com.azure.resourcemanager.hybridcontainerservice.models.VirtualNetworksPropertiesInfraVnetProfileVmware;
import com.azure.resourcemanager.hybridcontainerservice.models.VirtualNetworksPropertiesVipPoolItem;
import com.azure.resourcemanager.hybridcontainerservice.models.VirtualNetworksPropertiesVmipPoolItem;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class VirtualNetworksPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        VirtualNetworksProperties model =
            BinaryData
                .fromString(
                    "{\"infraVnetProfile\":{\"hci\":{\"mocGroup\":\"jjcanvxbvtv\",\"mocLocation\":\"utncorm\",\"mocVnetName\":\"xqtvcofu\"},\"networkCloud\":{\"networkId\":\"vkg\"},\"vmware\":{\"segmentName\":\"gdknnqv\"}},\"vipPool\":[{\"endIP\":\"qntorudsgsahmkyc\",\"startIP\":\"auwjuetaebu\"},{\"endIP\":\"vdmovsmzlxwabm\",\"startIP\":\"efkifr\"}],\"vmipPool\":[{\"endIP\":\"qujmqlgkf\",\"startIP\":\"ndo\"},{\"endIP\":\"n\",\"startIP\":\"jcntuj\"},{\"endIP\":\"c\",\"startIP\":\"df\"},{\"endIP\":\"waezkojvd\",\"startIP\":\"zfoqouicybxar\"}],\"dhcpServers\":[\"zuf\",\"x\",\"iqopidoamciod\",\"khazxkhnzbonlwn\"],\"dnsServers\":[\"gokdwbwhks\",\"zcmrvexztvb\",\"qgsfraoyzkoow\",\"lmnguxaw\"],\"gateway\":\"ldsyuuximerqfob\",\"ipAddressPrefix\":\"znkbykutwpfhpagm\",\"vlanID\":\"skdsnfdsdoakg\",\"provisioningState\":\"Failed\",\"status\":{\"provisioningStatus\":{\"operationId\":\"evdlh\",\"phase\":\"pusdstt\",\"status\":\"ogvbbejdcngq\"}}}")
                .toObject(VirtualNetworksProperties.class);
        Assertions.assertEquals("jjcanvxbvtv", model.infraVnetProfile().hci().mocGroup());
        Assertions.assertEquals("utncorm", model.infraVnetProfile().hci().mocLocation());
        Assertions.assertEquals("xqtvcofu", model.infraVnetProfile().hci().mocVnetName());
        Assertions.assertEquals("vkg", model.infraVnetProfile().networkCloud().networkId());
        Assertions.assertEquals("gdknnqv", model.infraVnetProfile().vmware().segmentName());
        Assertions.assertEquals("qntorudsgsahmkyc", model.vipPool().get(0).endIp());
        Assertions.assertEquals("auwjuetaebu", model.vipPool().get(0).startIp());
        Assertions.assertEquals("qujmqlgkf", model.vmipPool().get(0).endIp());
        Assertions.assertEquals("ndo", model.vmipPool().get(0).startIp());
        Assertions.assertEquals("gokdwbwhks", model.dnsServers().get(0));
        Assertions.assertEquals("ldsyuuximerqfob", model.gateway());
        Assertions.assertEquals("znkbykutwpfhpagm", model.ipAddressPrefix());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        VirtualNetworksProperties model =
            new VirtualNetworksProperties()
                .withInfraVnetProfile(
                    new VirtualNetworksPropertiesInfraVnetProfile()
                        .withHci(
                            new VirtualNetworksPropertiesInfraVnetProfileHci()
                                .withMocGroup("jjcanvxbvtv")
                                .withMocLocation("utncorm")
                                .withMocVnetName("xqtvcofu"))
                        .withNetworkCloud(
                            new VirtualNetworksPropertiesInfraVnetProfileNetworkCloud().withNetworkId("vkg"))
                        .withVmware(new VirtualNetworksPropertiesInfraVnetProfileVmware().withSegmentName("gdknnqv")))
                .withVipPool(
                    Arrays
                        .asList(
                            new VirtualNetworksPropertiesVipPoolItem()
                                .withEndIp("qntorudsgsahmkyc")
                                .withStartIp("auwjuetaebu"),
                            new VirtualNetworksPropertiesVipPoolItem()
                                .withEndIp("vdmovsmzlxwabm")
                                .withStartIp("efkifr")))
                .withVmipPool(
                    Arrays
                        .asList(
                            new VirtualNetworksPropertiesVmipPoolItem().withEndIp("qujmqlgkf").withStartIp("ndo"),
                            new VirtualNetworksPropertiesVmipPoolItem().withEndIp("n").withStartIp("jcntuj"),
                            new VirtualNetworksPropertiesVmipPoolItem().withEndIp("c").withStartIp("df"),
                            new VirtualNetworksPropertiesVmipPoolItem()
                                .withEndIp("waezkojvd")
                                .withStartIp("zfoqouicybxar")))
                .withDnsServers(Arrays.asList("gokdwbwhks", "zcmrvexztvb", "qgsfraoyzkoow", "lmnguxaw"))
                .withGateway("ldsyuuximerqfob")
                .withIpAddressPrefix("znkbykutwpfhpagm");
        model = BinaryData.fromObject(model).toObject(VirtualNetworksProperties.class);
        Assertions.assertEquals("jjcanvxbvtv", model.infraVnetProfile().hci().mocGroup());
        Assertions.assertEquals("utncorm", model.infraVnetProfile().hci().mocLocation());
        Assertions.assertEquals("xqtvcofu", model.infraVnetProfile().hci().mocVnetName());
        Assertions.assertEquals("vkg", model.infraVnetProfile().networkCloud().networkId());
        Assertions.assertEquals("gdknnqv", model.infraVnetProfile().vmware().segmentName());
        Assertions.assertEquals("qntorudsgsahmkyc", model.vipPool().get(0).endIp());
        Assertions.assertEquals("auwjuetaebu", model.vipPool().get(0).startIp());
        Assertions.assertEquals("qujmqlgkf", model.vmipPool().get(0).endIp());
        Assertions.assertEquals("ndo", model.vmipPool().get(0).startIp());
        Assertions.assertEquals("gokdwbwhks", model.dnsServers().get(0));
        Assertions.assertEquals("ldsyuuximerqfob", model.gateway());
        Assertions.assertEquals("znkbykutwpfhpagm", model.ipAddressPrefix());
    }
}
