// 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.NetworkDeviceSkuProperties;
import com.azure.resourcemanager.managednetworkfabric.models.DeviceInterfaceProperties;
import com.azure.resourcemanager.managednetworkfabric.models.DeviceLimits;
import com.azure.resourcemanager.managednetworkfabric.models.IsCurrentVersion;
import com.azure.resourcemanager.managednetworkfabric.models.IsTestVersion;
import com.azure.resourcemanager.managednetworkfabric.models.NetworkDeviceRoleName;
import com.azure.resourcemanager.managednetworkfabric.models.SupportedVersionProperties;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class NetworkDeviceSkuPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        NetworkDeviceSkuProperties model =
            BinaryData
                .fromString(
                    "{\"model\":\"gumhjglikkxws\",\"manufacturer\":\"lbqpvuzlmvfelf\",\"supportedVersions\":[{\"version\":\"lcrpw\",\"vendorOsVersion\":\"eznoig\",\"vendorFirmwareVersion\":\"njwmwkpnbsazejj\",\"isCurrent\":\"false\",\"isTest\":\"false\"},{\"version\":\"hsxttaugzxnf\",\"vendorOsVersion\":\"zpxdt\",\"vendorFirmwareVersion\":\"dm\",\"isCurrent\":\"true\",\"isTest\":\"false\"},{\"version\":\"uenvrkp\",\"vendorOsVersion\":\"uaibrebqaaysj\",\"vendorFirmwareVersion\":\"xqtnq\",\"isCurrent\":\"true\",\"isTest\":\"true\"},{\"version\":\"fffiak\",\"vendorOsVersion\":\"pqqmted\",\"vendorFirmwareVersion\":\"mmji\",\"isCurrent\":\"true\",\"isTest\":\"true\"}],\"limits\":{\"physicalInterfaceCount\":951782119,\"maxSubInterfaces\":1018976472,\"maxTunnelInterfaces\":52872288,\"maxVirtualRouterFunctions\":1025592132,\"maxBorderGatewayProtocolPeers\":1587371608,\"maxBidirectionalForwardingDetectionPeers\":367245568},\"supportedRoleTypes\":[\"Management\"],\"interfaces\":[{\"identifier\":\"dscwxqupevzhf\",\"interfaceType\":\"otxhojujby\",\"supportedConnectorTypes\":[]}],\"provisioningState\":\"Failed\"}")
                .toObject(NetworkDeviceSkuProperties.class);
        Assertions.assertEquals("gumhjglikkxws", model.model());
        Assertions.assertEquals("lbqpvuzlmvfelf", model.manufacturer());
        Assertions.assertEquals("lcrpw", model.supportedVersions().get(0).version());
        Assertions.assertEquals("eznoig", model.supportedVersions().get(0).vendorOsVersion());
        Assertions.assertEquals("njwmwkpnbsazejj", model.supportedVersions().get(0).vendorFirmwareVersion());
        Assertions.assertEquals(IsCurrentVersion.FALSE, model.supportedVersions().get(0).isCurrent());
        Assertions.assertEquals(IsTestVersion.FALSE, model.supportedVersions().get(0).isTest());
        Assertions.assertEquals(951782119, model.limits().physicalInterfaceCount());
        Assertions.assertEquals(1018976472, model.limits().maxSubInterfaces());
        Assertions.assertEquals(52872288, model.limits().maxTunnelInterfaces());
        Assertions.assertEquals(1025592132, model.limits().maxVirtualRouterFunctions());
        Assertions.assertEquals(1587371608, model.limits().maxBorderGatewayProtocolPeers());
        Assertions.assertEquals(367245568, model.limits().maxBidirectionalForwardingDetectionPeers());
        Assertions.assertEquals(NetworkDeviceRoleName.MANAGEMENT, model.supportedRoleTypes().get(0));
        Assertions.assertEquals("dscwxqupevzhf", model.interfaces().get(0).identifier());
        Assertions.assertEquals("otxhojujby", model.interfaces().get(0).interfaceType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        NetworkDeviceSkuProperties model =
            new NetworkDeviceSkuProperties()
                .withModel("gumhjglikkxws")
                .withManufacturer("lbqpvuzlmvfelf")
                .withSupportedVersions(
                    Arrays
                        .asList(
                            new SupportedVersionProperties()
                                .withVersion("lcrpw")
                                .withVendorOsVersion("eznoig")
                                .withVendorFirmwareVersion("njwmwkpnbsazejj")
                                .withIsCurrent(IsCurrentVersion.FALSE)
                                .withIsTest(IsTestVersion.FALSE),
                            new SupportedVersionProperties()
                                .withVersion("hsxttaugzxnf")
                                .withVendorOsVersion("zpxdt")
                                .withVendorFirmwareVersion("dm")
                                .withIsCurrent(IsCurrentVersion.TRUE)
                                .withIsTest(IsTestVersion.FALSE),
                            new SupportedVersionProperties()
                                .withVersion("uenvrkp")
                                .withVendorOsVersion("uaibrebqaaysj")
                                .withVendorFirmwareVersion("xqtnq")
                                .withIsCurrent(IsCurrentVersion.TRUE)
                                .withIsTest(IsTestVersion.TRUE),
                            new SupportedVersionProperties()
                                .withVersion("fffiak")
                                .withVendorOsVersion("pqqmted")
                                .withVendorFirmwareVersion("mmji")
                                .withIsCurrent(IsCurrentVersion.TRUE)
                                .withIsTest(IsTestVersion.TRUE)))
                .withLimits(
                    new DeviceLimits()
                        .withPhysicalInterfaceCount(951782119)
                        .withMaxSubInterfaces(1018976472)
                        .withMaxTunnelInterfaces(52872288)
                        .withMaxVirtualRouterFunctions(1025592132)
                        .withMaxBorderGatewayProtocolPeers(1587371608)
                        .withMaxBidirectionalForwardingDetectionPeers(367245568))
                .withSupportedRoleTypes(Arrays.asList(NetworkDeviceRoleName.MANAGEMENT))
                .withInterfaces(
                    Arrays
                        .asList(
                            new DeviceInterfaceProperties()
                                .withIdentifier("dscwxqupevzhf")
                                .withInterfaceType("otxhojujby")
                                .withSupportedConnectorTypes(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(NetworkDeviceSkuProperties.class);
        Assertions.assertEquals("gumhjglikkxws", model.model());
        Assertions.assertEquals("lbqpvuzlmvfelf", model.manufacturer());
        Assertions.assertEquals("lcrpw", model.supportedVersions().get(0).version());
        Assertions.assertEquals("eznoig", model.supportedVersions().get(0).vendorOsVersion());
        Assertions.assertEquals("njwmwkpnbsazejj", model.supportedVersions().get(0).vendorFirmwareVersion());
        Assertions.assertEquals(IsCurrentVersion.FALSE, model.supportedVersions().get(0).isCurrent());
        Assertions.assertEquals(IsTestVersion.FALSE, model.supportedVersions().get(0).isTest());
        Assertions.assertEquals(951782119, model.limits().physicalInterfaceCount());
        Assertions.assertEquals(1018976472, model.limits().maxSubInterfaces());
        Assertions.assertEquals(52872288, model.limits().maxTunnelInterfaces());
        Assertions.assertEquals(1025592132, model.limits().maxVirtualRouterFunctions());
        Assertions.assertEquals(1587371608, model.limits().maxBorderGatewayProtocolPeers());
        Assertions.assertEquals(367245568, model.limits().maxBidirectionalForwardingDetectionPeers());
        Assertions.assertEquals(NetworkDeviceRoleName.MANAGEMENT, model.supportedRoleTypes().get(0));
        Assertions.assertEquals("dscwxqupevzhf", model.interfaces().get(0).identifier());
        Assertions.assertEquals("otxhojujby", model.interfaces().get(0).interfaceType());
    }
}
