// 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.fluent.models.VendorSkuPropertiesFormat;
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.NetworkFunctionType;
import com.azure.resourcemanager.hybridnetwork.models.SkuDeploymentMode;
import com.azure.resourcemanager.hybridnetwork.models.SkuType;
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 VendorSkuPropertiesFormatTests {
    @Test
    public void testDeserialize() {
        VendorSkuPropertiesFormat model =
            BinaryData
                .fromString(
                    "{\"provisioningState\":\"Accepted\",\"skuType\":\"Unknown\",\"deploymentMode\":\"PrivateEdgeZone\",\"networkFunctionType\":\"Unknown\",\"preview\":false,\"networkFunctionTemplate\":{\"networkFunctionRoleConfigurations\":[{\"roleName\":\"nrosfqpte\",\"roleType\":\"VirtualMachine\",\"virtualMachineSize\":\"Standard_D13_v2\",\"networkInterfaces\":[]},{\"roleName\":\"z\",\"roleType\":\"VirtualMachine\",\"virtualMachineSize\":\"Standard_F2\",\"networkInterfaces\":[]},{\"roleName\":\"oodqxhcrm\",\"roleType\":\"Unknown\",\"virtualMachineSize\":\"Standard_F1s\",\"networkInterfaces\":[]},{\"roleName\":\"ifiyipjxsqwpgrj\",\"roleType\":\"VirtualMachine\",\"virtualMachineSize\":\"Standard_D3_v2\",\"networkInterfaces\":[]}]}}")
                .toObject(VendorSkuPropertiesFormat.class);
        Assertions.assertEquals(SkuType.UNKNOWN, model.skuType());
        Assertions.assertEquals(SkuDeploymentMode.PRIVATE_EDGE_ZONE, model.deploymentMode());
        Assertions.assertEquals(NetworkFunctionType.UNKNOWN, model.networkFunctionType());
        Assertions.assertEquals(false, model.preview());
        Assertions
            .assertEquals(
                "nrosfqpte", model.networkFunctionTemplate().networkFunctionRoleConfigurations().get(0).roleName());
        Assertions
            .assertEquals(
                NetworkFunctionRoleConfigurationType.VIRTUAL_MACHINE,
                model.networkFunctionTemplate().networkFunctionRoleConfigurations().get(0).roleType());
        Assertions
            .assertEquals(
                VirtualMachineSizeTypes.STANDARD_D13_V2,
                model.networkFunctionTemplate().networkFunctionRoleConfigurations().get(0).virtualMachineSize());
    }

    @Test
    public void testSerialize() {
        VendorSkuPropertiesFormat model =
            new VendorSkuPropertiesFormat()
                .withSkuType(SkuType.UNKNOWN)
                .withDeploymentMode(SkuDeploymentMode.PRIVATE_EDGE_ZONE)
                .withNetworkFunctionType(NetworkFunctionType.UNKNOWN)
                .withPreview(false)
                .withNetworkFunctionTemplate(
                    new NetworkFunctionTemplate()
                        .withNetworkFunctionRoleConfigurations(
                            Arrays
                                .asList(
                                    new NetworkFunctionRoleConfiguration()
                                        .withRoleName("nrosfqpte")
                                        .withRoleType(NetworkFunctionRoleConfigurationType.VIRTUAL_MACHINE)
                                        .withVirtualMachineSize(VirtualMachineSizeTypes.STANDARD_D13_V2)
                                        .withNetworkInterfaces(Arrays.asList()),
                                    new NetworkFunctionRoleConfiguration()
                                        .withRoleName("z")
                                        .withRoleType(NetworkFunctionRoleConfigurationType.VIRTUAL_MACHINE)
                                        .withVirtualMachineSize(VirtualMachineSizeTypes.STANDARD_F2)
                                        .withNetworkInterfaces(Arrays.asList()),
                                    new NetworkFunctionRoleConfiguration()
                                        .withRoleName("oodqxhcrm")
                                        .withRoleType(NetworkFunctionRoleConfigurationType.UNKNOWN)
                                        .withVirtualMachineSize(VirtualMachineSizeTypes.STANDARD_F1S)
                                        .withNetworkInterfaces(Arrays.asList()),
                                    new NetworkFunctionRoleConfiguration()
                                        .withRoleName("ifiyipjxsqwpgrj")
                                        .withRoleType(NetworkFunctionRoleConfigurationType.VIRTUAL_MACHINE)
                                        .withVirtualMachineSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
                                        .withNetworkInterfaces(Arrays.asList()))));
        model = BinaryData.fromObject(model).toObject(VendorSkuPropertiesFormat.class);
        Assertions.assertEquals(SkuType.UNKNOWN, model.skuType());
        Assertions.assertEquals(SkuDeploymentMode.PRIVATE_EDGE_ZONE, model.deploymentMode());
        Assertions.assertEquals(NetworkFunctionType.UNKNOWN, model.networkFunctionType());
        Assertions.assertEquals(false, model.preview());
        Assertions
            .assertEquals(
                "nrosfqpte", model.networkFunctionTemplate().networkFunctionRoleConfigurations().get(0).roleName());
        Assertions
            .assertEquals(
                NetworkFunctionRoleConfigurationType.VIRTUAL_MACHINE,
                model.networkFunctionTemplate().networkFunctionRoleConfigurations().get(0).roleType());
        Assertions
            .assertEquals(
                VirtualMachineSizeTypes.STANDARD_D13_V2,
                model.networkFunctionTemplate().networkFunctionRoleConfigurations().get(0).virtualMachineSize());
    }
}
