// 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.PrivateCloudInner;
import com.azure.resourcemanager.vmwarecloudsimple.fluent.models.ResourcePoolInner;
import com.azure.resourcemanager.vmwarecloudsimple.fluent.models.VirtualMachineTemplateInner;
import com.azure.resourcemanager.vmwarecloudsimple.fluent.models.VirtualNetworkInner;
import com.azure.resourcemanager.vmwarecloudsimple.models.PrivateCloudResourceType;
import java.time.OffsetDateTime;
import java.util.Arrays;
import java.util.UUID;
import org.junit.jupiter.api.Assertions;

public final class PrivateCloudInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PrivateCloudInner model =
            BinaryData
                .fromString(
                    "{\"id\":\"o\",\"location\":\"ocfs\",\"name\":\"s\",\"properties\":{\"availabilityZoneId\":\"dystkiiuxhqyud\",\"availabilityZoneName\":\"rrqnbpoczvyifqrv\",\"clustersNumber\":983918139,\"createdBy\":\"sllr\",\"createdOn\":\"2021-05-18T15:53:17Z\",\"dnsServers\":[\"watkpnpulexxb\"],\"expires\":\"wtruwiqzbqjvsovm\",\"nsxType\":\"kacspkw\",\"placementGroupId\":\"zdobpxjmflbvvnch\",\"placementGroupName\":\"cciw\",\"privateCloudId\":\"49493dc4-f278-4e0c-b59d-4f897063ff79\",\"resourcePools\":[{\"id\":\"qkhr\",\"location\":\"jiwkuofoskghsau\",\"name\":\"mjmvxieduugidyjr\",\"privateCloudId\":\"byao\",\"type\":\"xc\"},{\"id\":\"onpc\",\"location\":\"ocohslkevleg\",\"name\":\"fbuhfmvfaxkffe\",\"privateCloudId\":\"th\",\"type\":\"ez\"},{\"id\":\"v\",\"location\":\"xmzsbbzogg\",\"name\":\"rxwburv\",\"privateCloudId\":\"xjnspy\",\"type\":\"koen\"}],\"state\":\"uknvudwti\",\"totalCpuCores\":133898645,\"totalNodes\":580602799,\"totalRam\":1236477167,\"totalStorage\":78.48933,\"type\":\"cipazyxoegukgjnp\",\"vSphereVersion\":\"cgygev\",\"vcenterFqdn\":\"ntypmrbpizcdrqj\",\"vcenterRefid\":\"pyd\",\"virtualMachineTemplates\":[{\"id\":\"xdeoejzic\",\"location\":\"fsj\",\"name\":\"gzfbishcbk\",\"type\":\"deyeamdphagalpbu\"},{\"id\":\"gipwhonowkg\",\"location\":\"wankixzbi\",\"name\":\"eputtmrywnuzoqf\",\"type\":\"qzrnkcqvyxlwhz\"},{\"id\":\"icohoqqnwvl\",\"location\":\"avwhheunm\",\"name\":\"hgyxzkonoc\",\"type\":\"klyaxuconu\"},{\"id\":\"zf\",\"location\":\"eyp\",\"name\":\"rmjmwvvjektc\",\"type\":\"nhwlrsffrzpwvl\"}],\"virtualNetworks\":[{\"assignable\":true,\"id\":\"iqylihkaetck\",\"location\":\"fcivfsnkym\",\"name\":\"tqhjfbebrjcx\",\"type\":\"uwutttxfvjrbi\"}],\"vrOpsEnabled\":true},\"type\":\"Microsoft.VMwareCloudSimple/privateClouds\"}")
                .toObject(PrivateCloudInner.class);
        Assertions.assertEquals("o", model.id());
        Assertions.assertEquals("ocfs", model.location());
        Assertions.assertEquals("s", model.name());
        Assertions.assertEquals(PrivateCloudResourceType.MICROSOFT_VMWARE_CLOUD_SIMPLE_PRIVATE_CLOUDS, model.type());
        Assertions.assertEquals("dystkiiuxhqyud", model.availabilityZoneId());
        Assertions.assertEquals("rrqnbpoczvyifqrv", model.availabilityZoneName());
        Assertions.assertEquals(983918139, model.clustersNumber());
        Assertions.assertEquals("sllr", model.createdBy());
        Assertions.assertEquals(OffsetDateTime.parse("2021-05-18T15:53:17Z"), model.createdOn());
        Assertions.assertEquals("watkpnpulexxb", model.dnsServers().get(0));
        Assertions.assertEquals("wtruwiqzbqjvsovm", model.expires());
        Assertions.assertEquals("kacspkw", model.nsxType());
        Assertions.assertEquals("zdobpxjmflbvvnch", model.placementGroupId());
        Assertions.assertEquals("cciw", model.placementGroupName());
        Assertions.assertEquals(UUID.fromString("49493dc4-f278-4e0c-b59d-4f897063ff79"), model.privateCloudId());
        Assertions.assertEquals("qkhr", model.resourcePools().get(0).id());
        Assertions.assertEquals("uknvudwti", model.state());
        Assertions.assertEquals(133898645, model.totalCpuCores());
        Assertions.assertEquals(580602799, model.totalNodes());
        Assertions.assertEquals(1236477167, model.totalRam());
        Assertions.assertEquals(78.48933F, model.totalStorage());
        Assertions.assertEquals("cipazyxoegukgjnp", model.typePropertiesType());
        Assertions.assertEquals("cgygev", model.vSphereVersion());
        Assertions.assertEquals("ntypmrbpizcdrqj", model.vcenterFqdn());
        Assertions.assertEquals("pyd", model.vcenterRefid());
        Assertions.assertEquals("fsj", model.virtualMachineTemplates().get(0).location());
        Assertions.assertEquals("iqylihkaetck", model.virtualNetworks().get(0).id());
        Assertions.assertEquals(true, model.vrOpsEnabled());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PrivateCloudInner model =
            new PrivateCloudInner()
                .withId("o")
                .withLocation("ocfs")
                .withName("s")
                .withType(PrivateCloudResourceType.MICROSOFT_VMWARE_CLOUD_SIMPLE_PRIVATE_CLOUDS)
                .withAvailabilityZoneId("dystkiiuxhqyud")
                .withAvailabilityZoneName("rrqnbpoczvyifqrv")
                .withClustersNumber(983918139)
                .withCreatedBy("sllr")
                .withCreatedOn(OffsetDateTime.parse("2021-05-18T15:53:17Z"))
                .withDnsServers(Arrays.asList("watkpnpulexxb"))
                .withExpires("wtruwiqzbqjvsovm")
                .withNsxType("kacspkw")
                .withPlacementGroupId("zdobpxjmflbvvnch")
                .withPlacementGroupName("cciw")
                .withPrivateCloudId(UUID.fromString("49493dc4-f278-4e0c-b59d-4f897063ff79"))
                .withResourcePools(
                    Arrays
                        .asList(
                            new ResourcePoolInner().withId("qkhr"),
                            new ResourcePoolInner().withId("onpc"),
                            new ResourcePoolInner().withId("v")))
                .withState("uknvudwti")
                .withTotalCpuCores(133898645)
                .withTotalNodes(580602799)
                .withTotalRam(1236477167)
                .withTotalStorage(78.48933F)
                .withTypePropertiesType("cipazyxoegukgjnp")
                .withVSphereVersion("cgygev")
                .withVcenterFqdn("ntypmrbpizcdrqj")
                .withVcenterRefid("pyd")
                .withVirtualMachineTemplates(
                    Arrays
                        .asList(
                            new VirtualMachineTemplateInner().withLocation("fsj"),
                            new VirtualMachineTemplateInner().withLocation("wankixzbi"),
                            new VirtualMachineTemplateInner().withLocation("avwhheunm"),
                            new VirtualMachineTemplateInner().withLocation("eyp")))
                .withVirtualNetworks(Arrays.asList(new VirtualNetworkInner().withId("iqylihkaetck")))
                .withVrOpsEnabled(true);
        model = BinaryData.fromObject(model).toObject(PrivateCloudInner.class);
        Assertions.assertEquals("o", model.id());
        Assertions.assertEquals("ocfs", model.location());
        Assertions.assertEquals("s", model.name());
        Assertions.assertEquals(PrivateCloudResourceType.MICROSOFT_VMWARE_CLOUD_SIMPLE_PRIVATE_CLOUDS, model.type());
        Assertions.assertEquals("dystkiiuxhqyud", model.availabilityZoneId());
        Assertions.assertEquals("rrqnbpoczvyifqrv", model.availabilityZoneName());
        Assertions.assertEquals(983918139, model.clustersNumber());
        Assertions.assertEquals("sllr", model.createdBy());
        Assertions.assertEquals(OffsetDateTime.parse("2021-05-18T15:53:17Z"), model.createdOn());
        Assertions.assertEquals("watkpnpulexxb", model.dnsServers().get(0));
        Assertions.assertEquals("wtruwiqzbqjvsovm", model.expires());
        Assertions.assertEquals("kacspkw", model.nsxType());
        Assertions.assertEquals("zdobpxjmflbvvnch", model.placementGroupId());
        Assertions.assertEquals("cciw", model.placementGroupName());
        Assertions.assertEquals(UUID.fromString("49493dc4-f278-4e0c-b59d-4f897063ff79"), model.privateCloudId());
        Assertions.assertEquals("qkhr", model.resourcePools().get(0).id());
        Assertions.assertEquals("uknvudwti", model.state());
        Assertions.assertEquals(133898645, model.totalCpuCores());
        Assertions.assertEquals(580602799, model.totalNodes());
        Assertions.assertEquals(1236477167, model.totalRam());
        Assertions.assertEquals(78.48933F, model.totalStorage());
        Assertions.assertEquals("cipazyxoegukgjnp", model.typePropertiesType());
        Assertions.assertEquals("cgygev", model.vSphereVersion());
        Assertions.assertEquals("ntypmrbpizcdrqj", model.vcenterFqdn());
        Assertions.assertEquals("pyd", model.vcenterRefid());
        Assertions.assertEquals("fsj", model.virtualMachineTemplates().get(0).location());
        Assertions.assertEquals("iqylihkaetck", model.virtualNetworks().get(0).id());
        Assertions.assertEquals(true, model.vrOpsEnabled());
    }
}
