// 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.ContactsProperties;
import com.azure.resourcemanager.orbital.models.ContactsPropertiesContactProfile;
import com.azure.resourcemanager.orbital.models.ContactsPropertiesProvisioningState;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class ContactsPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ContactsProperties model =
            BinaryData
                .fromString(
                    "{\"provisioningState\":\"canceled\",\"status\":\"succeeded\",\"reservationStartTime\":\"2021-02-07T05:15:27Z\",\"reservationEndTime\":\"2021-01-09T17:32:36Z\",\"rxStartTime\":\"2021-11-17T17:09:54Z\",\"rxEndTime\":\"2021-04-25T02:46:04Z\",\"txStartTime\":\"2021-04-19T05:30:16Z\",\"txEndTime\":\"2021-10-29T21:44:59Z\",\"errorMessage\":\"xmnteiwaop\",\"maximumElevationDegrees\":86.37538,\"startAzimuthDegrees\":82.73709,\"endAzimuthDegrees\":33.100773,\"groundStationName\":\"mxdcufufsrp\",\"startElevationDegrees\":99.98795,\"endElevationDegrees\":63.053722,\"antennaConfiguration\":{\"destinationIp\":\"ezcxtbzsgfyccsne\",\"sourceIps\":[\"wzjeiach\",\"oosflnr\",\"sfqpteehz\"]},\"contactProfile\":{\"id\":\"vypyqrimzinpv\"}}")
                .toObject(ContactsProperties.class);
        Assertions.assertEquals(ContactsPropertiesProvisioningState.CANCELED, model.provisioningState());
        Assertions.assertEquals(OffsetDateTime.parse("2021-02-07T05:15:27Z"), model.reservationStartTime());
        Assertions.assertEquals(OffsetDateTime.parse("2021-01-09T17:32:36Z"), model.reservationEndTime());
        Assertions.assertEquals("mxdcufufsrp", model.groundStationName());
        Assertions.assertEquals("vypyqrimzinpv", model.contactProfile().id());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ContactsProperties model =
            new ContactsProperties()
                .withProvisioningState(ContactsPropertiesProvisioningState.CANCELED)
                .withReservationStartTime(OffsetDateTime.parse("2021-02-07T05:15:27Z"))
                .withReservationEndTime(OffsetDateTime.parse("2021-01-09T17:32:36Z"))
                .withGroundStationName("mxdcufufsrp")
                .withContactProfile(new ContactsPropertiesContactProfile().withId("vypyqrimzinpv"));
        model = BinaryData.fromObject(model).toObject(ContactsProperties.class);
        Assertions.assertEquals(ContactsPropertiesProvisioningState.CANCELED, model.provisioningState());
        Assertions.assertEquals(OffsetDateTime.parse("2021-02-07T05:15:27Z"), model.reservationStartTime());
        Assertions.assertEquals(OffsetDateTime.parse("2021-01-09T17:32:36Z"), model.reservationEndTime());
        Assertions.assertEquals("mxdcufufsrp", model.groundStationName());
        Assertions.assertEquals("vypyqrimzinpv", model.contactProfile().id());
    }
}
