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

package com.azure.resourcemanager.managednetworkfabric.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.managednetworkfabric.fluent.models.NetworkRackSkuProperties;
import com.azure.resourcemanager.managednetworkfabric.models.NetworkDeviceRackRoleType;
import com.azure.resourcemanager.managednetworkfabric.models.NetworkDeviceRoleProperties;
import com.azure.resourcemanager.managednetworkfabric.models.NetworkRackRoleName;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class NetworkRackSkuPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        NetworkRackSkuProperties model =
            BinaryData
                .fromString(
                    "{\"roleName\":\"ComputeRack\",\"maximumServerCount\":1713502373,\"maximumStorageCount\":60989181,\"maximumUplinks\":989403174,\"networkDevices\":[{\"networkDeviceSkuName\":\"wjscjpah\",\"roleType\":\"CE\",\"rackSlot\":125446577},{\"networkDeviceSkuName\":\"f\",\"roleType\":\"ToR\",\"rackSlot\":1695920381},{\"networkDeviceSkuName\":\"qtibxyijddtv\",\"roleType\":\"Management\",\"rackSlot\":1118270051},{\"networkDeviceSkuName\":\"ijaeukm\",\"roleType\":\"NPB\",\"rackSlot\":1240784829}],\"provisioningState\":\"Failed\"}")
                .toObject(NetworkRackSkuProperties.class);
        Assertions.assertEquals(NetworkRackRoleName.COMPUTE_RACK, model.roleName());
        Assertions.assertEquals(1713502373, model.maximumServerCount());
        Assertions.assertEquals(60989181, model.maximumStorageCount());
        Assertions.assertEquals(989403174, model.maximumUplinks());
        Assertions.assertEquals("wjscjpah", model.networkDevices().get(0).networkDeviceSkuName());
        Assertions.assertEquals(NetworkDeviceRackRoleType.CE, model.networkDevices().get(0).roleType());
        Assertions.assertEquals(125446577, model.networkDevices().get(0).rackSlot());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        NetworkRackSkuProperties model =
            new NetworkRackSkuProperties()
                .withRoleName(NetworkRackRoleName.COMPUTE_RACK)
                .withMaximumServerCount(1713502373)
                .withMaximumStorageCount(60989181)
                .withMaximumUplinks(989403174)
                .withNetworkDevices(
                    Arrays
                        .asList(
                            new NetworkDeviceRoleProperties()
                                .withNetworkDeviceSkuName("wjscjpah")
                                .withRoleType(NetworkDeviceRackRoleType.CE)
                                .withRackSlot(125446577),
                            new NetworkDeviceRoleProperties()
                                .withNetworkDeviceSkuName("f")
                                .withRoleType(NetworkDeviceRackRoleType.TOR)
                                .withRackSlot(1695920381),
                            new NetworkDeviceRoleProperties()
                                .withNetworkDeviceSkuName("qtibxyijddtv")
                                .withRoleType(NetworkDeviceRackRoleType.MANAGEMENT)
                                .withRackSlot(1118270051),
                            new NetworkDeviceRoleProperties()
                                .withNetworkDeviceSkuName("ijaeukm")
                                .withRoleType(NetworkDeviceRackRoleType.NPB)
                                .withRackSlot(1240784829)));
        model = BinaryData.fromObject(model).toObject(NetworkRackSkuProperties.class);
        Assertions.assertEquals(NetworkRackRoleName.COMPUTE_RACK, model.roleName());
        Assertions.assertEquals(1713502373, model.maximumServerCount());
        Assertions.assertEquals(60989181, model.maximumStorageCount());
        Assertions.assertEquals(989403174, model.maximumUplinks());
        Assertions.assertEquals("wjscjpah", model.networkDevices().get(0).networkDeviceSkuName());
        Assertions.assertEquals(NetworkDeviceRackRoleType.CE, model.networkDevices().get(0).roleType());
        Assertions.assertEquals(125446577, model.networkDevices().get(0).rackSlot());
    }
}
