// 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.fluent.models.SpacecraftsProperties;
import com.azure.resourcemanager.orbital.models.Direction;
import com.azure.resourcemanager.orbital.models.Polarization;
import com.azure.resourcemanager.orbital.models.SpacecraftLink;
import com.azure.resourcemanager.orbital.models.SpacecraftsPropertiesProvisioningState;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class SpacecraftsPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SpacecraftsProperties model =
            BinaryData
                .fromString(
                    "{\"provisioningState\":\"creating\",\"noradId\":\"pfzfsinzgvfc\",\"titleLine\":\"rwzoxxjtfelluwf\",\"tleLine1\":\"it\",\"tleLine2\":\"np\",\"links\":[{\"name\":\"fpjkjlxofp\",\"centerFrequencyMHz\":89.44505,\"bandwidthMHz\":15.607655,\"direction\":\"Uplink\",\"polarization\":\"linearHorizontal\",\"authorizations\":[]},{\"name\":\"ypininm\",\"centerFrequencyMHz\":57.324726,\"bandwidthMHz\":20.052296,\"direction\":\"Downlink\",\"polarization\":\"RHCP\",\"authorizations\":[]}]}")
                .toObject(SpacecraftsProperties.class);
        Assertions.assertEquals(SpacecraftsPropertiesProvisioningState.CREATING, model.provisioningState());
        Assertions.assertEquals("pfzfsinzgvfc", model.noradId());
        Assertions.assertEquals("rwzoxxjtfelluwf", model.titleLine());
        Assertions.assertEquals("it", model.tleLine1());
        Assertions.assertEquals("np", model.tleLine2());
        Assertions.assertEquals("fpjkjlxofp", model.links().get(0).name());
        Assertions.assertEquals(89.44505f, model.links().get(0).centerFrequencyMHz());
        Assertions.assertEquals(15.607655f, model.links().get(0).bandwidthMHz());
        Assertions.assertEquals(Direction.UPLINK, model.links().get(0).direction());
        Assertions.assertEquals(Polarization.LINEAR_HORIZONTAL, model.links().get(0).polarization());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SpacecraftsProperties model =
            new SpacecraftsProperties()
                .withProvisioningState(SpacecraftsPropertiesProvisioningState.CREATING)
                .withNoradId("pfzfsinzgvfc")
                .withTitleLine("rwzoxxjtfelluwf")
                .withTleLine1("it")
                .withTleLine2("np")
                .withLinks(
                    Arrays
                        .asList(
                            new SpacecraftLink()
                                .withName("fpjkjlxofp")
                                .withCenterFrequencyMHz(89.44505f)
                                .withBandwidthMHz(15.607655f)
                                .withDirection(Direction.UPLINK)
                                .withPolarization(Polarization.LINEAR_HORIZONTAL),
                            new SpacecraftLink()
                                .withName("ypininm")
                                .withCenterFrequencyMHz(57.324726f)
                                .withBandwidthMHz(20.052296f)
                                .withDirection(Direction.DOWNLINK)
                                .withPolarization(Polarization.RHCP)));
        model = BinaryData.fromObject(model).toObject(SpacecraftsProperties.class);
        Assertions.assertEquals(SpacecraftsPropertiesProvisioningState.CREATING, model.provisioningState());
        Assertions.assertEquals("pfzfsinzgvfc", model.noradId());
        Assertions.assertEquals("rwzoxxjtfelluwf", model.titleLine());
        Assertions.assertEquals("it", model.tleLine1());
        Assertions.assertEquals("np", model.tleLine2());
        Assertions.assertEquals("fpjkjlxofp", model.links().get(0).name());
        Assertions.assertEquals(89.44505f, model.links().get(0).centerFrequencyMHz());
        Assertions.assertEquals(15.607655f, model.links().get(0).bandwidthMHz());
        Assertions.assertEquals(Direction.UPLINK, model.links().get(0).direction());
        Assertions.assertEquals(Polarization.LINEAR_HORIZONTAL, model.links().get(0).polarization());
    }
}
