// 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.AvailableContactsInner;
import com.azure.resourcemanager.orbital.models.AvailableContactsListResult;
import com.azure.resourcemanager.orbital.models.AvailableContactsSpacecraft;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class AvailableContactsListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AvailableContactsListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"spacecraft\":{\"id\":\"shurzafbljjgpbto\"},\"groundStationName\":\"jmkljavbqidtqajz\",\"properties\":{\"maximumElevationDegrees\":17.32046,\"txStartTime\":\"2021-04-22T22:07:48Z\",\"txEndTime\":\"2021-11-19T04:41:57Z\",\"rxStartTime\":\"2021-05-04T12:17:40Z\",\"rxEndTime\":\"2021-01-07T15:53:39Z\",\"startAzimuthDegrees\":78.738434,\"endAzimuthDegrees\":58.747818,\"startElevationDegrees\":54.524082,\"endElevationDegrees\":52.304203}},{\"spacecraft\":{\"id\":\"gqexzlocxs\"},\"groundStationName\":\"aierhhb\",\"properties\":{\"maximumElevationDegrees\":1.0656178,\"txStartTime\":\"2021-07-20T05:11Z\",\"txEndTime\":\"2021-01-08T14:04:30Z\",\"rxStartTime\":\"2021-03-31T08:25:57Z\",\"rxEndTime\":\"2021-08-25T02:16:19Z\",\"startAzimuthDegrees\":20.14985,\"endAzimuthDegrees\":86.22104,\"startElevationDegrees\":31.243492,\"endElevationDegrees\":33.899582}},{\"spacecraft\":{\"id\":\"k\"},\"groundStationName\":\"xo\",\"properties\":{\"maximumElevationDegrees\":53.086155,\"txStartTime\":\"2021-02-09T00:09:24Z\",\"txEndTime\":\"2021-08-22T01:00:33Z\",\"rxStartTime\":\"2021-07-25T13:21:32Z\",\"rxEndTime\":\"2021-03-11T19:14:05Z\",\"startAzimuthDegrees\":79.34552,\"endAzimuthDegrees\":20.240557,\"startElevationDegrees\":10.086643,\"endElevationDegrees\":12.215453}},{\"spacecraft\":{\"id\":\"maajrmvdjwzrlo\"},\"groundStationName\":\"clwhijcoejctbz\",\"properties\":{\"maximumElevationDegrees\":67.492355,\"txStartTime\":\"2021-09-16T11:00:54Z\",\"txEndTime\":\"2021-01-26T16:30:10Z\",\"rxStartTime\":\"2021-08-04T14:06:38Z\",\"rxEndTime\":\"2021-06-12T21:56:45Z\",\"startAzimuthDegrees\":81.61507,\"endAzimuthDegrees\":59.212852,\"startElevationDegrees\":92.8584,\"endElevationDegrees\":78.83603}}],\"nextLink\":\"pofm\"}")
                .toObject(AvailableContactsListResult.class);
        Assertions.assertEquals("shurzafbljjgpbto", model.value().get(0).spacecraft().id());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AvailableContactsListResult model =
            new AvailableContactsListResult()
                .withValue(
                    Arrays
                        .asList(
                            new AvailableContactsInner()
                                .withSpacecraft(new AvailableContactsSpacecraft().withId("shurzafbljjgpbto")),
                            new AvailableContactsInner()
                                .withSpacecraft(new AvailableContactsSpacecraft().withId("gqexzlocxs")),
                            new AvailableContactsInner().withSpacecraft(new AvailableContactsSpacecraft().withId("k")),
                            new AvailableContactsInner()
                                .withSpacecraft(new AvailableContactsSpacecraft().withId("maajrmvdjwzrlo"))));
        model = BinaryData.fromObject(model).toObject(AvailableContactsListResult.class);
        Assertions.assertEquals("shurzafbljjgpbto", model.value().get(0).spacecraft().id());
    }
}
