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

package com.azure.resourcemanager.iothub.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.iothub.fluent.models.PrivateEndpointConnectionInner;
import com.azure.resourcemanager.iothub.models.PrivateEndpoint;
import com.azure.resourcemanager.iothub.models.PrivateEndpointConnectionProperties;
import com.azure.resourcemanager.iothub.models.PrivateLinkServiceConnectionState;
import com.azure.resourcemanager.iothub.models.PrivateLinkServiceConnectionStatus;
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\":{\"privateEndpoint\":{\"id\":\"audccsnhs\"},\"privateLinkServiceConnectionState\":{\"status\":\"Disconnected\",\"description\":\"nyejhkryhtnap\",\"actionsRequired\":\"wlokjyem\"}},\"id\":\"kvnipjoxz\",\"name\":\"nchgej\",\"type\":\"podmailzydehojwy\"}")
                .toObject(PrivateEndpointConnectionInner.class);
        Assertions
            .assertEquals(
                PrivateLinkServiceConnectionStatus.DISCONNECTED,
                model.properties().privateLinkServiceConnectionState().status());
        Assertions.assertEquals("nyejhkryhtnap", model.properties().privateLinkServiceConnectionState().description());
        Assertions.assertEquals("wlokjyem", model.properties().privateLinkServiceConnectionState().actionsRequired());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PrivateEndpointConnectionInner model =
            new PrivateEndpointConnectionInner()
                .withProperties(
                    new PrivateEndpointConnectionProperties()
                        .withPrivateEndpoint(new PrivateEndpoint())
                        .withPrivateLinkServiceConnectionState(
                            new PrivateLinkServiceConnectionState()
                                .withStatus(PrivateLinkServiceConnectionStatus.DISCONNECTED)
                                .withDescription("nyejhkryhtnap")
                                .withActionsRequired("wlokjyem")));
        model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionInner.class);
        Assertions
            .assertEquals(
                PrivateLinkServiceConnectionStatus.DISCONNECTED,
                model.properties().privateLinkServiceConnectionState().status());
        Assertions.assertEquals("nyejhkryhtnap", model.properties().privateLinkServiceConnectionState().description());
        Assertions.assertEquals("wlokjyem", model.properties().privateLinkServiceConnectionState().actionsRequired());
    }
}
