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

package com.azure.resourcemanager.signalr.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.signalr.fluent.models.PrivateLinkResourceProperties;
import com.azure.resourcemanager.signalr.models.ShareablePrivateLinkResourceProperties;
import com.azure.resourcemanager.signalr.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\":\"dggkzzlvmbmpa\",\"requiredMembers\":[\"dfvue\",\"yw\",\"bpfvm\"],\"requiredZoneNames\":[\"rfouyftaakcpw\",\"yzvqt\"],\"shareablePrivateLinkResourceTypes\":[{\"name\":\"exkpzksmondjmq\",\"properties\":{\"description\":\"ypomgkopkwho\",\"groupId\":\"pajqgxysm\",\"type\":\"mbqfqvmk\"}}]}")
                .toObject(PrivateLinkResourceProperties.class);
        Assertions.assertEquals("dggkzzlvmbmpa", model.groupId());
        Assertions.assertEquals("dfvue", model.requiredMembers().get(0));
        Assertions.assertEquals("rfouyftaakcpw", model.requiredZoneNames().get(0));
        Assertions.assertEquals("exkpzksmondjmq", model.shareablePrivateLinkResourceTypes().get(0).name());
        Assertions
            .assertEquals("ypomgkopkwho", model.shareablePrivateLinkResourceTypes().get(0).properties().description());
        Assertions.assertEquals("pajqgxysm", model.shareablePrivateLinkResourceTypes().get(0).properties().groupId());
        Assertions.assertEquals("mbqfqvmk", model.shareablePrivateLinkResourceTypes().get(0).properties().type());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PrivateLinkResourceProperties model =
            new PrivateLinkResourceProperties()
                .withGroupId("dggkzzlvmbmpa")
                .withRequiredMembers(Arrays.asList("dfvue", "yw", "bpfvm"))
                .withRequiredZoneNames(Arrays.asList("rfouyftaakcpw", "yzvqt"))
                .withShareablePrivateLinkResourceTypes(
                    Arrays
                        .asList(
                            new ShareablePrivateLinkResourceType()
                                .withName("exkpzksmondjmq")
                                .withProperties(
                                    new ShareablePrivateLinkResourceProperties()
                                        .withDescription("ypomgkopkwho")
                                        .withGroupId("pajqgxysm")
                                        .withType("mbqfqvmk"))));
        model = BinaryData.fromObject(model).toObject(PrivateLinkResourceProperties.class);
        Assertions.assertEquals("dggkzzlvmbmpa", model.groupId());
        Assertions.assertEquals("dfvue", model.requiredMembers().get(0));
        Assertions.assertEquals("rfouyftaakcpw", model.requiredZoneNames().get(0));
        Assertions.assertEquals("exkpzksmondjmq", model.shareablePrivateLinkResourceTypes().get(0).name());
        Assertions
            .assertEquals("ypomgkopkwho", model.shareablePrivateLinkResourceTypes().get(0).properties().description());
        Assertions.assertEquals("pajqgxysm", model.shareablePrivateLinkResourceTypes().get(0).properties().groupId());
        Assertions.assertEquals("mbqfqvmk", model.shareablePrivateLinkResourceTypes().get(0).properties().type());
    }
}
