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

package com.azure.resourcemanager.appconfiguration.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.appconfiguration.models.ConnectionStatus;
import com.azure.resourcemanager.appconfiguration.models.PrivateEndpoint;
import com.azure.resourcemanager.appconfiguration.models.PrivateEndpointConnectionReference;
import com.azure.resourcemanager.appconfiguration.models.PrivateLinkServiceConnectionState;
import org.junit.jupiter.api.Assertions;

public final class PrivateEndpointConnectionReferenceTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PrivateEndpointConnectionReference model =
            BinaryData
                .fromString(
                    "{\"id\":\"qxhocdgeablgphut\",\"name\":\"ndv\",\"type\":\"ozwyiftyhxhuro\",\"properties\":{\"provisioningState\":\"Updating\",\"privateEndpoint\":{\"id\":\"lniwpwcukjfkgiaw\"},\"privateLinkServiceConnectionState\":{\"status\":\"Disconnected\",\"description\":\"ypl\",\"actionsRequired\":\"None\"}}}")
                .toObject(PrivateEndpointConnectionReference.class);
        Assertions.assertEquals("lniwpwcukjfkgiaw", model.privateEndpoint().id());
        Assertions.assertEquals(ConnectionStatus.DISCONNECTED, model.privateLinkServiceConnectionState().status());
        Assertions.assertEquals("ypl", model.privateLinkServiceConnectionState().description());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PrivateEndpointConnectionReference model =
            new PrivateEndpointConnectionReference()
                .withPrivateEndpoint(new PrivateEndpoint().withId("lniwpwcukjfkgiaw"))
                .withPrivateLinkServiceConnectionState(
                    new PrivateLinkServiceConnectionState()
                        .withStatus(ConnectionStatus.DISCONNECTED)
                        .withDescription("ypl"));
        model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionReference.class);
        Assertions.assertEquals("lniwpwcukjfkgiaw", model.privateEndpoint().id());
        Assertions.assertEquals(ConnectionStatus.DISCONNECTED, model.privateLinkServiceConnectionState().status());
        Assertions.assertEquals("ypl", model.privateLinkServiceConnectionState().description());
    }
}
