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

package com.azure.resourcemanager.voiceservices.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.voiceservices.models.PrimaryRegionProperties;
import com.azure.resourcemanager.voiceservices.models.ServiceRegionProperties;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ServiceRegionPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ServiceRegionProperties model =
            BinaryData
                .fromString(
                    "{\"name\":\"pjoxzjnch\",\"primaryRegionProperties\":{\"operatorAddresses\":[\"jspodmailzyde\",\"o\",\"wyahuxinpmqnja\"],\"esrpAddresses\":[\"xj\",\"prozvcputegjvwmf\",\"atscmd\",\"pjhulsuuvmkj\"],\"allowedSignalingSourceAddressPrefixes\":[\"rwfndiod\"],\"allowedMediaSourceAddressPrefixes\":[\"lwejdpv\",\"ryo\",\"psoacctazakljl\"]}}")
                .toObject(ServiceRegionProperties.class);
        Assertions.assertEquals("pjoxzjnch", model.name());
        Assertions.assertEquals("jspodmailzyde", model.primaryRegionProperties().operatorAddresses().get(0));
        Assertions.assertEquals("xj", model.primaryRegionProperties().esrpAddresses().get(0));
        Assertions
            .assertEquals("rwfndiod", model.primaryRegionProperties().allowedSignalingSourceAddressPrefixes().get(0));
        Assertions.assertEquals("lwejdpv", model.primaryRegionProperties().allowedMediaSourceAddressPrefixes().get(0));
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ServiceRegionProperties model =
            new ServiceRegionProperties()
                .withName("pjoxzjnch")
                .withPrimaryRegionProperties(
                    new PrimaryRegionProperties()
                        .withOperatorAddresses(Arrays.asList("jspodmailzyde", "o", "wyahuxinpmqnja"))
                        .withEsrpAddresses(Arrays.asList("xj", "prozvcputegjvwmf", "atscmd", "pjhulsuuvmkj"))
                        .withAllowedSignalingSourceAddressPrefixes(Arrays.asList("rwfndiod"))
                        .withAllowedMediaSourceAddressPrefixes(Arrays.asList("lwejdpv", "ryo", "psoacctazakljl")));
        model = BinaryData.fromObject(model).toObject(ServiceRegionProperties.class);
        Assertions.assertEquals("pjoxzjnch", model.name());
        Assertions.assertEquals("jspodmailzyde", model.primaryRegionProperties().operatorAddresses().get(0));
        Assertions.assertEquals("xj", model.primaryRegionProperties().esrpAddresses().get(0));
        Assertions
            .assertEquals("rwfndiod", model.primaryRegionProperties().allowedSignalingSourceAddressPrefixes().get(0));
        Assertions.assertEquals("lwejdpv", model.primaryRegionProperties().allowedMediaSourceAddressPrefixes().get(0));
    }
}
