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

package com.azure.resourcemanager.dashboard.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.dashboard.fluent.models.PrivateEndpointConnectionInner;
import com.azure.resourcemanager.dashboard.models.PrivateEndpoint;
import com.azure.resourcemanager.dashboard.models.PrivateEndpointServiceConnectionStatus;
import com.azure.resourcemanager.dashboard.models.PrivateLinkServiceConnectionState;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class PrivateEndpointConnectionInnerTests {
    @Test
    public void testDeserialize() {
        PrivateEndpointConnectionInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"privateEndpoint\":{\"id\":\"wtmutduq\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"spwgcuertumkdosv\",\"actionsRequired\":\"hbmdgbbjfdd\"},\"groupIds\":[\"mbe\",\"ppbhtqqrolfp\",\"psalgbqux\",\"gjyjgzjaoyfhrtxi\"],\"provisioningState\":\"Creating\"},\"id\":\"kujysvlejuvfq\",\"name\":\"wrlyxwjkcprb\",\"type\":\"wbxgjvt\"}")
                .toObject(PrivateEndpointConnectionInner.class);
        Assertions
            .assertEquals(
                PrivateEndpointServiceConnectionStatus.PENDING, model.privateLinkServiceConnectionState().status());
        Assertions.assertEquals("spwgcuertumkdosv", model.privateLinkServiceConnectionState().description());
        Assertions.assertEquals("hbmdgbbjfdd", model.privateLinkServiceConnectionState().actionsRequired());
        Assertions.assertEquals("mbe", model.groupIds().get(0));
    }

    @Test
    public void testSerialize() {
        PrivateEndpointConnectionInner model =
            new PrivateEndpointConnectionInner()
                .withPrivateEndpoint(new PrivateEndpoint())
                .withPrivateLinkServiceConnectionState(
                    new PrivateLinkServiceConnectionState()
                        .withStatus(PrivateEndpointServiceConnectionStatus.PENDING)
                        .withDescription("spwgcuertumkdosv")
                        .withActionsRequired("hbmdgbbjfdd"))
                .withGroupIds(Arrays.asList("mbe", "ppbhtqqrolfp", "psalgbqux", "gjyjgzjaoyfhrtxi"));
        model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionInner.class);
        Assertions
            .assertEquals(
                PrivateEndpointServiceConnectionStatus.PENDING, model.privateLinkServiceConnectionState().status());
        Assertions.assertEquals("spwgcuertumkdosv", model.privateLinkServiceConnectionState().description());
        Assertions.assertEquals("hbmdgbbjfdd", model.privateLinkServiceConnectionState().actionsRequired());
        Assertions.assertEquals("mbe", model.groupIds().get(0));
    }
}
