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

package com.azure.resourcemanager.resourcemover.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.resourcemover.models.NetworkInterfaceResourceSettings;
import com.azure.resourcemanager.resourcemover.models.NicIpConfigurationResourceSettings;
import com.azure.resourcemanager.resourcemover.models.PublicIpReference;
import com.azure.resourcemanager.resourcemover.models.SubnetReference;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class NetworkInterfaceResourceSettingsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        NetworkInterfaceResourceSettings model =
            BinaryData
                .fromString(
                    "{\"resourceType\":\"Microsoft.Network/networkInterfaces\",\"ipConfigurations\":[{\"name\":\"nkymuctqhjfbebrj\",\"privateIpAddress\":\"erfuwuttt\",\"privateIpAllocationMethod\":\"vjrbirphxepcyvah\",\"subnet\":{\"name\":\"jky\",\"sourceArmResourceId\":\"xjvuujqgidokg\"},\"primary\":true,\"loadBalancerBackendAddressPools\":[],\"loadBalancerNatRules\":[],\"publicIp\":{\"sourceArmResourceId\":\"cltbgsncghkjesz\"}},{\"name\":\"bijhtxfvgxbf\",\"privateIpAddress\":\"xnehmpvec\",\"privateIpAllocationMethod\":\"odebfqkkrbmpu\",\"subnet\":{\"name\":\"iw\",\"sourceArmResourceId\":\"lzlfbxzpuz\"},\"primary\":true,\"loadBalancerBackendAddressPools\":[],\"loadBalancerNatRules\":[],\"publicIp\":{\"sourceArmResourceId\":\"ahmgkbrp\"}},{\"name\":\"dhibnuq\",\"privateIpAddress\":\"pikad\",\"privateIpAllocationMethod\":\"vtq\",\"subnet\":{\"name\":\"buynhijggm\",\"sourceArmResourceId\":\"bfs\"},\"primary\":false,\"loadBalancerBackendAddressPools\":[],\"loadBalancerNatRules\":[],\"publicIp\":{\"sourceArmResourceId\":\"vpnazzm\"}}],\"enableAcceleratedNetworking\":false,\"targetResourceName\":\"unmpxttd\"}")
                .toObject(NetworkInterfaceResourceSettings.class);
        Assertions.assertEquals("unmpxttd", model.targetResourceName());
        Assertions.assertEquals("nkymuctqhjfbebrj", model.ipConfigurations().get(0).name());
        Assertions.assertEquals("erfuwuttt", model.ipConfigurations().get(0).privateIpAddress());
        Assertions.assertEquals("vjrbirphxepcyvah", model.ipConfigurations().get(0).privateIpAllocationMethod());
        Assertions.assertEquals("xjvuujqgidokg", model.ipConfigurations().get(0).subnet().sourceArmResourceId());
        Assertions.assertEquals("jky", model.ipConfigurations().get(0).subnet().name());
        Assertions.assertEquals(true, model.ipConfigurations().get(0).primary());
        Assertions.assertEquals("cltbgsncghkjesz", model.ipConfigurations().get(0).publicIp().sourceArmResourceId());
        Assertions.assertEquals(false, model.enableAcceleratedNetworking());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        NetworkInterfaceResourceSettings model =
            new NetworkInterfaceResourceSettings()
                .withTargetResourceName("unmpxttd")
                .withIpConfigurations(
                    Arrays
                        .asList(
                            new NicIpConfigurationResourceSettings()
                                .withName("nkymuctqhjfbebrj")
                                .withPrivateIpAddress("erfuwuttt")
                                .withPrivateIpAllocationMethod("vjrbirphxepcyvah")
                                .withSubnet(
                                    new SubnetReference().withSourceArmResourceId("xjvuujqgidokg").withName("jky"))
                                .withPrimary(true)
                                .withLoadBalancerBackendAddressPools(Arrays.asList())
                                .withLoadBalancerNatRules(Arrays.asList())
                                .withPublicIp(new PublicIpReference().withSourceArmResourceId("cltbgsncghkjesz")),
                            new NicIpConfigurationResourceSettings()
                                .withName("bijhtxfvgxbf")
                                .withPrivateIpAddress("xnehmpvec")
                                .withPrivateIpAllocationMethod("odebfqkkrbmpu")
                                .withSubnet(new SubnetReference().withSourceArmResourceId("lzlfbxzpuz").withName("iw"))
                                .withPrimary(true)
                                .withLoadBalancerBackendAddressPools(Arrays.asList())
                                .withLoadBalancerNatRules(Arrays.asList())
                                .withPublicIp(new PublicIpReference().withSourceArmResourceId("ahmgkbrp")),
                            new NicIpConfigurationResourceSettings()
                                .withName("dhibnuq")
                                .withPrivateIpAddress("pikad")
                                .withPrivateIpAllocationMethod("vtq")
                                .withSubnet(new SubnetReference().withSourceArmResourceId("bfs").withName("buynhijggm"))
                                .withPrimary(false)
                                .withLoadBalancerBackendAddressPools(Arrays.asList())
                                .withLoadBalancerNatRules(Arrays.asList())
                                .withPublicIp(new PublicIpReference().withSourceArmResourceId("vpnazzm"))))
                .withEnableAcceleratedNetworking(false);
        model = BinaryData.fromObject(model).toObject(NetworkInterfaceResourceSettings.class);
        Assertions.assertEquals("unmpxttd", model.targetResourceName());
        Assertions.assertEquals("nkymuctqhjfbebrj", model.ipConfigurations().get(0).name());
        Assertions.assertEquals("erfuwuttt", model.ipConfigurations().get(0).privateIpAddress());
        Assertions.assertEquals("vjrbirphxepcyvah", model.ipConfigurations().get(0).privateIpAllocationMethod());
        Assertions.assertEquals("xjvuujqgidokg", model.ipConfigurations().get(0).subnet().sourceArmResourceId());
        Assertions.assertEquals("jky", model.ipConfigurations().get(0).subnet().name());
        Assertions.assertEquals(true, model.ipConfigurations().get(0).primary());
        Assertions.assertEquals("cltbgsncghkjesz", model.ipConfigurations().get(0).publicIp().sourceArmResourceId());
        Assertions.assertEquals(false, model.enableAcceleratedNetworking());
    }
}
