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

package com.azure.resourcemanager.mariadb.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mariadb.models.PrivateEndpointProperty;
import com.azure.resourcemanager.mariadb.models.PrivateLinkServiceConnectionStateStatus;
import com.azure.resourcemanager.mariadb.models.ServerPrivateEndpointConnectionProperties;
import com.azure.resourcemanager.mariadb.models.ServerPrivateLinkServiceConnectionStateProperty;
import org.junit.jupiter.api.Assertions;

public final class ServerPrivateEndpointConnectionPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ServerPrivateEndpointConnectionProperties model =
            BinaryData
                .fromString(
                    "{\"privateEndpoint\":{\"id\":\"zvcputegjvwmfda\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"mdvpjhulsu\",\"actionsRequired\":\"None\"},\"provisioningState\":\"Failed\"}")
                .toObject(ServerPrivateEndpointConnectionProperties.class);
        Assertions.assertEquals("zvcputegjvwmfda", model.privateEndpoint().id());
        Assertions
            .assertEquals(
                PrivateLinkServiceConnectionStateStatus.APPROVED, model.privateLinkServiceConnectionState().status());
        Assertions.assertEquals("mdvpjhulsu", model.privateLinkServiceConnectionState().description());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ServerPrivateEndpointConnectionProperties model =
            new ServerPrivateEndpointConnectionProperties()
                .withPrivateEndpoint(new PrivateEndpointProperty().withId("zvcputegjvwmfda"))
                .withPrivateLinkServiceConnectionState(
                    new ServerPrivateLinkServiceConnectionStateProperty()
                        .withStatus(PrivateLinkServiceConnectionStateStatus.APPROVED)
                        .withDescription("mdvpjhulsu"));
        model = BinaryData.fromObject(model).toObject(ServerPrivateEndpointConnectionProperties.class);
        Assertions.assertEquals("zvcputegjvwmfda", model.privateEndpoint().id());
        Assertions
            .assertEquals(
                PrivateLinkServiceConnectionStateStatus.APPROVED, model.privateLinkServiceConnectionState().status());
        Assertions.assertEquals("mdvpjhulsu", model.privateLinkServiceConnectionState().description());
    }
}
