// 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.GroupConnectivityInformation;
import com.azure.resourcemanager.deviceupdate.models.PrivateEndpointServiceConnectionStatus;
import com.azure.resourcemanager.deviceupdate.models.PrivateLinkServiceConnectionState;
import com.azure.resourcemanager.deviceupdate.models.PrivateLinkServiceProxy;
import com.azure.resourcemanager.deviceupdate.models.PrivateLinkServiceProxyRemotePrivateEndpointConnection;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class PrivateLinkServiceProxyTests {
    @Test
    public void testDeserialize() {
        PrivateLinkServiceProxy model =
            BinaryData
                .fromString(
                    "{\"id\":\"fudwpznt\",\"remotePrivateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"lrqjbhckfr\",\"actionsRequired\":\"rxsbkyvp\"},\"remotePrivateEndpointConnection\":{\"id\":\"n\"},\"groupConnectivityInformation\":[{\"groupId\":\"zka\",\"memberName\":\"uwbc\",\"customerVisibleFqdns\":[\"bmehh\"],\"internalFqdn\":\"yvjusrtslhsp\",\"redirectMapId\":\"eemaofmxagkvtme\",\"privateLinkServiceArmRegion\":\"qkrhahvljua\"},{\"groupId\":\"quhcdhmduala\",\"memberName\":\"qpv\",\"customerVisibleFqdns\":[\"mwsrcrgvxpvgo\",\"zlfmisgwbnbbeld\",\"wkz\",\"ali\"],\"internalFqdn\":\"rqhakauha\",\"redirectMapId\":\"sfwxosowzxc\",\"privateLinkServiceArmRegion\":\"i\"},{\"groupId\":\"ooxdjebwpuc\",\"memberName\":\"fvovbvmeuecivy\",\"customerVisibleFqdns\":[\"euojgjrwju\"],\"internalFqdn\":\"otwmcdyt\",\"redirectMapId\":\"wit\",\"privateLinkServiceArmRegion\":\"rjaw\"}]}")
                .toObject(PrivateLinkServiceProxy.class);
        Assertions.assertEquals("fudwpznt", model.id());
        Assertions
            .assertEquals(
                PrivateEndpointServiceConnectionStatus.REJECTED,
                model.remotePrivateLinkServiceConnectionState().status());
        Assertions.assertEquals("lrqjbhckfr", model.remotePrivateLinkServiceConnectionState().description());
        Assertions.assertEquals("rxsbkyvp", model.remotePrivateLinkServiceConnectionState().actionsRequired());
        Assertions.assertEquals("bmehh", model.groupConnectivityInformation().get(0).customerVisibleFqdns().get(0));
        Assertions.assertEquals("eemaofmxagkvtme", model.groupConnectivityInformation().get(0).redirectMapId());
        Assertions
            .assertEquals("qkrhahvljua", model.groupConnectivityInformation().get(0).privateLinkServiceArmRegion());
    }

    @Test
    public void testSerialize() {
        PrivateLinkServiceProxy model =
            new PrivateLinkServiceProxy()
                .withId("fudwpznt")
                .withRemotePrivateLinkServiceConnectionState(
                    new PrivateLinkServiceConnectionState()
                        .withStatus(PrivateEndpointServiceConnectionStatus.REJECTED)
                        .withDescription("lrqjbhckfr")
                        .withActionsRequired("rxsbkyvp"))
                .withRemotePrivateEndpointConnection(new PrivateLinkServiceProxyRemotePrivateEndpointConnection())
                .withGroupConnectivityInformation(
                    Arrays
                        .asList(
                            new GroupConnectivityInformation()
                                .withCustomerVisibleFqdns(Arrays.asList("bmehh"))
                                .withRedirectMapId("eemaofmxagkvtme")
                                .withPrivateLinkServiceArmRegion("qkrhahvljua"),
                            new GroupConnectivityInformation()
                                .withCustomerVisibleFqdns(
                                    Arrays.asList("mwsrcrgvxpvgo", "zlfmisgwbnbbeld", "wkz", "ali"))
                                .withRedirectMapId("sfwxosowzxc")
                                .withPrivateLinkServiceArmRegion("i"),
                            new GroupConnectivityInformation()
                                .withCustomerVisibleFqdns(Arrays.asList("euojgjrwju"))
                                .withRedirectMapId("wit")
                                .withPrivateLinkServiceArmRegion("rjaw")));
        model = BinaryData.fromObject(model).toObject(PrivateLinkServiceProxy.class);
        Assertions.assertEquals("fudwpznt", model.id());
        Assertions
            .assertEquals(
                PrivateEndpointServiceConnectionStatus.REJECTED,
                model.remotePrivateLinkServiceConnectionState().status());
        Assertions.assertEquals("lrqjbhckfr", model.remotePrivateLinkServiceConnectionState().description());
        Assertions.assertEquals("rxsbkyvp", model.remotePrivateLinkServiceConnectionState().actionsRequired());
        Assertions.assertEquals("bmehh", model.groupConnectivityInformation().get(0).customerVisibleFqdns().get(0));
        Assertions.assertEquals("eemaofmxagkvtme", model.groupConnectivityInformation().get(0).redirectMapId());
        Assertions
            .assertEquals("qkrhahvljua", model.groupConnectivityInformation().get(0).privateLinkServiceArmRegion());
    }
}
