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

package com.azure.resourcemanager.nginx.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.nginx.models.NginxFrontendIpConfiguration;
import com.azure.resourcemanager.nginx.models.NginxNetworkInterfaceConfiguration;
import com.azure.resourcemanager.nginx.models.NginxNetworkProfile;
import com.azure.resourcemanager.nginx.models.NginxPrivateIpAddress;
import com.azure.resourcemanager.nginx.models.NginxPrivateIpAllocationMethod;
import com.azure.resourcemanager.nginx.models.NginxPublicIpAddress;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class NginxNetworkProfileTests {
    @Test
    public void testDeserialize() {
        NginxNetworkProfile model =
            BinaryData
                .fromString(
                    "{\"frontEndIPConfiguration\":{\"publicIPAddresses\":[{\"id\":\"wisdkft\"},{\"id\":\"xmnteiwaop\"},{\"id\":\"mijcmmxdcufufs\"}],\"privateIPAddresses\":[{\"privateIPAddress\":\"zidnsezcxtbzsgfy\",\"privateIPAllocationMethod\":\"Static\",\"subnetId\":\"ewmdw\"},{\"privateIPAddress\":\"eiachboosflnr\",\"privateIPAllocationMethod\":\"Static\",\"subnetId\":\"pteehzzv\"}]},\"networkInterfaceConfiguration\":{\"subnetId\":\"qrimzinpv\"}}")
                .toObject(NginxNetworkProfile.class);
        Assertions.assertEquals("wisdkft", model.frontEndIpConfiguration().publicIpAddresses().get(0).id());
        Assertions
            .assertEquals(
                "zidnsezcxtbzsgfy", model.frontEndIpConfiguration().privateIpAddresses().get(0).privateIpAddress());
        Assertions
            .assertEquals(
                NginxPrivateIpAllocationMethod.STATIC,
                model.frontEndIpConfiguration().privateIpAddresses().get(0).privateIpAllocationMethod());
        Assertions.assertEquals("ewmdw", model.frontEndIpConfiguration().privateIpAddresses().get(0).subnetId());
        Assertions.assertEquals("qrimzinpv", model.networkInterfaceConfiguration().subnetId());
    }

    @Test
    public void testSerialize() {
        NginxNetworkProfile model =
            new NginxNetworkProfile()
                .withFrontEndIpConfiguration(
                    new NginxFrontendIpConfiguration()
                        .withPublicIpAddresses(
                            Arrays
                                .asList(
                                    new NginxPublicIpAddress().withId("wisdkft"),
                                    new NginxPublicIpAddress().withId("xmnteiwaop"),
                                    new NginxPublicIpAddress().withId("mijcmmxdcufufs")))
                        .withPrivateIpAddresses(
                            Arrays
                                .asList(
                                    new NginxPrivateIpAddress()
                                        .withPrivateIpAddress("zidnsezcxtbzsgfy")
                                        .withPrivateIpAllocationMethod(NginxPrivateIpAllocationMethod.STATIC)
                                        .withSubnetId("ewmdw"),
                                    new NginxPrivateIpAddress()
                                        .withPrivateIpAddress("eiachboosflnr")
                                        .withPrivateIpAllocationMethod(NginxPrivateIpAllocationMethod.STATIC)
                                        .withSubnetId("pteehzzv"))))
                .withNetworkInterfaceConfiguration(new NginxNetworkInterfaceConfiguration().withSubnetId("qrimzinpv"));
        model = BinaryData.fromObject(model).toObject(NginxNetworkProfile.class);
        Assertions.assertEquals("wisdkft", model.frontEndIpConfiguration().publicIpAddresses().get(0).id());
        Assertions
            .assertEquals(
                "zidnsezcxtbzsgfy", model.frontEndIpConfiguration().privateIpAddresses().get(0).privateIpAddress());
        Assertions
            .assertEquals(
                NginxPrivateIpAllocationMethod.STATIC,
                model.frontEndIpConfiguration().privateIpAddresses().get(0).privateIpAllocationMethod());
        Assertions.assertEquals("ewmdw", model.frontEndIpConfiguration().privateIpAddresses().get(0).subnetId());
        Assertions.assertEquals("qrimzinpv", model.networkInterfaceConfiguration().subnetId());
    }
}
