// 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.MediaFilterProperties;
import com.azure.resourcemanager.mediaservices.models.FilterTrackSelection;
import com.azure.resourcemanager.mediaservices.models.FirstQuality;
import com.azure.resourcemanager.mediaservices.models.PresentationTimeRange;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class MediaFilterPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        MediaFilterProperties model =
            BinaryData
                .fromString(
                    "{\"presentationTimeRange\":{\"startTimestamp\":6283812381833889592,\"endTimestamp\":6505103417183468045,\"presentationWindowDuration\":2130961958634360268,\"liveBackoffDuration\":2427093929580813013,\"timescale\":6031739459541658820,\"forceEndTimestamp\":false},\"firstQuality\":{\"bitrate\":1139572680},\"tracks\":[{\"trackSelections\":[]},{\"trackSelections\":[]}]}")
                .toObject(MediaFilterProperties.class);
        Assertions.assertEquals(6283812381833889592L, model.presentationTimeRange().startTimestamp());
        Assertions.assertEquals(6505103417183468045L, model.presentationTimeRange().endTimestamp());
        Assertions.assertEquals(2130961958634360268L, model.presentationTimeRange().presentationWindowDuration());
        Assertions.assertEquals(2427093929580813013L, model.presentationTimeRange().liveBackoffDuration());
        Assertions.assertEquals(6031739459541658820L, model.presentationTimeRange().timescale());
        Assertions.assertEquals(false, model.presentationTimeRange().forceEndTimestamp());
        Assertions.assertEquals(1139572680, model.firstQuality().bitrate());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        MediaFilterProperties model =
            new MediaFilterProperties()
                .withPresentationTimeRange(
                    new PresentationTimeRange()
                        .withStartTimestamp(6283812381833889592L)
                        .withEndTimestamp(6505103417183468045L)
                        .withPresentationWindowDuration(2130961958634360268L)
                        .withLiveBackoffDuration(2427093929580813013L)
                        .withTimescale(6031739459541658820L)
                        .withForceEndTimestamp(false))
                .withFirstQuality(new FirstQuality().withBitrate(1139572680))
                .withTracks(
                    Arrays
                        .asList(
                            new FilterTrackSelection().withTrackSelections(Arrays.asList()),
                            new FilterTrackSelection().withTrackSelections(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(MediaFilterProperties.class);
        Assertions.assertEquals(6283812381833889592L, model.presentationTimeRange().startTimestamp());
        Assertions.assertEquals(6505103417183468045L, model.presentationTimeRange().endTimestamp());
        Assertions.assertEquals(2130961958634360268L, model.presentationTimeRange().presentationWindowDuration());
        Assertions.assertEquals(2427093929580813013L, model.presentationTimeRange().liveBackoffDuration());
        Assertions.assertEquals(6031739459541658820L, model.presentationTimeRange().timescale());
        Assertions.assertEquals(false, model.presentationTimeRange().forceEndTimestamp());
        Assertions.assertEquals(1139572680, model.firstQuality().bitrate());
    }
}
