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

package com.azure.resourcemanager.digitaltwins.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.digitaltwins.fluent.models.PrivateEndpointConnectionInner;
import com.azure.resourcemanager.digitaltwins.models.ConnectionProperties;
import com.azure.resourcemanager.digitaltwins.models.ConnectionPropertiesPrivateLinkServiceConnectionState;
import com.azure.resourcemanager.digitaltwins.models.PrivateEndpoint;
import com.azure.resourcemanager.digitaltwins.models.PrivateLinkServiceConnectionStatus;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class PrivateEndpointConnectionInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PrivateEndpointConnectionInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"provisioningState\":\"Pending\",\"privateEndpoint\":{\"id\":\"tijbpzvgnwzsymgl\"},\"groupIds\":[\"cyzkohdbihanuf\",\"fcbjysagithxqha\",\"ifpikxwczby\",\"cnpqxuhivyqniwby\"],\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"xvd\",\"actionsRequired\":\"jgrtfwvukxga\"}},\"id\":\"ccsnhsjc\",\"name\":\"yejhk\",\"type\":\"yhtnapczwlokjye\"}")
                .toObject(PrivateEndpointConnectionInner.class);
        Assertions.assertEquals("cyzkohdbihanuf", model.properties().groupIds().get(0));
        Assertions
            .assertEquals(
                PrivateLinkServiceConnectionStatus.PENDING,
                model.properties().privateLinkServiceConnectionState().status());
        Assertions.assertEquals("xvd", model.properties().privateLinkServiceConnectionState().description());
        Assertions
            .assertEquals("jgrtfwvukxga", model.properties().privateLinkServiceConnectionState().actionsRequired());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PrivateEndpointConnectionInner model =
            new PrivateEndpointConnectionInner()
                .withProperties(
                    new ConnectionProperties()
                        .withPrivateEndpoint(new PrivateEndpoint())
                        .withGroupIds(
                            Arrays.asList("cyzkohdbihanuf", "fcbjysagithxqha", "ifpikxwczby", "cnpqxuhivyqniwby"))
                        .withPrivateLinkServiceConnectionState(
                            new ConnectionPropertiesPrivateLinkServiceConnectionState()
                                .withStatus(PrivateLinkServiceConnectionStatus.PENDING)
                                .withDescription("xvd")
                                .withActionsRequired("jgrtfwvukxga")));
        model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionInner.class);
        Assertions.assertEquals("cyzkohdbihanuf", model.properties().groupIds().get(0));
        Assertions
            .assertEquals(
                PrivateLinkServiceConnectionStatus.PENDING,
                model.properties().privateLinkServiceConnectionState().status());
        Assertions.assertEquals("xvd", model.properties().privateLinkServiceConnectionState().description());
        Assertions
            .assertEquals("jgrtfwvukxga", model.properties().privateLinkServiceConnectionState().actionsRequired());
    }
}
