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

package com.azure.resourcemanager.webpubsub.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.webpubsub.fluent.models.PrivateLinkResourceProperties;
import com.azure.resourcemanager.webpubsub.models.ShareablePrivateLinkResourceProperties;
import com.azure.resourcemanager.webpubsub.models.ShareablePrivateLinkResourceType;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class PrivateLinkResourcePropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PrivateLinkResourceProperties model =
            BinaryData
                .fromString(
                    "{\"groupId\":\"wqiok\",\"requiredMembers\":[\"xmojmsvpkjp\"],\"requiredZoneNames\":[\"wcfzqljyxgt\"],\"shareablePrivateLinkResourceTypes\":[{\"name\":\"ydbsd\",\"properties\":{\"description\":\"kx\",\"groupId\":\"ehvbbxurip\",\"type\":\"fnhtbaxkgxyw\"}}]}")
                .toObject(PrivateLinkResourceProperties.class);
        Assertions.assertEquals("wqiok", model.groupId());
        Assertions.assertEquals("xmojmsvpkjp", model.requiredMembers().get(0));
        Assertions.assertEquals("wcfzqljyxgt", model.requiredZoneNames().get(0));
        Assertions.assertEquals("ydbsd", model.shareablePrivateLinkResourceTypes().get(0).name());
        Assertions.assertEquals("kx", model.shareablePrivateLinkResourceTypes().get(0).properties().description());
        Assertions.assertEquals("ehvbbxurip", model.shareablePrivateLinkResourceTypes().get(0).properties().groupId());
        Assertions.assertEquals("fnhtbaxkgxyw", model.shareablePrivateLinkResourceTypes().get(0).properties().type());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PrivateLinkResourceProperties model =
            new PrivateLinkResourceProperties()
                .withGroupId("wqiok")
                .withRequiredMembers(Arrays.asList("xmojmsvpkjp"))
                .withRequiredZoneNames(Arrays.asList("wcfzqljyxgt"))
                .withShareablePrivateLinkResourceTypes(
                    Arrays
                        .asList(
                            new ShareablePrivateLinkResourceType()
                                .withName("ydbsd")
                                .withProperties(
                                    new ShareablePrivateLinkResourceProperties()
                                        .withDescription("kx")
                                        .withGroupId("ehvbbxurip")
                                        .withType("fnhtbaxkgxyw"))));
        model = BinaryData.fromObject(model).toObject(PrivateLinkResourceProperties.class);
        Assertions.assertEquals("wqiok", model.groupId());
        Assertions.assertEquals("xmojmsvpkjp", model.requiredMembers().get(0));
        Assertions.assertEquals("wcfzqljyxgt", model.requiredZoneNames().get(0));
        Assertions.assertEquals("ydbsd", model.shareablePrivateLinkResourceTypes().get(0).name());
        Assertions.assertEquals("kx", model.shareablePrivateLinkResourceTypes().get(0).properties().description());
        Assertions.assertEquals("ehvbbxurip", model.shareablePrivateLinkResourceTypes().get(0).properties().groupId());
        Assertions.assertEquals("fnhtbaxkgxyw", model.shareablePrivateLinkResourceTypes().get(0).properties().type());
    }
}
