// 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.NetworkFunctionRoleConfiguration;
import com.azure.resourcemanager.hybridnetwork.models.NetworkFunctionRoleConfigurationType;
import com.azure.resourcemanager.hybridnetwork.models.NetworkFunctionTemplate;
import com.azure.resourcemanager.hybridnetwork.models.OsProfile;
import com.azure.resourcemanager.hybridnetwork.models.StorageProfile;
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 NetworkFunctionTemplateTests {
    @Test
    public void testDeserialize() {
        NetworkFunctionTemplate model =
            BinaryData
                .fromString(
                    "{\"networkFunctionRoleConfigurations\":[{\"roleName\":\"qabnmoc\",\"roleType\":\"Unknown\",\"virtualMachineSize\":\"Standard_D5_v2\",\"osProfile\":{\"adminUsername\":\"zafb\",\"customData\":\"gpbtoqcjmklj\",\"customDataRequired\":false},\"networkInterfaces\":[],\"storageProfile\":{\"dataDisks\":[]},\"customProfile\":{\"metadataConfigurationPath\":\"l\"}},{\"roleName\":\"u\",\"roleType\":\"VirtualMachine\",\"virtualMachineSize\":\"Standard_D3_v2\",\"osProfile\":{\"adminUsername\":\"bzhfepgzgqexz\",\"customData\":\"xscpaierhhbc\",\"customDataRequired\":false},\"networkInterfaces\":[],\"storageProfile\":{\"dataDisks\":[]},\"customProfile\":{\"metadataConfigurationPath\":\"xobnbdxkqpxok\"}},{\"roleName\":\"ionpimexg\",\"roleType\":\"Unknown\",\"virtualMachineSize\":\"Standard_D5_v2\",\"osProfile\":{\"adminUsername\":\"dg\",\"customData\":\"jrmvdjwzrlo\",\"customDataRequired\":true},\"networkInterfaces\":[],\"storageProfile\":{\"dataDisks\":[]},\"customProfile\":{\"metadataConfigurationPath\":\"tbzaqsqsycbkbfk\"}},{\"roleName\":\"kdkexxp\",\"roleType\":\"Unknown\",\"virtualMachineSize\":\"Unknown\",\"osProfile\":{\"adminUsername\":\"c\",\"customData\":\"gddtocj\",\"customDataRequired\":false},\"networkInterfaces\":[],\"storageProfile\":{\"dataDisks\":[]},\"customProfile\":{\"metadataConfigurationPath\":\"xibqeojnx\"}}]}")
                .toObject(NetworkFunctionTemplate.class);
        Assertions.assertEquals("qabnmoc", model.networkFunctionRoleConfigurations().get(0).roleName());
        Assertions
            .assertEquals(
                NetworkFunctionRoleConfigurationType.UNKNOWN,
                model.networkFunctionRoleConfigurations().get(0).roleType());
        Assertions
            .assertEquals(
                VirtualMachineSizeTypes.STANDARD_D5_V2,
                model.networkFunctionRoleConfigurations().get(0).virtualMachineSize());
        Assertions.assertEquals("zafb", model.networkFunctionRoleConfigurations().get(0).osProfile().adminUsername());
        Assertions
            .assertEquals("gpbtoqcjmklj", model.networkFunctionRoleConfigurations().get(0).osProfile().customData());
        Assertions
            .assertEquals(false, model.networkFunctionRoleConfigurations().get(0).osProfile().customDataRequired());
        Assertions
            .assertEquals(
                "l", model.networkFunctionRoleConfigurations().get(0).customProfile().metadataConfigurationPath());
    }

    @Test
    public void testSerialize() {
        NetworkFunctionTemplate model =
            new NetworkFunctionTemplate()
                .withNetworkFunctionRoleConfigurations(
                    Arrays
                        .asList(
                            new NetworkFunctionRoleConfiguration()
                                .withRoleName("qabnmoc")
                                .withRoleType(NetworkFunctionRoleConfigurationType.UNKNOWN)
                                .withVirtualMachineSize(VirtualMachineSizeTypes.STANDARD_D5_V2)
                                .withOsProfile(
                                    new OsProfile()
                                        .withAdminUsername("zafb")
                                        .withCustomData("gpbtoqcjmklj")
                                        .withCustomDataRequired(false))
                                .withNetworkInterfaces(Arrays.asList())
                                .withStorageProfile(new StorageProfile().withDataDisks(Arrays.asList()))
                                .withCustomProfile(new CustomProfile().withMetadataConfigurationPath("l")),
                            new NetworkFunctionRoleConfiguration()
                                .withRoleName("u")
                                .withRoleType(NetworkFunctionRoleConfigurationType.VIRTUAL_MACHINE)
                                .withVirtualMachineSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
                                .withOsProfile(
                                    new OsProfile()
                                        .withAdminUsername("bzhfepgzgqexz")
                                        .withCustomData("xscpaierhhbc")
                                        .withCustomDataRequired(false))
                                .withNetworkInterfaces(Arrays.asList())
                                .withStorageProfile(new StorageProfile().withDataDisks(Arrays.asList()))
                                .withCustomProfile(new CustomProfile().withMetadataConfigurationPath("xobnbdxkqpxok")),
                            new NetworkFunctionRoleConfiguration()
                                .withRoleName("ionpimexg")
                                .withRoleType(NetworkFunctionRoleConfigurationType.UNKNOWN)
                                .withVirtualMachineSize(VirtualMachineSizeTypes.STANDARD_D5_V2)
                                .withOsProfile(
                                    new OsProfile()
                                        .withAdminUsername("dg")
                                        .withCustomData("jrmvdjwzrlo")
                                        .withCustomDataRequired(true))
                                .withNetworkInterfaces(Arrays.asList())
                                .withStorageProfile(new StorageProfile().withDataDisks(Arrays.asList()))
                                .withCustomProfile(
                                    new CustomProfile().withMetadataConfigurationPath("tbzaqsqsycbkbfk")),
                            new NetworkFunctionRoleConfiguration()
                                .withRoleName("kdkexxp")
                                .withRoleType(NetworkFunctionRoleConfigurationType.UNKNOWN)
                                .withVirtualMachineSize(VirtualMachineSizeTypes.UNKNOWN)
                                .withOsProfile(
                                    new OsProfile()
                                        .withAdminUsername("c")
                                        .withCustomData("gddtocj")
                                        .withCustomDataRequired(false))
                                .withNetworkInterfaces(Arrays.asList())
                                .withStorageProfile(new StorageProfile().withDataDisks(Arrays.asList()))
                                .withCustomProfile(new CustomProfile().withMetadataConfigurationPath("xibqeojnx"))));
        model = BinaryData.fromObject(model).toObject(NetworkFunctionTemplate.class);
        Assertions.assertEquals("qabnmoc", model.networkFunctionRoleConfigurations().get(0).roleName());
        Assertions
            .assertEquals(
                NetworkFunctionRoleConfigurationType.UNKNOWN,
                model.networkFunctionRoleConfigurations().get(0).roleType());
        Assertions
            .assertEquals(
                VirtualMachineSizeTypes.STANDARD_D5_V2,
                model.networkFunctionRoleConfigurations().get(0).virtualMachineSize());
        Assertions.assertEquals("zafb", model.networkFunctionRoleConfigurations().get(0).osProfile().adminUsername());
        Assertions
            .assertEquals("gpbtoqcjmklj", model.networkFunctionRoleConfigurations().get(0).osProfile().customData());
        Assertions
            .assertEquals(false, model.networkFunctionRoleConfigurations().get(0).osProfile().customDataRequired());
        Assertions
            .assertEquals(
                "l", model.networkFunctionRoleConfigurations().get(0).customProfile().metadataConfigurationPath());
    }
}
