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

package com.azure.resourcemanager.peering.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.peering.fluent.models.PeeringLocationProperties;
import com.azure.resourcemanager.peering.models.DirectPeeringFacility;
import com.azure.resourcemanager.peering.models.DirectPeeringType;
import com.azure.resourcemanager.peering.models.ExchangePeeringFacility;
import com.azure.resourcemanager.peering.models.PeeringBandwidthOffer;
import com.azure.resourcemanager.peering.models.PeeringLocationPropertiesDirect;
import com.azure.resourcemanager.peering.models.PeeringLocationPropertiesExchange;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class PeeringLocationPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PeeringLocationProperties model =
            BinaryData
                .fromString(
                    "{\"direct\":{\"peeringFacilities\":[{\"address\":\"poczvyifqrvkdvjs\",\"directPeeringType\":\"Edge\",\"peeringDBFacilityId\":1321349224,\"peeringDBFacilityLink\":\"d\"},{\"address\":\"atkpnp\",\"directPeeringType\":\"Transit\",\"peeringDBFacilityId\":891101767,\"peeringDBFacilityLink\":\"czwtruwiqzbqjv\"},{\"address\":\"vmyokacspkwl\",\"directPeeringType\":\"IxRs\",\"peeringDBFacilityId\":1687920757,\"peeringDBFacilityLink\":\"xjmflbvv\"},{\"address\":\"hrk\",\"directPeeringType\":\"IxRs\",\"peeringDBFacilityId\":1426028232,\"peeringDBFacilityLink\":\"juqk\"}],\"bandwidthOffers\":[{\"offerName\":\"jiwkuofoskghsau\",\"valueInMbps\":2118838793}]},\"exchange\":{\"peeringFacilities\":[{\"exchangeName\":\"ied\",\"bandwidthInMbps\":2070328561,\"microsoftIPv4Address\":\"dyjrrfbyaosv\",\"microsoftIPv6Address\":\"csonpclhoco\",\"facilityIPv4Prefix\":\"lkevle\",\"facilityIPv6Prefix\":\"zfbuhf\",\"peeringDBFacilityId\":53032115,\"peeringDBFacilityLink\":\"x\"},{\"exchangeName\":\"feiithlvmez\",\"bandwidthInMbps\":2122365511,\"microsoftIPv4Address\":\"xmzsbbzogg\",\"microsoftIPv6Address\":\"rxwburv\",\"facilityIPv4Prefix\":\"xjnspy\",\"facilityIPv6Prefix\":\"tko\",\"peeringDBFacilityId\":926679159,\"peeringDBFacilityLink\":\"uknvudwti\"},{\"exchangeName\":\"bldngkpoc\",\"bandwidthInMbps\":523665642,\"microsoftIPv4Address\":\"yxoegukgjnp\",\"microsoftIPv6Address\":\"cgygev\",\"facilityIPv4Prefix\":\"ntypmrbpizcdrqj\",\"facilityIPv6Prefix\":\"pyd\",\"peeringDBFacilityId\":1305817330,\"peeringDBFacilityLink\":\"xdeoejzic\"}]},\"peeringLocation\":\"fsj\",\"country\":\"gzfbishcbk\",\"azureRegion\":\"jdeyeamdpha\"}")
                .toObject(PeeringLocationProperties.class);
        Assertions.assertEquals("poczvyifqrvkdvjs", model.direct().peeringFacilities().get(0).address());
        Assertions.assertEquals(DirectPeeringType.EDGE, model.direct().peeringFacilities().get(0).directPeeringType());
        Assertions.assertEquals(1321349224, model.direct().peeringFacilities().get(0).peeringDBFacilityId());
        Assertions.assertEquals("d", model.direct().peeringFacilities().get(0).peeringDBFacilityLink());
        Assertions.assertEquals("jiwkuofoskghsau", model.direct().bandwidthOffers().get(0).offerName());
        Assertions.assertEquals(2118838793, model.direct().bandwidthOffers().get(0).valueInMbps());
        Assertions.assertEquals("ied", model.exchange().peeringFacilities().get(0).exchangeName());
        Assertions.assertEquals(2070328561, model.exchange().peeringFacilities().get(0).bandwidthInMbps());
        Assertions.assertEquals("dyjrrfbyaosv", model.exchange().peeringFacilities().get(0).microsoftIPv4Address());
        Assertions.assertEquals("csonpclhoco", model.exchange().peeringFacilities().get(0).microsoftIPv6Address());
        Assertions.assertEquals("lkevle", model.exchange().peeringFacilities().get(0).facilityIPv4Prefix());
        Assertions.assertEquals("zfbuhf", model.exchange().peeringFacilities().get(0).facilityIPv6Prefix());
        Assertions.assertEquals(53032115, model.exchange().peeringFacilities().get(0).peeringDBFacilityId());
        Assertions.assertEquals("x", model.exchange().peeringFacilities().get(0).peeringDBFacilityLink());
        Assertions.assertEquals("fsj", model.peeringLocation());
        Assertions.assertEquals("gzfbishcbk", model.country());
        Assertions.assertEquals("jdeyeamdpha", model.azureRegion());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PeeringLocationProperties model =
            new PeeringLocationProperties()
                .withDirect(
                    new PeeringLocationPropertiesDirect()
                        .withPeeringFacilities(
                            Arrays
                                .asList(
                                    new DirectPeeringFacility()
                                        .withAddress("poczvyifqrvkdvjs")
                                        .withDirectPeeringType(DirectPeeringType.EDGE)
                                        .withPeeringDBFacilityId(1321349224)
                                        .withPeeringDBFacilityLink("d"),
                                    new DirectPeeringFacility()
                                        .withAddress("atkpnp")
                                        .withDirectPeeringType(DirectPeeringType.TRANSIT)
                                        .withPeeringDBFacilityId(891101767)
                                        .withPeeringDBFacilityLink("czwtruwiqzbqjv"),
                                    new DirectPeeringFacility()
                                        .withAddress("vmyokacspkwl")
                                        .withDirectPeeringType(DirectPeeringType.IX_RS)
                                        .withPeeringDBFacilityId(1687920757)
                                        .withPeeringDBFacilityLink("xjmflbvv"),
                                    new DirectPeeringFacility()
                                        .withAddress("hrk")
                                        .withDirectPeeringType(DirectPeeringType.IX_RS)
                                        .withPeeringDBFacilityId(1426028232)
                                        .withPeeringDBFacilityLink("juqk")))
                        .withBandwidthOffers(
                            Arrays
                                .asList(
                                    new PeeringBandwidthOffer()
                                        .withOfferName("jiwkuofoskghsau")
                                        .withValueInMbps(2118838793))))
                .withExchange(
                    new PeeringLocationPropertiesExchange()
                        .withPeeringFacilities(
                            Arrays
                                .asList(
                                    new ExchangePeeringFacility()
                                        .withExchangeName("ied")
                                        .withBandwidthInMbps(2070328561)
                                        .withMicrosoftIPv4Address("dyjrrfbyaosv")
                                        .withMicrosoftIPv6Address("csonpclhoco")
                                        .withFacilityIPv4Prefix("lkevle")
                                        .withFacilityIPv6Prefix("zfbuhf")
                                        .withPeeringDBFacilityId(53032115)
                                        .withPeeringDBFacilityLink("x"),
                                    new ExchangePeeringFacility()
                                        .withExchangeName("feiithlvmez")
                                        .withBandwidthInMbps(2122365511)
                                        .withMicrosoftIPv4Address("xmzsbbzogg")
                                        .withMicrosoftIPv6Address("rxwburv")
                                        .withFacilityIPv4Prefix("xjnspy")
                                        .withFacilityIPv6Prefix("tko")
                                        .withPeeringDBFacilityId(926679159)
                                        .withPeeringDBFacilityLink("uknvudwti"),
                                    new ExchangePeeringFacility()
                                        .withExchangeName("bldngkpoc")
                                        .withBandwidthInMbps(523665642)
                                        .withMicrosoftIPv4Address("yxoegukgjnp")
                                        .withMicrosoftIPv6Address("cgygev")
                                        .withFacilityIPv4Prefix("ntypmrbpizcdrqj")
                                        .withFacilityIPv6Prefix("pyd")
                                        .withPeeringDBFacilityId(1305817330)
                                        .withPeeringDBFacilityLink("xdeoejzic"))))
                .withPeeringLocation("fsj")
                .withCountry("gzfbishcbk")
                .withAzureRegion("jdeyeamdpha");
        model = BinaryData.fromObject(model).toObject(PeeringLocationProperties.class);
        Assertions.assertEquals("poczvyifqrvkdvjs", model.direct().peeringFacilities().get(0).address());
        Assertions.assertEquals(DirectPeeringType.EDGE, model.direct().peeringFacilities().get(0).directPeeringType());
        Assertions.assertEquals(1321349224, model.direct().peeringFacilities().get(0).peeringDBFacilityId());
        Assertions.assertEquals("d", model.direct().peeringFacilities().get(0).peeringDBFacilityLink());
        Assertions.assertEquals("jiwkuofoskghsau", model.direct().bandwidthOffers().get(0).offerName());
        Assertions.assertEquals(2118838793, model.direct().bandwidthOffers().get(0).valueInMbps());
        Assertions.assertEquals("ied", model.exchange().peeringFacilities().get(0).exchangeName());
        Assertions.assertEquals(2070328561, model.exchange().peeringFacilities().get(0).bandwidthInMbps());
        Assertions.assertEquals("dyjrrfbyaosv", model.exchange().peeringFacilities().get(0).microsoftIPv4Address());
        Assertions.assertEquals("csonpclhoco", model.exchange().peeringFacilities().get(0).microsoftIPv6Address());
        Assertions.assertEquals("lkevle", model.exchange().peeringFacilities().get(0).facilityIPv4Prefix());
        Assertions.assertEquals("zfbuhf", model.exchange().peeringFacilities().get(0).facilityIPv6Prefix());
        Assertions.assertEquals(53032115, model.exchange().peeringFacilities().get(0).peeringDBFacilityId());
        Assertions.assertEquals("x", model.exchange().peeringFacilities().get(0).peeringDBFacilityLink());
        Assertions.assertEquals("fsj", model.peeringLocation());
        Assertions.assertEquals("gzfbishcbk", model.country());
        Assertions.assertEquals("jdeyeamdpha", model.azureRegion());
    }
}
