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

package com.azure.resourcemanager.vmwarecloudsimple.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.vmwarecloudsimple.fluent.models.VirtualMachineTemplateProperties;
import com.azure.resourcemanager.vmwarecloudsimple.fluent.models.VirtualNetworkInner;
import com.azure.resourcemanager.vmwarecloudsimple.fluent.models.VirtualNicInner;
import com.azure.resourcemanager.vmwarecloudsimple.models.DiskIndependenceMode;
import com.azure.resourcemanager.vmwarecloudsimple.models.GuestOsnicCustomization;
import com.azure.resourcemanager.vmwarecloudsimple.models.GuestOsnicCustomizationAllocation;
import com.azure.resourcemanager.vmwarecloudsimple.models.NicType;
import com.azure.resourcemanager.vmwarecloudsimple.models.VirtualDisk;
import com.azure.resourcemanager.vmwarecloudsimple.models.VirtualDiskController;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class VirtualMachineTemplatePropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        VirtualMachineTemplateProperties model =
            BinaryData
                .fromString(
                    "{\"amountOfRam\":1219903446,\"controllers\":[{\"id\":\"opppcqeq\",\"name\":\"lzdahzxctobgbkdm\",\"subType\":\"zpostmgrcfbu\",\"type\":\"mfqjhhkxbp\"},{\"id\":\"ymjhxxjyngudivkr\",\"name\":\"wbxqzvszjfau\",\"subType\":\"fdxxivetvtcqaqtd\",\"type\":\"mcbxvwvxysl\"},{\"id\":\"hsfxoblytkb\",\"name\":\"pe\",\"subType\":\"wfbkrvrns\",\"type\":\"hqjohxcrsbfova\"}],\"description\":\"ruvw\",\"disks\":[{\"controllerId\":\"qfsubcgjbirx\",\"independenceMode\":\"independent_persistent\",\"totalSize\":1282258802,\"virtualDiskId\":\"srfbjfdtwss\",\"virtualDiskName\":\"ftpvjzbexil\"},{\"controllerId\":\"znfqqnvwpmqtar\",\"independenceMode\":\"persistent\",\"totalSize\":477944589,\"virtualDiskId\":\"mkcjhwqytjrybn\",\"virtualDiskName\":\"ewgdrjervn\"},{\"controllerId\":\"enq\",\"independenceMode\":\"independent_persistent\",\"totalSize\":682074960,\"virtualDiskId\":\"ndoygmifthnzdnd\",\"virtualDiskName\":\"gnayqigynduh\"},{\"controllerId\":\"vhqlkthumaqo\",\"independenceMode\":\"independent_nonpersistent\",\"totalSize\":1315398087,\"virtualDiskId\":\"cdui\",\"virtualDiskName\":\"tgccymvaolpss\"}],\"exposeToGuestVM\":true,\"guestOS\":\"mmdnbbglzps\",\"guestOSType\":\"ydmcwyhzdxssa\",\"nics\":[{\"customization\":{\"allocation\":\"dynamic\",\"dnsServers\":[],\"gateway\":[],\"ipAddress\":\"n\",\"mask\":\"ao\",\"primaryWinsServer\":\"xzb\",\"secondaryWinsServer\":\"blylpstdbh\"},\"ipAddresses\":[\"rzdzucerscdnt\",\"evfiwjmygt\",\"sslswtmweriof\",\"pyqs\"],\"macAddress\":\"wab\",\"network\":{\"assignable\":true,\"id\":\"shhszhedplvwiw\",\"location\":\"mwmbes\",\"name\":\"nkww\",\"type\":\"jflcxog\"},\"nicType\":\"E1000\",\"powerOnBoot\":false,\"virtualNicId\":\"z\",\"virtualNicName\":\"sikvmkqzeqqkdlt\"},{\"customization\":{\"allocation\":\"static\",\"dnsServers\":[],\"gateway\":[],\"ipAddress\":\"hgure\",\"mask\":\"kwobdagxtibq\",\"primaryWinsServer\":\"bxwakbog\",\"secondaryWinsServer\":\"ndlkzgxhurip\"},\"ipAddresses\":[\"odxun\",\"bebxmubyyntwl\"],\"macAddress\":\"qtkoievs\",\"network\":{\"assignable\":false,\"id\":\"gqrlltmuwla\",\"location\":\"zizxbmpgcj\",\"name\":\"u\",\"type\":\"vpbttd\"},\"nicType\":\"PCNET32\",\"powerOnBoot\":false,\"virtualNicId\":\"pxebmnzbt\",\"virtualNicName\":\"jpglkfgohdne\"},{\"customization\":{\"allocation\":\"dynamic\",\"dnsServers\":[],\"gateway\":[],\"ipAddress\":\"dyhtozfikdowwquu\",\"mask\":\"zx\",\"primaryWinsServer\":\"vithh\",\"secondaryWinsServer\":\"o\"},\"ipAddresses\":[\"ggbhcohfwds\"],\"macAddress\":\"ka\",\"network\":{\"assignable\":true,\"id\":\"tiiswacffg\",\"location\":\"zzewkfvhqcrai\",\"name\":\"pnppfuf\",\"type\":\"dmhdlxyjr\"},\"nicType\":\"VMXNET3\",\"powerOnBoot\":true,\"virtualNicId\":\"fcnihgwq\",\"virtualNicName\":\"nedgfbc\"},{\"customization\":{\"allocation\":\"static\",\"dnsServers\":[],\"gateway\":[],\"ipAddress\":\"keqdcvdrhvoods\",\"mask\":\"bobzdopcjwvnhd\",\"primaryWinsServer\":\"wmgxcxrsl\",\"secondaryWinsServer\":\"utwu\"},\"ipAddresses\":[\"rpkhjwn\",\"yqsluic\",\"dggkzzlvmbmpa\"],\"macAddress\":\"odfvuefywsbp\",\"network\":{\"assignable\":false,\"id\":\"wyhrfouyftaakc\",\"location\":\"iyzvqtmnub\",\"name\":\"kpzksmondjmq\",\"type\":\"ypomgkopkwho\"},\"nicType\":\"VMXNET\",\"powerOnBoot\":false,\"virtualNicId\":\"qgxy\",\"virtualNicName\":\"ocmbqfqvmkcxoza\"}],\"numberOfCores\":294676582,\"path\":\"lxprglyatddckcbc\",\"privateCloudId\":\"ejrjxgciqibrho\",\"vSphereNetworks\":[\"dqrhzoymib\",\"rq\",\"ibahwflus\",\"dtmhrkwofyyvoqa\"],\"vSphereTags\":[\"expbtg\",\"wbwo\",\"nwashrtd\"],\"vmwaretools\":\"cnqxwbpokulpi\"}")
                .toObject(VirtualMachineTemplateProperties.class);
        Assertions.assertEquals(1219903446, model.amountOfRam());
        Assertions.assertEquals("ruvw", model.description());
        Assertions.assertEquals("qfsubcgjbirx", model.disks().get(0).controllerId());
        Assertions.assertEquals(DiskIndependenceMode.INDEPENDENT_PERSISTENT, model.disks().get(0).independenceMode());
        Assertions.assertEquals(1282258802, model.disks().get(0).totalSize());
        Assertions.assertEquals("srfbjfdtwss", model.disks().get(0).virtualDiskId());
        Assertions.assertEquals(true, model.exposeToGuestVM());
        Assertions
            .assertEquals(GuestOsnicCustomizationAllocation.DYNAMIC, model.nics().get(0).customization().allocation());
        Assertions.assertEquals("n", model.nics().get(0).customization().ipAddress());
        Assertions.assertEquals("ao", model.nics().get(0).customization().mask());
        Assertions.assertEquals("xzb", model.nics().get(0).customization().primaryWinsServer());
        Assertions.assertEquals("blylpstdbh", model.nics().get(0).customization().secondaryWinsServer());
        Assertions.assertEquals("rzdzucerscdnt", model.nics().get(0).ipAddresses().get(0));
        Assertions.assertEquals("wab", model.nics().get(0).macAddress());
        Assertions.assertEquals("shhszhedplvwiw", model.nics().get(0).network().id());
        Assertions.assertEquals(NicType.E1000, model.nics().get(0).nicType());
        Assertions.assertEquals(false, model.nics().get(0).powerOnBoot());
        Assertions.assertEquals("z", model.nics().get(0).virtualNicId());
        Assertions.assertEquals(294676582, model.numberOfCores());
        Assertions.assertEquals("lxprglyatddckcbc", model.path());
        Assertions.assertEquals("ejrjxgciqibrho", model.privateCloudId());
        Assertions.assertEquals("dqrhzoymib", model.vSphereNetworks().get(0));
        Assertions.assertEquals("expbtg", model.vSphereTags().get(0));
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        VirtualMachineTemplateProperties model =
            new VirtualMachineTemplateProperties()
                .withAmountOfRam(1219903446)
                .withControllers(
                    Arrays
                        .asList(new VirtualDiskController(), new VirtualDiskController(), new VirtualDiskController()))
                .withDescription("ruvw")
                .withDisks(
                    Arrays
                        .asList(
                            new VirtualDisk()
                                .withControllerId("qfsubcgjbirx")
                                .withIndependenceMode(DiskIndependenceMode.INDEPENDENT_PERSISTENT)
                                .withTotalSize(1282258802)
                                .withVirtualDiskId("srfbjfdtwss"),
                            new VirtualDisk()
                                .withControllerId("znfqqnvwpmqtar")
                                .withIndependenceMode(DiskIndependenceMode.PERSISTENT)
                                .withTotalSize(477944589)
                                .withVirtualDiskId("mkcjhwqytjrybn"),
                            new VirtualDisk()
                                .withControllerId("enq")
                                .withIndependenceMode(DiskIndependenceMode.INDEPENDENT_PERSISTENT)
                                .withTotalSize(682074960)
                                .withVirtualDiskId("ndoygmifthnzdnd"),
                            new VirtualDisk()
                                .withControllerId("vhqlkthumaqo")
                                .withIndependenceMode(DiskIndependenceMode.INDEPENDENT_NONPERSISTENT)
                                .withTotalSize(1315398087)
                                .withVirtualDiskId("cdui")))
                .withExposeToGuestVM(true)
                .withNics(
                    Arrays
                        .asList(
                            new VirtualNicInner()
                                .withCustomization(
                                    new GuestOsnicCustomization()
                                        .withAllocation(GuestOsnicCustomizationAllocation.DYNAMIC)
                                        .withDnsServers(Arrays.asList())
                                        .withGateway(Arrays.asList())
                                        .withIpAddress("n")
                                        .withMask("ao")
                                        .withPrimaryWinsServer("xzb")
                                        .withSecondaryWinsServer("blylpstdbh"))
                                .withIpAddresses(Arrays.asList("rzdzucerscdnt", "evfiwjmygt", "sslswtmweriof", "pyqs"))
                                .withMacAddress("wab")
                                .withNetwork(new VirtualNetworkInner().withId("shhszhedplvwiw"))
                                .withNicType(NicType.E1000)
                                .withPowerOnBoot(false)
                                .withVirtualNicId("z"),
                            new VirtualNicInner()
                                .withCustomization(
                                    new GuestOsnicCustomization()
                                        .withAllocation(GuestOsnicCustomizationAllocation.STATIC)
                                        .withDnsServers(Arrays.asList())
                                        .withGateway(Arrays.asList())
                                        .withIpAddress("hgure")
                                        .withMask("kwobdagxtibq")
                                        .withPrimaryWinsServer("bxwakbog")
                                        .withSecondaryWinsServer("ndlkzgxhurip"))
                                .withIpAddresses(Arrays.asList("odxun", "bebxmubyyntwl"))
                                .withMacAddress("qtkoievs")
                                .withNetwork(new VirtualNetworkInner().withId("gqrlltmuwla"))
                                .withNicType(NicType.PCNET32)
                                .withPowerOnBoot(false)
                                .withVirtualNicId("pxebmnzbt"),
                            new VirtualNicInner()
                                .withCustomization(
                                    new GuestOsnicCustomization()
                                        .withAllocation(GuestOsnicCustomizationAllocation.DYNAMIC)
                                        .withDnsServers(Arrays.asList())
                                        .withGateway(Arrays.asList())
                                        .withIpAddress("dyhtozfikdowwquu")
                                        .withMask("zx")
                                        .withPrimaryWinsServer("vithh")
                                        .withSecondaryWinsServer("o"))
                                .withIpAddresses(Arrays.asList("ggbhcohfwds"))
                                .withMacAddress("ka")
                                .withNetwork(new VirtualNetworkInner().withId("tiiswacffg"))
                                .withNicType(NicType.VMXNET3)
                                .withPowerOnBoot(true)
                                .withVirtualNicId("fcnihgwq"),
                            new VirtualNicInner()
                                .withCustomization(
                                    new GuestOsnicCustomization()
                                        .withAllocation(GuestOsnicCustomizationAllocation.STATIC)
                                        .withDnsServers(Arrays.asList())
                                        .withGateway(Arrays.asList())
                                        .withIpAddress("keqdcvdrhvoods")
                                        .withMask("bobzdopcjwvnhd")
                                        .withPrimaryWinsServer("wmgxcxrsl")
                                        .withSecondaryWinsServer("utwu"))
                                .withIpAddresses(Arrays.asList("rpkhjwn", "yqsluic", "dggkzzlvmbmpa"))
                                .withMacAddress("odfvuefywsbp")
                                .withNetwork(new VirtualNetworkInner().withId("wyhrfouyftaakc"))
                                .withNicType(NicType.VMXNET)
                                .withPowerOnBoot(false)
                                .withVirtualNicId("qgxy")))
                .withNumberOfCores(294676582)
                .withPath("lxprglyatddckcbc")
                .withPrivateCloudId("ejrjxgciqibrho")
                .withVSphereNetworks(Arrays.asList("dqrhzoymib", "rq", "ibahwflus", "dtmhrkwofyyvoqa"))
                .withVSphereTags(Arrays.asList("expbtg", "wbwo", "nwashrtd"));
        model = BinaryData.fromObject(model).toObject(VirtualMachineTemplateProperties.class);
        Assertions.assertEquals(1219903446, model.amountOfRam());
        Assertions.assertEquals("ruvw", model.description());
        Assertions.assertEquals("qfsubcgjbirx", model.disks().get(0).controllerId());
        Assertions.assertEquals(DiskIndependenceMode.INDEPENDENT_PERSISTENT, model.disks().get(0).independenceMode());
        Assertions.assertEquals(1282258802, model.disks().get(0).totalSize());
        Assertions.assertEquals("srfbjfdtwss", model.disks().get(0).virtualDiskId());
        Assertions.assertEquals(true, model.exposeToGuestVM());
        Assertions
            .assertEquals(GuestOsnicCustomizationAllocation.DYNAMIC, model.nics().get(0).customization().allocation());
        Assertions.assertEquals("n", model.nics().get(0).customization().ipAddress());
        Assertions.assertEquals("ao", model.nics().get(0).customization().mask());
        Assertions.assertEquals("xzb", model.nics().get(0).customization().primaryWinsServer());
        Assertions.assertEquals("blylpstdbh", model.nics().get(0).customization().secondaryWinsServer());
        Assertions.assertEquals("rzdzucerscdnt", model.nics().get(0).ipAddresses().get(0));
        Assertions.assertEquals("wab", model.nics().get(0).macAddress());
        Assertions.assertEquals("shhszhedplvwiw", model.nics().get(0).network().id());
        Assertions.assertEquals(NicType.E1000, model.nics().get(0).nicType());
        Assertions.assertEquals(false, model.nics().get(0).powerOnBoot());
        Assertions.assertEquals("z", model.nics().get(0).virtualNicId());
        Assertions.assertEquals(294676582, model.numberOfCores());
        Assertions.assertEquals("lxprglyatddckcbc", model.path());
        Assertions.assertEquals("ejrjxgciqibrho", model.privateCloudId());
        Assertions.assertEquals("dqrhzoymib", model.vSphereNetworks().get(0));
        Assertions.assertEquals("expbtg", model.vSphereTags().get(0));
    }
}
