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

package com.azure.resourcemanager.deviceupdate.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.deviceupdate.models.ConnectionDetails;
import com.azure.resourcemanager.deviceupdate.models.PrivateEndpointServiceConnectionStatus;
import com.azure.resourcemanager.deviceupdate.models.PrivateLinkServiceConnection;
import com.azure.resourcemanager.deviceupdate.models.PrivateLinkServiceConnectionState;
import com.azure.resourcemanager.deviceupdate.models.PrivateLinkServiceProxy;
import com.azure.resourcemanager.deviceupdate.models.PrivateLinkServiceProxyRemotePrivateEndpointConnection;
import com.azure.resourcemanager.deviceupdate.models.RemotePrivateEndpoint;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class RemotePrivateEndpointTests {
    @Test
    public void testDeserialize() {
        RemotePrivateEndpoint model =
            BinaryData
                .fromString(
                    "{\"id\":\"ljyoxgvcltb\",\"location\":\"ncghkje\",\"immutableSubscriptionId\":\"zhbijhtxfv\",\"immutableResourceId\":\"bfs\",\"vnetTrafficTag\":\"nehmpvecx\",\"manualPrivateLinkServiceConnections\":[{\"name\":\"bfqkkr\",\"groupIds\":[\"ukgri\",\"flz\",\"fbxzpuzycisp\",\"qzahmgkbrp\"],\"requestMessage\":\"dhibnuq\"},{\"name\":\"pikad\",\"groupIds\":[\"tqagnbuynh\"],\"requestMessage\":\"gg\"},{\"name\":\"bfs\",\"groupIds\":[\"butr\"],\"requestMessage\":\"pnazzm\"},{\"name\":\"runmp\",\"groupIds\":[\"dbhrbnlankxm\",\"skpbhenbtkcxywn\",\"tnrsyn\"],\"requestMessage\":\"idybyxczf\"}],\"privateLinkServiceConnections\":[{\"name\":\"axdbabph\",\"groupIds\":[\"qlfktsths\",\"cocmnyyaztt\",\"twwrqp\",\"edckzywbiexzfey\"],\"requestMessage\":\"axibxujw\"},{\"name\":\"qwalmuzyoxaepd\",\"groupIds\":[\"ancuxrhd\",\"bavxbniwdjswzt\"],\"requestMessage\":\"bpg\"},{\"name\":\"ytxhp\",\"groupIds\":[\"zpfzabglc\",\"hxw\"],\"requestMessage\":\"tyq\"}],\"privateLinkServiceProxies\":[{\"id\":\"bovpl\",\"remotePrivateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"gy\",\"actionsRequired\":\"uosvmkfssxqukk\"},\"remotePrivateEndpointConnection\":{\"id\":\"gmgsxnkjzkde\"},\"groupConnectivityInformation\":[]},{\"id\":\"lopwiyig\",\"remotePrivateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"wzbaiue\",\"actionsRequired\":\"a\"},\"remotePrivateEndpointConnection\":{\"id\":\"yqupedeojnabckh\"},\"groupConnectivityInformation\":[]}],\"connectionDetails\":[{\"id\":\"ie\",\"privateIpAddress\":\"fhvpesaps\",\"linkIdentifier\":\"dqmh\",\"groupId\":\"dhtldwkyz\",\"memberName\":\"utknc\"},{\"id\":\"cwsvlxotog\",\"privateIpAddress\":\"rupqsxvnmicy\",\"linkIdentifier\":\"ceoveilovno\",\"groupId\":\"fj\",\"memberName\":\"njbkcnxdhbttkph\"},{\"id\":\"pnvjtoqnermclf\",\"privateIpAddress\":\"phoxus\",\"linkIdentifier\":\"pabgyeps\",\"groupId\":\"tazqugxywpmueefj\",\"memberName\":\"fqkquj\"}]}")
                .toObject(RemotePrivateEndpoint.class);
        Assertions.assertEquals("ljyoxgvcltb", model.id());
        Assertions.assertEquals("ncghkje", model.location());
        Assertions.assertEquals("zhbijhtxfv", model.immutableSubscriptionId());
        Assertions.assertEquals("bfs", model.immutableResourceId());
        Assertions.assertEquals("nehmpvecx", model.vnetTrafficTag());
        Assertions.assertEquals("bfqkkr", model.manualPrivateLinkServiceConnections().get(0).name());
        Assertions.assertEquals("ukgri", model.manualPrivateLinkServiceConnections().get(0).groupIds().get(0));
        Assertions.assertEquals("dhibnuq", model.manualPrivateLinkServiceConnections().get(0).requestMessage());
        Assertions.assertEquals("axdbabph", model.privateLinkServiceConnections().get(0).name());
        Assertions.assertEquals("qlfktsths", model.privateLinkServiceConnections().get(0).groupIds().get(0));
        Assertions.assertEquals("axibxujw", model.privateLinkServiceConnections().get(0).requestMessage());
        Assertions.assertEquals("bovpl", model.privateLinkServiceProxies().get(0).id());
        Assertions
            .assertEquals(
                PrivateEndpointServiceConnectionStatus.PENDING,
                model.privateLinkServiceProxies().get(0).remotePrivateLinkServiceConnectionState().status());
        Assertions
            .assertEquals(
                "gy", model.privateLinkServiceProxies().get(0).remotePrivateLinkServiceConnectionState().description());
        Assertions
            .assertEquals(
                "uosvmkfssxqukk",
                model.privateLinkServiceProxies().get(0).remotePrivateLinkServiceConnectionState().actionsRequired());
    }

    @Test
    public void testSerialize() {
        RemotePrivateEndpoint model =
            new RemotePrivateEndpoint()
                .withId("ljyoxgvcltb")
                .withLocation("ncghkje")
                .withImmutableSubscriptionId("zhbijhtxfv")
                .withImmutableResourceId("bfs")
                .withVnetTrafficTag("nehmpvecx")
                .withManualPrivateLinkServiceConnections(
                    Arrays
                        .asList(
                            new PrivateLinkServiceConnection()
                                .withName("bfqkkr")
                                .withGroupIds(Arrays.asList("ukgri", "flz", "fbxzpuzycisp", "qzahmgkbrp"))
                                .withRequestMessage("dhibnuq"),
                            new PrivateLinkServiceConnection()
                                .withName("pikad")
                                .withGroupIds(Arrays.asList("tqagnbuynh"))
                                .withRequestMessage("gg"),
                            new PrivateLinkServiceConnection()
                                .withName("bfs")
                                .withGroupIds(Arrays.asList("butr"))
                                .withRequestMessage("pnazzm"),
                            new PrivateLinkServiceConnection()
                                .withName("runmp")
                                .withGroupIds(Arrays.asList("dbhrbnlankxm", "skpbhenbtkcxywn", "tnrsyn"))
                                .withRequestMessage("idybyxczf")))
                .withPrivateLinkServiceConnections(
                    Arrays
                        .asList(
                            new PrivateLinkServiceConnection()
                                .withName("axdbabph")
                                .withGroupIds(Arrays.asList("qlfktsths", "cocmnyyaztt", "twwrqp", "edckzywbiexzfey"))
                                .withRequestMessage("axibxujw"),
                            new PrivateLinkServiceConnection()
                                .withName("qwalmuzyoxaepd")
                                .withGroupIds(Arrays.asList("ancuxrhd", "bavxbniwdjswzt"))
                                .withRequestMessage("bpg"),
                            new PrivateLinkServiceConnection()
                                .withName("ytxhp")
                                .withGroupIds(Arrays.asList("zpfzabglc", "hxw"))
                                .withRequestMessage("tyq")))
                .withPrivateLinkServiceProxies(
                    Arrays
                        .asList(
                            new PrivateLinkServiceProxy()
                                .withId("bovpl")
                                .withRemotePrivateLinkServiceConnectionState(
                                    new PrivateLinkServiceConnectionState()
                                        .withStatus(PrivateEndpointServiceConnectionStatus.PENDING)
                                        .withDescription("gy")
                                        .withActionsRequired("uosvmkfssxqukk"))
                                .withRemotePrivateEndpointConnection(
                                    new PrivateLinkServiceProxyRemotePrivateEndpointConnection())
                                .withGroupConnectivityInformation(Arrays.asList()),
                            new PrivateLinkServiceProxy()
                                .withId("lopwiyig")
                                .withRemotePrivateLinkServiceConnectionState(
                                    new PrivateLinkServiceConnectionState()
                                        .withStatus(PrivateEndpointServiceConnectionStatus.APPROVED)
                                        .withDescription("wzbaiue")
                                        .withActionsRequired("a"))
                                .withRemotePrivateEndpointConnection(
                                    new PrivateLinkServiceProxyRemotePrivateEndpointConnection())
                                .withGroupConnectivityInformation(Arrays.asList())))
                .withConnectionDetails(
                    Arrays.asList(new ConnectionDetails(), new ConnectionDetails(), new ConnectionDetails()));
        model = BinaryData.fromObject(model).toObject(RemotePrivateEndpoint.class);
        Assertions.assertEquals("ljyoxgvcltb", model.id());
        Assertions.assertEquals("ncghkje", model.location());
        Assertions.assertEquals("zhbijhtxfv", model.immutableSubscriptionId());
        Assertions.assertEquals("bfs", model.immutableResourceId());
        Assertions.assertEquals("nehmpvecx", model.vnetTrafficTag());
        Assertions.assertEquals("bfqkkr", model.manualPrivateLinkServiceConnections().get(0).name());
        Assertions.assertEquals("ukgri", model.manualPrivateLinkServiceConnections().get(0).groupIds().get(0));
        Assertions.assertEquals("dhibnuq", model.manualPrivateLinkServiceConnections().get(0).requestMessage());
        Assertions.assertEquals("axdbabph", model.privateLinkServiceConnections().get(0).name());
        Assertions.assertEquals("qlfktsths", model.privateLinkServiceConnections().get(0).groupIds().get(0));
        Assertions.assertEquals("axibxujw", model.privateLinkServiceConnections().get(0).requestMessage());
        Assertions.assertEquals("bovpl", model.privateLinkServiceProxies().get(0).id());
        Assertions
            .assertEquals(
                PrivateEndpointServiceConnectionStatus.PENDING,
                model.privateLinkServiceProxies().get(0).remotePrivateLinkServiceConnectionState().status());
        Assertions
            .assertEquals(
                "gy", model.privateLinkServiceProxies().get(0).remotePrivateLinkServiceConnectionState().description());
        Assertions
            .assertEquals(
                "uosvmkfssxqukk",
                model.privateLinkServiceProxies().get(0).remotePrivateLinkServiceConnectionState().actionsRequired());
    }
}
