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

public final class ContactParametersTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ContactParameters model =
            BinaryData
                .fromString(
                    "{\"contactProfile\":{\"id\":\"gr\"},\"groundStationName\":\"bznorcjxvsnby\",\"startTime\":\"2021-08-08T19:07:21Z\",\"endTime\":\"2021-06-02T22:09:38Z\"}")
                .toObject(ContactParameters.class);
        Assertions.assertEquals("gr", model.contactProfile().id());
        Assertions.assertEquals("bznorcjxvsnby", model.groundStationName());
        Assertions.assertEquals(OffsetDateTime.parse("2021-08-08T19:07:21Z"), model.startTime());
        Assertions.assertEquals(OffsetDateTime.parse("2021-06-02T22:09:38Z"), model.endTime());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ContactParameters model =
            new ContactParameters()
                .withContactProfile(new ContactParametersContactProfile().withId("gr"))
                .withGroundStationName("bznorcjxvsnby")
                .withStartTime(OffsetDateTime.parse("2021-08-08T19:07:21Z"))
                .withEndTime(OffsetDateTime.parse("2021-06-02T22:09:38Z"));
        model = BinaryData.fromObject(model).toObject(ContactParameters.class);
        Assertions.assertEquals("gr", model.contactProfile().id());
        Assertions.assertEquals("bznorcjxvsnby", model.groundStationName());
        Assertions.assertEquals(OffsetDateTime.parse("2021-08-08T19:07:21Z"), model.startTime());
        Assertions.assertEquals(OffsetDateTime.parse("2021-06-02T22:09:38Z"), model.endTime());
    }
}
