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

package com.azure.resourcemanager.recoveryservicesbackup.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpoint;
import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpointConnection;
import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpointConnectionStatus;
import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateLinkServiceConnectionState;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProvisioningState;
import org.junit.jupiter.api.Assertions;

public final class PrivateEndpointConnectionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PrivateEndpointConnection model =
            BinaryData
                .fromString(
                    "{\"provisioningState\":\"Pending\",\"privateEndpoint\":{\"id\":\"cfvmmco\"},\"privateLinkServiceConnectionState\":{\"status\":\"Disconnected\",\"description\":\"zevgb\",\"actionRequired\":\"jqabcypmivkwlzuv\"}}")
                .toObject(PrivateEndpointConnection.class);
        Assertions.assertEquals(ProvisioningState.PENDING, model.provisioningState());
        Assertions.assertEquals("cfvmmco", model.privateEndpoint().id());
        Assertions
            .assertEquals(
                PrivateEndpointConnectionStatus.DISCONNECTED, model.privateLinkServiceConnectionState().status());
        Assertions.assertEquals("zevgb", model.privateLinkServiceConnectionState().description());
        Assertions.assertEquals("jqabcypmivkwlzuv", model.privateLinkServiceConnectionState().actionRequired());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PrivateEndpointConnection model =
            new PrivateEndpointConnection()
                .withProvisioningState(ProvisioningState.PENDING)
                .withPrivateEndpoint(new PrivateEndpoint().withId("cfvmmco"))
                .withPrivateLinkServiceConnectionState(
                    new PrivateLinkServiceConnectionState()
                        .withStatus(PrivateEndpointConnectionStatus.DISCONNECTED)
                        .withDescription("zevgb")
                        .withActionRequired("jqabcypmivkwlzuv"));
        model = BinaryData.fromObject(model).toObject(PrivateEndpointConnection.class);
        Assertions.assertEquals(ProvisioningState.PENDING, model.provisioningState());
        Assertions.assertEquals("cfvmmco", model.privateEndpoint().id());
        Assertions
            .assertEquals(
                PrivateEndpointConnectionStatus.DISCONNECTED, model.privateLinkServiceConnectionState().status());
        Assertions.assertEquals("zevgb", model.privateLinkServiceConnectionState().description());
        Assertions.assertEquals("jqabcypmivkwlzuv", model.privateLinkServiceConnectionState().actionRequired());
    }
}
