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

public final class PrivateEndpointConnectionPropertiesTests {
    @Test
    public void testDeserialize() {
        PrivateEndpointConnectionProperties model =
            BinaryData
                .fromString(
                    "{\"privateEndpoint\":{\"id\":\"w\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"vwryoqpso\",\"actionsRequired\":\"ctazakljlahbcryf\"},\"groupIds\":[\"dosyg\",\"xpaojakhmsbz\"],\"provisioningState\":\"Deleting\"}")
                .toObject(PrivateEndpointConnectionProperties.class);
        Assertions
            .assertEquals(
                PrivateEndpointServiceConnectionStatus.PENDING, model.privateLinkServiceConnectionState().status());
        Assertions.assertEquals("vwryoqpso", model.privateLinkServiceConnectionState().description());
        Assertions.assertEquals("ctazakljlahbcryf", model.privateLinkServiceConnectionState().actionsRequired());
        Assertions.assertEquals("dosyg", model.groupIds().get(0));
    }

    @Test
    public void testSerialize() {
        PrivateEndpointConnectionProperties model =
            new PrivateEndpointConnectionProperties()
                .withPrivateEndpoint(new PrivateEndpoint())
                .withPrivateLinkServiceConnectionState(
                    new PrivateLinkServiceConnectionState()
                        .withStatus(PrivateEndpointServiceConnectionStatus.PENDING)
                        .withDescription("vwryoqpso")
                        .withActionsRequired("ctazakljlahbcryf"))
                .withGroupIds(Arrays.asList("dosyg", "xpaojakhmsbz"));
        model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionProperties.class);
        Assertions
            .assertEquals(
                PrivateEndpointServiceConnectionStatus.PENDING, model.privateLinkServiceConnectionState().status());
        Assertions.assertEquals("vwryoqpso", model.privateLinkServiceConnectionState().description());
        Assertions.assertEquals("ctazakljlahbcryf", model.privateLinkServiceConnectionState().actionsRequired());
        Assertions.assertEquals("dosyg", model.groupIds().get(0));
    }
}
