// 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.ContactInner;
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 ContactInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ContactInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"provisioningState\":\"deleting\",\"status\":\"scheduled\",\"reservationStartTime\":\"2021-11-03T08:28:15Z\",\"reservationEndTime\":\"2021-10-17T02:08:16Z\",\"rxStartTime\":\"2021-01-19T22:22:26Z\",\"rxEndTime\":\"2021-10-23T17:23:55Z\",\"txStartTime\":\"2021-08-27T02:48:22Z\",\"txEndTime\":\"2021-10-09T04:02:02Z\",\"errorMessage\":\"zjaoyfhrtxil\",\"maximumElevationDegrees\":27.193933,\"startAzimuthDegrees\":42.982025,\"endAzimuthDegrees\":50.19077,\"groundStationName\":\"s\",\"startElevationDegrees\":16.52248,\"endElevationDegrees\":70.19497,\"antennaConfiguration\":{\"destinationIp\":\"qawrlyxwj\",\"sourceIps\":[\"rbnwbxgjvtbvpy\",\"szdnr\",\"jq\",\"uhmuouqfprwzwbn\"]},\"contactProfile\":{\"id\":\"uitnwuiz\"}},\"id\":\"zxufiz\",\"name\":\"ckyfih\",\"type\":\"fidfvzw\"}")
                .toObject(ContactInner.class);
        Assertions.assertEquals(ContactsPropertiesProvisioningState.DELETING, model.provisioningState());
        Assertions.assertEquals(OffsetDateTime.parse("2021-11-03T08:28:15Z"), model.reservationStartTime());
        Assertions.assertEquals(OffsetDateTime.parse("2021-10-17T02:08:16Z"), model.reservationEndTime());
        Assertions.assertEquals("s", model.groundStationName());
        Assertions.assertEquals("uitnwuiz", model.contactProfile().id());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ContactInner model =
            new ContactInner()
                .withProvisioningState(ContactsPropertiesProvisioningState.DELETING)
                .withReservationStartTime(OffsetDateTime.parse("2021-11-03T08:28:15Z"))
                .withReservationEndTime(OffsetDateTime.parse("2021-10-17T02:08:16Z"))
                .withGroundStationName("s")
                .withContactProfile(new ContactsPropertiesContactProfile().withId("uitnwuiz"));
        model = BinaryData.fromObject(model).toObject(ContactInner.class);
        Assertions.assertEquals(ContactsPropertiesProvisioningState.DELETING, model.provisioningState());
        Assertions.assertEquals(OffsetDateTime.parse("2021-11-03T08:28:15Z"), model.reservationStartTime());
        Assertions.assertEquals(OffsetDateTime.parse("2021-10-17T02:08:16Z"), model.reservationEndTime());
        Assertions.assertEquals("s", model.groundStationName());
        Assertions.assertEquals("uitnwuiz", model.contactProfile().id());
    }
}
