// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.mediaservices.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mediaservices.fluent.models.LiveEventTrackEventInner;
import com.azure.resourcemanager.mediaservices.models.LiveEventGetTrackIngestHeartbeatsResult;
import com.azure.resourcemanager.mediaservices.models.LiveEventTrackEventData;
import com.azure.resourcemanager.mediaservices.models.LiveEventTrackEventType;
import com.azure.resourcemanager.mediaservices.models.LiveEventTrackType;
import java.time.OffsetDateTime;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class LiveEventGetTrackIngestHeartbeatsResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        LiveEventGetTrackIngestHeartbeatsResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"eventType\":\"TrackEvent/IngestHeartbeat\",\"eventTime\":\"2021-06-20T15:11:08Z\",\"data\":{\"trackName\":\"ejdcngqqmoakuf\",\"trackType\":\"video\",\"bitrate\":2465621092964288470,\"incomingBitrate\":8437145680290186926,\"lastTimestamp\":\"twaenuuzko\",\"timescale\":\"minrfdw\",\"overlapCount\":7318897576104257357,\"discontinuityCount\":4568735292262817818,\"nonincreasingCount\":3459177326935122788,\"unexpectedBitrate\":true,\"state\":\"bhdmsmlmzqhof\",\"healthy\":true,\"lastFragmentArrivalTime\":\"2021-11-16T17:43:34Z\",\"ingestDriftValue\":\"u\",\"transcriptionState\":\"hxicslfaoqz\",\"transcriptionLanguage\":\"yylhalnswhccsp\"}},{\"eventType\":\"TrackEvent/IngestHeartbeat\",\"eventTime\":\"2021-11-16T11:43:34Z\",\"data\":{\"trackName\":\"tqscywug\",\"trackType\":\"video\",\"bitrate\":305912490315793501,\"incomingBitrate\":6648537753700098134,\"lastTimestamp\":\"emh\",\"timescale\":\"rsbrgzdwm\",\"overlapCount\":6841623833142002976,\"discontinuityCount\":652029490797457612,\"nonincreasingCount\":8266081369241174614,\"unexpectedBitrate\":false,\"state\":\"ccnxqhuex\",\"healthy\":true,\"lastFragmentArrivalTime\":\"2021-08-23T01:59:51Z\",\"ingestDriftValue\":\"tvlz\",\"transcriptionState\":\"emhzrncsdtc\",\"transcriptionLanguage\":\"siypbs\"}},{\"eventType\":\"TrackEvent/IngestHeartbeat\",\"eventTime\":\"2021-06-22T12:55:29Z\",\"data\":{\"trackName\":\"lfeadcygq\",\"trackType\":\"video\",\"bitrate\":8734080438498794448,\"incomingBitrate\":2578149722445500778,\"lastTimestamp\":\"xgfpelolppv\",\"timescale\":\"r\",\"overlapCount\":2149226585480848187,\"discontinuityCount\":9140598369070798378,\"nonincreasingCount\":544304143067965024,\"unexpectedBitrate\":false,\"state\":\"wrft\",\"healthy\":false,\"lastFragmentArrivalTime\":\"2021-10-26T11:25:15Z\",\"ingestDriftValue\":\"cdl\",\"transcriptionState\":\"shfwpracstwity\",\"transcriptionLanguage\":\"evxccedcp\"}}]}")
                .toObject(LiveEventGetTrackIngestHeartbeatsResult.class);
        Assertions.assertEquals(LiveEventTrackEventType.TRACK_EVENT_INGEST_HEARTBEAT, model.value().get(0).eventType());
        Assertions.assertEquals(OffsetDateTime.parse("2021-06-20T15:11:08Z"), model.value().get(0).eventTime());
        Assertions.assertEquals("ejdcngqqmoakuf", model.value().get(0).data().trackName());
        Assertions.assertEquals(LiveEventTrackType.VIDEO, model.value().get(0).data().trackType());
        Assertions.assertEquals(2465621092964288470L, model.value().get(0).data().bitrate());
        Assertions.assertEquals(8437145680290186926L, model.value().get(0).data().incomingBitrate());
        Assertions.assertEquals("twaenuuzko", model.value().get(0).data().lastTimestamp());
        Assertions.assertEquals("minrfdw", model.value().get(0).data().timescale());
        Assertions.assertEquals(7318897576104257357L, model.value().get(0).data().overlapCount());
        Assertions.assertEquals(4568735292262817818L, model.value().get(0).data().discontinuityCount());
        Assertions.assertEquals(3459177326935122788L, model.value().get(0).data().nonincreasingCount());
        Assertions.assertEquals(true, model.value().get(0).data().unexpectedBitrate());
        Assertions.assertEquals("bhdmsmlmzqhof", model.value().get(0).data().state());
        Assertions.assertEquals(true, model.value().get(0).data().healthy());
        Assertions
            .assertEquals(
                OffsetDateTime.parse("2021-11-16T17:43:34Z"), model.value().get(0).data().lastFragmentArrivalTime());
        Assertions.assertEquals("u", model.value().get(0).data().ingestDriftValue());
        Assertions.assertEquals("hxicslfaoqz", model.value().get(0).data().transcriptionState());
        Assertions.assertEquals("yylhalnswhccsp", model.value().get(0).data().transcriptionLanguage());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        LiveEventGetTrackIngestHeartbeatsResult model =
            new LiveEventGetTrackIngestHeartbeatsResult()
                .withValue(
                    Arrays
                        .asList(
                            new LiveEventTrackEventInner()
                                .withEventType(LiveEventTrackEventType.TRACK_EVENT_INGEST_HEARTBEAT)
                                .withEventTime(OffsetDateTime.parse("2021-06-20T15:11:08Z"))
                                .withData(
                                    new LiveEventTrackEventData()
                                        .withTrackName("ejdcngqqmoakuf")
                                        .withTrackType(LiveEventTrackType.VIDEO)
                                        .withBitrate(2465621092964288470L)
                                        .withIncomingBitrate(8437145680290186926L)
                                        .withLastTimestamp("twaenuuzko")
                                        .withTimescale("minrfdw")
                                        .withOverlapCount(7318897576104257357L)
                                        .withDiscontinuityCount(4568735292262817818L)
                                        .withNonincreasingCount(3459177326935122788L)
                                        .withUnexpectedBitrate(true)
                                        .withState("bhdmsmlmzqhof")
                                        .withHealthy(true)
                                        .withLastFragmentArrivalTime(OffsetDateTime.parse("2021-11-16T17:43:34Z"))
                                        .withIngestDriftValue("u")
                                        .withTranscriptionState("hxicslfaoqz")
                                        .withTranscriptionLanguage("yylhalnswhccsp")),
                            new LiveEventTrackEventInner()
                                .withEventType(LiveEventTrackEventType.TRACK_EVENT_INGEST_HEARTBEAT)
                                .withEventTime(OffsetDateTime.parse("2021-11-16T11:43:34Z"))
                                .withData(
                                    new LiveEventTrackEventData()
                                        .withTrackName("tqscywug")
                                        .withTrackType(LiveEventTrackType.VIDEO)
                                        .withBitrate(305912490315793501L)
                                        .withIncomingBitrate(6648537753700098134L)
                                        .withLastTimestamp("emh")
                                        .withTimescale("rsbrgzdwm")
                                        .withOverlapCount(6841623833142002976L)
                                        .withDiscontinuityCount(652029490797457612L)
                                        .withNonincreasingCount(8266081369241174614L)
                                        .withUnexpectedBitrate(false)
                                        .withState("ccnxqhuex")
                                        .withHealthy(true)
                                        .withLastFragmentArrivalTime(OffsetDateTime.parse("2021-08-23T01:59:51Z"))
                                        .withIngestDriftValue("tvlz")
                                        .withTranscriptionState("emhzrncsdtc")
                                        .withTranscriptionLanguage("siypbs")),
                            new LiveEventTrackEventInner()
                                .withEventType(LiveEventTrackEventType.TRACK_EVENT_INGEST_HEARTBEAT)
                                .withEventTime(OffsetDateTime.parse("2021-06-22T12:55:29Z"))
                                .withData(
                                    new LiveEventTrackEventData()
                                        .withTrackName("lfeadcygq")
                                        .withTrackType(LiveEventTrackType.VIDEO)
                                        .withBitrate(8734080438498794448L)
                                        .withIncomingBitrate(2578149722445500778L)
                                        .withLastTimestamp("xgfpelolppv")
                                        .withTimescale("r")
                                        .withOverlapCount(2149226585480848187L)
                                        .withDiscontinuityCount(9140598369070798378L)
                                        .withNonincreasingCount(544304143067965024L)
                                        .withUnexpectedBitrate(false)
                                        .withState("wrft")
                                        .withHealthy(false)
                                        .withLastFragmentArrivalTime(OffsetDateTime.parse("2021-10-26T11:25:15Z"))
                                        .withIngestDriftValue("cdl")
                                        .withTranscriptionState("shfwpracstwity")
                                        .withTranscriptionLanguage("evxccedcp"))));
        model = BinaryData.fromObject(model).toObject(LiveEventGetTrackIngestHeartbeatsResult.class);
        Assertions.assertEquals(LiveEventTrackEventType.TRACK_EVENT_INGEST_HEARTBEAT, model.value().get(0).eventType());
        Assertions.assertEquals(OffsetDateTime.parse("2021-06-20T15:11:08Z"), model.value().get(0).eventTime());
        Assertions.assertEquals("ejdcngqqmoakuf", model.value().get(0).data().trackName());
        Assertions.assertEquals(LiveEventTrackType.VIDEO, model.value().get(0).data().trackType());
        Assertions.assertEquals(2465621092964288470L, model.value().get(0).data().bitrate());
        Assertions.assertEquals(8437145680290186926L, model.value().get(0).data().incomingBitrate());
        Assertions.assertEquals("twaenuuzko", model.value().get(0).data().lastTimestamp());
        Assertions.assertEquals("minrfdw", model.value().get(0).data().timescale());
        Assertions.assertEquals(7318897576104257357L, model.value().get(0).data().overlapCount());
        Assertions.assertEquals(4568735292262817818L, model.value().get(0).data().discontinuityCount());
        Assertions.assertEquals(3459177326935122788L, model.value().get(0).data().nonincreasingCount());
        Assertions.assertEquals(true, model.value().get(0).data().unexpectedBitrate());
        Assertions.assertEquals("bhdmsmlmzqhof", model.value().get(0).data().state());
        Assertions.assertEquals(true, model.value().get(0).data().healthy());
        Assertions
            .assertEquals(
                OffsetDateTime.parse("2021-11-16T17:43:34Z"), model.value().get(0).data().lastFragmentArrivalTime());
        Assertions.assertEquals("u", model.value().get(0).data().ingestDriftValue());
        Assertions.assertEquals("hxicslfaoqz", model.value().get(0).data().transcriptionState());
        Assertions.assertEquals("yylhalnswhccsp", model.value().get(0).data().transcriptionLanguage());
    }
}
