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

package com.azure.resourcemanager.hybridnetwork.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.hybridnetwork.models.CustomProfile;
import com.azure.resourcemanager.hybridnetwork.models.DataDisk;
import com.azure.resourcemanager.hybridnetwork.models.DiskCreateOptionTypes;
import com.azure.resourcemanager.hybridnetwork.models.ImageReference;
import com.azure.resourcemanager.hybridnetwork.models.LinuxConfiguration;
import com.azure.resourcemanager.hybridnetwork.models.NetworkFunctionRoleConfiguration;
import com.azure.resourcemanager.hybridnetwork.models.NetworkFunctionRoleConfigurationType;
import com.azure.resourcemanager.hybridnetwork.models.NetworkInterface;
import com.azure.resourcemanager.hybridnetwork.models.OperatingSystemTypes;
import com.azure.resourcemanager.hybridnetwork.models.OsDisk;
import com.azure.resourcemanager.hybridnetwork.models.OsProfile;
import com.azure.resourcemanager.hybridnetwork.models.StorageProfile;
import com.azure.resourcemanager.hybridnetwork.models.VMSwitchType;
import com.azure.resourcemanager.hybridnetwork.models.VirtualMachineSizeTypes;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class NetworkFunctionRoleConfigurationTests {
    @Test
    public void testDeserialize() {
        NetworkFunctionRoleConfiguration model =
            BinaryData
                .fromString(
                    "{\"roleName\":\"zvddntwndeicbtwn\",\"roleType\":\"Unknown\",\"virtualMachineSize\":\"Standard_D5_v2\",\"osProfile\":{\"adminUsername\":\"hrhcffcyddglmjth\",\"linuxConfiguration\":{},\"customData\":\"pyeicxm\",\"customDataRequired\":false},\"networkInterfaces\":[{\"networkInterfaceName\":\"hix\",\"macAddress\":\"gdtopbobjogh\",\"ipConfigurations\":[],\"vmSwitchType\":\"Unknown\"}],\"storageProfile\":{\"imageReference\":{\"publisher\":\"hrzayvvtpgvdf\",\"offer\":\"otkftutqxlngx\",\"sku\":\"fgugnxkrxdqmid\",\"version\":\"hzrvqd\",\"exactVersion\":\"bhj\"},\"osDisk\":{\"osType\":\"Windows\",\"name\":\"h\",\"diskSizeGB\":1256732319},\"dataDisks\":[{\"createOption\":\"Empty\",\"name\":\"nyktzlcuiy\",\"diskSizeGB\":616844240}]},\"customProfile\":{\"metadataConfigurationPath\":\"gndrvynh\"}}")
                .toObject(NetworkFunctionRoleConfiguration.class);
        Assertions.assertEquals("zvddntwndeicbtwn", model.roleName());
        Assertions.assertEquals(NetworkFunctionRoleConfigurationType.UNKNOWN, model.roleType());
        Assertions.assertEquals(VirtualMachineSizeTypes.STANDARD_D5_V2, model.virtualMachineSize());
        Assertions.assertEquals("hrhcffcyddglmjth", model.osProfile().adminUsername());
        Assertions.assertEquals("pyeicxm", model.osProfile().customData());
        Assertions.assertEquals(false, model.osProfile().customDataRequired());
        Assertions.assertEquals("hix", model.networkInterfaces().get(0).networkInterfaceName());
        Assertions.assertEquals("gdtopbobjogh", model.networkInterfaces().get(0).macAddress());
        Assertions.assertEquals(VMSwitchType.UNKNOWN, model.networkInterfaces().get(0).vmSwitchType());
        Assertions.assertEquals("hrzayvvtpgvdf", model.storageProfile().imageReference().publisher());
        Assertions.assertEquals("otkftutqxlngx", model.storageProfile().imageReference().offer());
        Assertions.assertEquals("fgugnxkrxdqmid", model.storageProfile().imageReference().sku());
        Assertions.assertEquals("hzrvqd", model.storageProfile().imageReference().version());
        Assertions.assertEquals("bhj", model.storageProfile().imageReference().exactVersion());
        Assertions.assertEquals(OperatingSystemTypes.WINDOWS, model.storageProfile().osDisk().osType());
        Assertions.assertEquals("h", model.storageProfile().osDisk().name());
        Assertions.assertEquals(1256732319, model.storageProfile().osDisk().diskSizeGB());
        Assertions.assertEquals(DiskCreateOptionTypes.EMPTY, model.storageProfile().dataDisks().get(0).createOption());
        Assertions.assertEquals("nyktzlcuiy", model.storageProfile().dataDisks().get(0).name());
        Assertions.assertEquals(616844240, model.storageProfile().dataDisks().get(0).diskSizeGB());
        Assertions.assertEquals("gndrvynh", model.customProfile().metadataConfigurationPath());
    }

    @Test
    public void testSerialize() {
        NetworkFunctionRoleConfiguration model =
            new NetworkFunctionRoleConfiguration()
                .withRoleName("zvddntwndeicbtwn")
                .withRoleType(NetworkFunctionRoleConfigurationType.UNKNOWN)
                .withVirtualMachineSize(VirtualMachineSizeTypes.STANDARD_D5_V2)
                .withOsProfile(
                    new OsProfile()
                        .withAdminUsername("hrhcffcyddglmjth")
                        .withLinuxConfiguration(new LinuxConfiguration())
                        .withCustomData("pyeicxm")
                        .withCustomDataRequired(false))
                .withNetworkInterfaces(
                    Arrays
                        .asList(
                            new NetworkInterface()
                                .withNetworkInterfaceName("hix")
                                .withMacAddress("gdtopbobjogh")
                                .withIpConfigurations(Arrays.asList())
                                .withVmSwitchType(VMSwitchType.UNKNOWN)))
                .withStorageProfile(
                    new StorageProfile()
                        .withImageReference(
                            new ImageReference()
                                .withPublisher("hrzayvvtpgvdf")
                                .withOffer("otkftutqxlngx")
                                .withSku("fgugnxkrxdqmid")
                                .withVersion("hzrvqd")
                                .withExactVersion("bhj"))
                        .withOsDisk(
                            new OsDisk()
                                .withOsType(OperatingSystemTypes.WINDOWS)
                                .withName("h")
                                .withDiskSizeGB(1256732319))
                        .withDataDisks(
                            Arrays
                                .asList(
                                    new DataDisk()
                                        .withCreateOption(DiskCreateOptionTypes.EMPTY)
                                        .withName("nyktzlcuiy")
                                        .withDiskSizeGB(616844240))))
                .withCustomProfile(new CustomProfile().withMetadataConfigurationPath("gndrvynh"));
        model = BinaryData.fromObject(model).toObject(NetworkFunctionRoleConfiguration.class);
        Assertions.assertEquals("zvddntwndeicbtwn", model.roleName());
        Assertions.assertEquals(NetworkFunctionRoleConfigurationType.UNKNOWN, model.roleType());
        Assertions.assertEquals(VirtualMachineSizeTypes.STANDARD_D5_V2, model.virtualMachineSize());
        Assertions.assertEquals("hrhcffcyddglmjth", model.osProfile().adminUsername());
        Assertions.assertEquals("pyeicxm", model.osProfile().customData());
        Assertions.assertEquals(false, model.osProfile().customDataRequired());
        Assertions.assertEquals("hix", model.networkInterfaces().get(0).networkInterfaceName());
        Assertions.assertEquals("gdtopbobjogh", model.networkInterfaces().get(0).macAddress());
        Assertions.assertEquals(VMSwitchType.UNKNOWN, model.networkInterfaces().get(0).vmSwitchType());
        Assertions.assertEquals("hrzayvvtpgvdf", model.storageProfile().imageReference().publisher());
        Assertions.assertEquals("otkftutqxlngx", model.storageProfile().imageReference().offer());
        Assertions.assertEquals("fgugnxkrxdqmid", model.storageProfile().imageReference().sku());
        Assertions.assertEquals("hzrvqd", model.storageProfile().imageReference().version());
        Assertions.assertEquals("bhj", model.storageProfile().imageReference().exactVersion());
        Assertions.assertEquals(OperatingSystemTypes.WINDOWS, model.storageProfile().osDisk().osType());
        Assertions.assertEquals("h", model.storageProfile().osDisk().name());
        Assertions.assertEquals(1256732319, model.storageProfile().osDisk().diskSizeGB());
        Assertions.assertEquals(DiskCreateOptionTypes.EMPTY, model.storageProfile().dataDisks().get(0).createOption());
        Assertions.assertEquals("nyktzlcuiy", model.storageProfile().dataDisks().get(0).name());
        Assertions.assertEquals(616844240, model.storageProfile().dataDisks().get(0).diskSizeGB());
        Assertions.assertEquals("gndrvynh", model.customProfile().metadataConfigurationPath());
    }
}
