// 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.VendorNetworkFunctionPropertiesFormat;
import com.azure.resourcemanager.hybridnetwork.models.NetworkFunctionVendorConfiguration;
import com.azure.resourcemanager.hybridnetwork.models.OsProfile;
import com.azure.resourcemanager.hybridnetwork.models.VendorProvisioningState;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class VendorNetworkFunctionPropertiesFormatTests {
    @Test
    public void testDeserialize() {
        VendorNetworkFunctionPropertiesFormat model =
            BinaryData
                .fromString(
                    "{\"provisioningState\":\"Deleted\",\"vendorProvisioningState\":\"NotProvisioned\",\"skuName\":\"fbishcbkha\",\"skuType\":\"EvolvedPacketCore\",\"networkFunctionVendorConfigurations\":[{\"roleName\":\"md\",\"osProfile\":{\"adminUsername\":\"g\",\"customData\":\"buxwgip\",\"customDataRequired\":false},\"networkInterfaces\":[]},{\"roleName\":\"gshwankixz\",\"osProfile\":{\"adminUsername\":\"jeputtmrywn\",\"customData\":\"qftiy\",\"customDataRequired\":true},\"networkInterfaces\":[]}]}")
                .toObject(VendorNetworkFunctionPropertiesFormat.class);
        Assertions.assertEquals(VendorProvisioningState.NOT_PROVISIONED, model.vendorProvisioningState());
        Assertions.assertEquals("md", model.networkFunctionVendorConfigurations().get(0).roleName());
        Assertions.assertEquals("g", model.networkFunctionVendorConfigurations().get(0).osProfile().adminUsername());
        Assertions.assertEquals("buxwgip", model.networkFunctionVendorConfigurations().get(0).osProfile().customData());
        Assertions
            .assertEquals(false, model.networkFunctionVendorConfigurations().get(0).osProfile().customDataRequired());
    }

    @Test
    public void testSerialize() {
        VendorNetworkFunctionPropertiesFormat model =
            new VendorNetworkFunctionPropertiesFormat()
                .withVendorProvisioningState(VendorProvisioningState.NOT_PROVISIONED)
                .withNetworkFunctionVendorConfigurations(
                    Arrays
                        .asList(
                            new NetworkFunctionVendorConfiguration()
                                .withRoleName("md")
                                .withOsProfile(
                                    new OsProfile()
                                        .withAdminUsername("g")
                                        .withCustomData("buxwgip")
                                        .withCustomDataRequired(false))
                                .withNetworkInterfaces(Arrays.asList()),
                            new NetworkFunctionVendorConfiguration()
                                .withRoleName("gshwankixz")
                                .withOsProfile(
                                    new OsProfile()
                                        .withAdminUsername("jeputtmrywn")
                                        .withCustomData("qftiy")
                                        .withCustomDataRequired(true))
                                .withNetworkInterfaces(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(VendorNetworkFunctionPropertiesFormat.class);
        Assertions.assertEquals(VendorProvisioningState.NOT_PROVISIONED, model.vendorProvisioningState());
        Assertions.assertEquals("md", model.networkFunctionVendorConfigurations().get(0).roleName());
        Assertions.assertEquals("g", model.networkFunctionVendorConfigurations().get(0).osProfile().adminUsername());
        Assertions.assertEquals("buxwgip", model.networkFunctionVendorConfigurations().get(0).osProfile().customData());
        Assertions
            .assertEquals(false, model.networkFunctionVendorConfigurations().get(0).osProfile().customDataRequired());
    }
}
