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

package com.azure.resourcemanager.orbital.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.orbital.models.ContactProfileLink;
import com.azure.resourcemanager.orbital.models.ContactProfileLinkChannel;
import com.azure.resourcemanager.orbital.models.Direction;
import com.azure.resourcemanager.orbital.models.EndPoint;
import com.azure.resourcemanager.orbital.models.Polarization;
import com.azure.resourcemanager.orbital.models.Protocol;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ContactProfileLinkTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ContactProfileLink model =
            BinaryData
                .fromString(
                    "{\"name\":\"pgacftadehxnlty\",\"polarization\":\"RHCP\",\"direction\":\"Downlink\",\"gainOverTemperature\":41.25828,\"eirpdBW\":40.80089,\"channels\":[{\"name\":\"esnzwde\",\"centerFrequencyMHz\":20.416248,\"bandwidthMHz\":13.988966,\"endPoint\":{\"ipAddress\":\"vorxzdmohct\",\"endPointName\":\"qvudwxdndnvowgu\",\"port\":\"jugwdkcglhsl\",\"protocol\":\"TCP\"},\"modulationConfiguration\":\"dyggdtjixhbku\",\"demodulationConfiguration\":\"qweykhmenev\",\"encodingConfiguration\":\"exfwhy\",\"decodingConfiguration\":\"i\"},{\"name\":\"vyvdcs\",\"centerFrequencyMHz\":88.85056,\"bandwidthMHz\":33.80321,\"endPoint\":{\"ipAddress\":\"nnaamdectehfiqsc\",\"endPointName\":\"eypvhezrkg\",\"port\":\"hcjrefovgmk\",\"protocol\":\"TCP\"},\"modulationConfiguration\":\"eyyvxyqjpkcat\",\"demodulationConfiguration\":\"ngj\",\"encodingConfiguration\":\"cczsq\",\"decodingConfiguration\":\"hvmdajvnysounq\"},{\"name\":\"canoaeupf\",\"centerFrequencyMHz\":75.87674,\"bandwidthMHz\":97.245766,\"endPoint\":{\"ipAddress\":\"ltrpmopj\",\"endPointName\":\"cma\",\"port\":\"u\",\"protocol\":\"TCP\"},\"modulationConfiguration\":\"hfuiuaodsfc\",\"demodulationConfiguration\":\"vxodpu\",\"encodingConfiguration\":\"myzydagfuaxbez\",\"decodingConfiguration\":\"uokktwhrdxwz\"},{\"name\":\"wqsmbsur\",\"centerFrequencyMHz\":17.700737,\"bandwidthMHz\":85.49606,\"endPoint\":{\"ipAddress\":\"moryocfsfksym\",\"endPointName\":\"dystkiiuxhqyud\",\"port\":\"o\",\"protocol\":\"TCP\"},\"modulationConfiguration\":\"nbpoczvyifqrvkdv\",\"demodulationConfiguration\":\"llr\",\"encodingConfiguration\":\"vdfwatkpn\",\"decodingConfiguration\":\"lexxbczwtru\"}]}")
                .toObject(ContactProfileLink.class);
        Assertions.assertEquals("pgacftadehxnlty", model.name());
        Assertions.assertEquals(Polarization.RHCP, model.polarization());
        Assertions.assertEquals(Direction.DOWNLINK, model.direction());
        Assertions.assertEquals(41.25828F, model.gainOverTemperature());
        Assertions.assertEquals(40.80089F, model.eirpdBW());
        Assertions.assertEquals("esnzwde", model.channels().get(0).name());
        Assertions.assertEquals(20.416248f, model.channels().get(0).centerFrequencyMHz());
        Assertions.assertEquals(13.988966f, model.channels().get(0).bandwidthMHz());
        Assertions.assertEquals("vorxzdmohct", model.channels().get(0).endPoint().ipAddress());
        Assertions.assertEquals("qvudwxdndnvowgu", model.channels().get(0).endPoint().endPointName());
        Assertions.assertEquals("jugwdkcglhsl", model.channels().get(0).endPoint().port());
        Assertions.assertEquals(Protocol.TCP, model.channels().get(0).endPoint().protocol());
        Assertions.assertEquals("dyggdtjixhbku", model.channels().get(0).modulationConfiguration());
        Assertions.assertEquals("qweykhmenev", model.channels().get(0).demodulationConfiguration());
        Assertions.assertEquals("exfwhy", model.channels().get(0).encodingConfiguration());
        Assertions.assertEquals("i", model.channels().get(0).decodingConfiguration());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ContactProfileLink model =
            new ContactProfileLink()
                .withName("pgacftadehxnlty")
                .withPolarization(Polarization.RHCP)
                .withDirection(Direction.DOWNLINK)
                .withGainOverTemperature(41.25828F)
                .withEirpdBW(40.80089F)
                .withChannels(
                    Arrays
                        .asList(
                            new ContactProfileLinkChannel()
                                .withName("esnzwde")
                                .withCenterFrequencyMHz(20.416248f)
                                .withBandwidthMHz(13.988966f)
                                .withEndPoint(
                                    new EndPoint()
                                        .withIpAddress("vorxzdmohct")
                                        .withEndPointName("qvudwxdndnvowgu")
                                        .withPort("jugwdkcglhsl")
                                        .withProtocol(Protocol.TCP))
                                .withModulationConfiguration("dyggdtjixhbku")
                                .withDemodulationConfiguration("qweykhmenev")
                                .withEncodingConfiguration("exfwhy")
                                .withDecodingConfiguration("i"),
                            new ContactProfileLinkChannel()
                                .withName("vyvdcs")
                                .withCenterFrequencyMHz(88.85056f)
                                .withBandwidthMHz(33.80321f)
                                .withEndPoint(
                                    new EndPoint()
                                        .withIpAddress("nnaamdectehfiqsc")
                                        .withEndPointName("eypvhezrkg")
                                        .withPort("hcjrefovgmk")
                                        .withProtocol(Protocol.TCP))
                                .withModulationConfiguration("eyyvxyqjpkcat")
                                .withDemodulationConfiguration("ngj")
                                .withEncodingConfiguration("cczsq")
                                .withDecodingConfiguration("hvmdajvnysounq"),
                            new ContactProfileLinkChannel()
                                .withName("canoaeupf")
                                .withCenterFrequencyMHz(75.87674f)
                                .withBandwidthMHz(97.245766f)
                                .withEndPoint(
                                    new EndPoint()
                                        .withIpAddress("ltrpmopj")
                                        .withEndPointName("cma")
                                        .withPort("u")
                                        .withProtocol(Protocol.TCP))
                                .withModulationConfiguration("hfuiuaodsfc")
                                .withDemodulationConfiguration("vxodpu")
                                .withEncodingConfiguration("myzydagfuaxbez")
                                .withDecodingConfiguration("uokktwhrdxwz"),
                            new ContactProfileLinkChannel()
                                .withName("wqsmbsur")
                                .withCenterFrequencyMHz(17.700737f)
                                .withBandwidthMHz(85.49606f)
                                .withEndPoint(
                                    new EndPoint()
                                        .withIpAddress("moryocfsfksym")
                                        .withEndPointName("dystkiiuxhqyud")
                                        .withPort("o")
                                        .withProtocol(Protocol.TCP))
                                .withModulationConfiguration("nbpoczvyifqrvkdv")
                                .withDemodulationConfiguration("llr")
                                .withEncodingConfiguration("vdfwatkpn")
                                .withDecodingConfiguration("lexxbczwtru")));
        model = BinaryData.fromObject(model).toObject(ContactProfileLink.class);
        Assertions.assertEquals("pgacftadehxnlty", model.name());
        Assertions.assertEquals(Polarization.RHCP, model.polarization());
        Assertions.assertEquals(Direction.DOWNLINK, model.direction());
        Assertions.assertEquals(41.25828F, model.gainOverTemperature());
        Assertions.assertEquals(40.80089F, model.eirpdBW());
        Assertions.assertEquals("esnzwde", model.channels().get(0).name());
        Assertions.assertEquals(20.416248f, model.channels().get(0).centerFrequencyMHz());
        Assertions.assertEquals(13.988966f, model.channels().get(0).bandwidthMHz());
        Assertions.assertEquals("vorxzdmohct", model.channels().get(0).endPoint().ipAddress());
        Assertions.assertEquals("qvudwxdndnvowgu", model.channels().get(0).endPoint().endPointName());
        Assertions.assertEquals("jugwdkcglhsl", model.channels().get(0).endPoint().port());
        Assertions.assertEquals(Protocol.TCP, model.channels().get(0).endPoint().protocol());
        Assertions.assertEquals("dyggdtjixhbku", model.channels().get(0).modulationConfiguration());
        Assertions.assertEquals("qweykhmenev", model.channels().get(0).demodulationConfiguration());
        Assertions.assertEquals("exfwhy", model.channels().get(0).encodingConfiguration());
        Assertions.assertEquals("i", model.channels().get(0).decodingConfiguration());
    }
}
