// 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.LoadBalancerBackendAddressPoolReference;
import com.azure.resourcemanager.resourcemover.models.LoadBalancerNatRuleReference;
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 NicIpConfigurationResourceSettingsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        NicIpConfigurationResourceSettings model =
            BinaryData
                .fromString(
                    "{\"name\":\"rbnlankxmyskp\",\"privateIpAddress\":\"enbtkcxywny\",\"privateIpAllocationMethod\":\"rsyn\",\"subnet\":{\"name\":\"dybyxczfclhaa\",\"sourceArmResourceId\":\"dbabp\"},\"primary\":true,\"loadBalancerBackendAddressPools\":[{\"name\":\"fkts\",\"sourceArmResourceId\":\"hsucoc\"},{\"name\":\"yyazttbt\",\"sourceArmResourceId\":\"wrqpue\"},{\"name\":\"kzywbiex\",\"sourceArmResourceId\":\"fey\"}],\"loadBalancerNatRules\":[{\"name\":\"ibx\",\"sourceArmResourceId\":\"jwbhqwalmuz\"},{\"name\":\"xaepdkzjancuxr\",\"sourceArmResourceId\":\"d\"}],\"publicIp\":{\"sourceArmResourceId\":\"avxbniwdjswztsdb\"}}")
                .toObject(NicIpConfigurationResourceSettings.class);
        Assertions.assertEquals("rbnlankxmyskp", model.name());
        Assertions.assertEquals("enbtkcxywny", model.privateIpAddress());
        Assertions.assertEquals("rsyn", model.privateIpAllocationMethod());
        Assertions.assertEquals("dbabp", model.subnet().sourceArmResourceId());
        Assertions.assertEquals("dybyxczfclhaa", model.subnet().name());
        Assertions.assertEquals(true, model.primary());
        Assertions.assertEquals("hsucoc", model.loadBalancerBackendAddressPools().get(0).sourceArmResourceId());
        Assertions.assertEquals("fkts", model.loadBalancerBackendAddressPools().get(0).name());
        Assertions.assertEquals("jwbhqwalmuz", model.loadBalancerNatRules().get(0).sourceArmResourceId());
        Assertions.assertEquals("ibx", model.loadBalancerNatRules().get(0).name());
        Assertions.assertEquals("avxbniwdjswztsdb", model.publicIp().sourceArmResourceId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        NicIpConfigurationResourceSettings model =
            new NicIpConfigurationResourceSettings()
                .withName("rbnlankxmyskp")
                .withPrivateIpAddress("enbtkcxywny")
                .withPrivateIpAllocationMethod("rsyn")
                .withSubnet(new SubnetReference().withSourceArmResourceId("dbabp").withName("dybyxczfclhaa"))
                .withPrimary(true)
                .withLoadBalancerBackendAddressPools(
                    Arrays
                        .asList(
                            new LoadBalancerBackendAddressPoolReference()
                                .withSourceArmResourceId("hsucoc")
                                .withName("fkts"),
                            new LoadBalancerBackendAddressPoolReference()
                                .withSourceArmResourceId("wrqpue")
                                .withName("yyazttbt"),
                            new LoadBalancerBackendAddressPoolReference()
                                .withSourceArmResourceId("fey")
                                .withName("kzywbiex")))
                .withLoadBalancerNatRules(
                    Arrays
                        .asList(
                            new LoadBalancerNatRuleReference().withSourceArmResourceId("jwbhqwalmuz").withName("ibx"),
                            new LoadBalancerNatRuleReference().withSourceArmResourceId("d").withName("xaepdkzjancuxr")))
                .withPublicIp(new PublicIpReference().withSourceArmResourceId("avxbniwdjswztsdb"));
        model = BinaryData.fromObject(model).toObject(NicIpConfigurationResourceSettings.class);
        Assertions.assertEquals("rbnlankxmyskp", model.name());
        Assertions.assertEquals("enbtkcxywny", model.privateIpAddress());
        Assertions.assertEquals("rsyn", model.privateIpAllocationMethod());
        Assertions.assertEquals("dbabp", model.subnet().sourceArmResourceId());
        Assertions.assertEquals("dybyxczfclhaa", model.subnet().name());
        Assertions.assertEquals(true, model.primary());
        Assertions.assertEquals("hsucoc", model.loadBalancerBackendAddressPools().get(0).sourceArmResourceId());
        Assertions.assertEquals("fkts", model.loadBalancerBackendAddressPools().get(0).name());
        Assertions.assertEquals("jwbhqwalmuz", model.loadBalancerNatRules().get(0).sourceArmResourceId());
        Assertions.assertEquals("ibx", model.loadBalancerNatRules().get(0).name());
        Assertions.assertEquals("avxbniwdjswztsdb", model.publicIp().sourceArmResourceId());
    }
}
