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

package com.azure.resourcemanager.cosmosdbforpostgresql.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.PrivateEndpointConnectionSimpleProperties;
import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpointProperty;
import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpointServiceConnectionStatus;
import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateLinkServiceConnectionState;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class PrivateEndpointConnectionSimplePropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PrivateEndpointConnectionSimpleProperties model =
            BinaryData
                .fromString(
                    "{\"privateEndpoint\":{\"id\":\"jpsq\"},\"groupIds\":[\"poyfdkfogkn\",\"gjofjd\"],\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"deupewnwrei\",\"actionsRequired\":\"zyf\"}}")
                .toObject(PrivateEndpointConnectionSimpleProperties.class);
        Assertions.assertEquals("jpsq", model.privateEndpoint().id());
        Assertions.assertEquals("poyfdkfogkn", model.groupIds().get(0));
        Assertions
            .assertEquals(
                PrivateEndpointServiceConnectionStatus.REJECTED, model.privateLinkServiceConnectionState().status());
        Assertions.assertEquals("deupewnwrei", model.privateLinkServiceConnectionState().description());
        Assertions.assertEquals("zyf", model.privateLinkServiceConnectionState().actionsRequired());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PrivateEndpointConnectionSimpleProperties model =
            new PrivateEndpointConnectionSimpleProperties()
                .withPrivateEndpoint(new PrivateEndpointProperty().withId("jpsq"))
                .withGroupIds(Arrays.asList("poyfdkfogkn", "gjofjd"))
                .withPrivateLinkServiceConnectionState(
                    new PrivateLinkServiceConnectionState()
                        .withStatus(PrivateEndpointServiceConnectionStatus.REJECTED)
                        .withDescription("deupewnwrei")
                        .withActionsRequired("zyf"));
        model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionSimpleProperties.class);
        Assertions.assertEquals("jpsq", model.privateEndpoint().id());
        Assertions.assertEquals("poyfdkfogkn", model.groupIds().get(0));
        Assertions
            .assertEquals(
                PrivateEndpointServiceConnectionStatus.REJECTED, model.privateLinkServiceConnectionState().status());
        Assertions.assertEquals("deupewnwrei", model.privateLinkServiceConnectionState().description());
        Assertions.assertEquals("zyf", model.privateLinkServiceConnectionState().actionsRequired());
    }
}
