// 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.models.EntropyMode;
import com.azure.resourcemanager.mediaservices.models.H264Layer;
import com.azure.resourcemanager.mediaservices.models.H264VideoProfile;
import java.time.Duration;
import org.junit.jupiter.api.Assertions;

public final class H264LayerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        H264Layer model =
            BinaryData
                .fromString(
                    "{\"profile\":\"High444\",\"level\":\"pglydz\",\"bufferWindow\":\"PT209H34M52S\",\"crf\":25.056833,\"referenceFrames\":377292249,\"entropyMode\":\"Cabac\",\"bitrate\":1251506139,\"maxBitrate\":1014603209,\"bFrames\":1266268287,\"frameRate\":\"t\",\"slices\":584463560,\"adaptiveBFrame\":false,\"width\":\"dmovzvfva\",\"height\":\"zqadf\",\"label\":\"z\"}")
                .toObject(H264Layer.class);
        Assertions.assertEquals("dmovzvfva", model.width());
        Assertions.assertEquals("zqadf", model.height());
        Assertions.assertEquals("z", model.label());
        Assertions.assertEquals(1251506139, model.bitrate());
        Assertions.assertEquals(1014603209, model.maxBitrate());
        Assertions.assertEquals(1266268287, model.bFrames());
        Assertions.assertEquals("t", model.frameRate());
        Assertions.assertEquals(584463560, model.slices());
        Assertions.assertEquals(false, model.adaptiveBFrame());
        Assertions.assertEquals(H264VideoProfile.HIGH444, model.profile());
        Assertions.assertEquals("pglydz", model.level());
        Assertions.assertEquals(Duration.parse("PT209H34M52S"), model.bufferWindow());
        Assertions.assertEquals(25.056833F, model.crf());
        Assertions.assertEquals(377292249, model.referenceFrames());
        Assertions.assertEquals(EntropyMode.CABAC, model.entropyMode());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        H264Layer model =
            new H264Layer()
                .withWidth("dmovzvfva")
                .withHeight("zqadf")
                .withLabel("z")
                .withBitrate(1251506139)
                .withMaxBitrate(1014603209)
                .withBFrames(1266268287)
                .withFrameRate("t")
                .withSlices(584463560)
                .withAdaptiveBFrame(false)
                .withProfile(H264VideoProfile.HIGH444)
                .withLevel("pglydz")
                .withBufferWindow(Duration.parse("PT209H34M52S"))
                .withCrf(25.056833F)
                .withReferenceFrames(377292249)
                .withEntropyMode(EntropyMode.CABAC);
        model = BinaryData.fromObject(model).toObject(H264Layer.class);
        Assertions.assertEquals("dmovzvfva", model.width());
        Assertions.assertEquals("zqadf", model.height());
        Assertions.assertEquals("z", model.label());
        Assertions.assertEquals(1251506139, model.bitrate());
        Assertions.assertEquals(1014603209, model.maxBitrate());
        Assertions.assertEquals(1266268287, model.bFrames());
        Assertions.assertEquals("t", model.frameRate());
        Assertions.assertEquals(584463560, model.slices());
        Assertions.assertEquals(false, model.adaptiveBFrame());
        Assertions.assertEquals(H264VideoProfile.HIGH444, model.profile());
        Assertions.assertEquals("pglydz", model.level());
        Assertions.assertEquals(Duration.parse("PT209H34M52S"), model.bufferWindow());
        Assertions.assertEquals(25.056833F, model.crf());
        Assertions.assertEquals(377292249, model.referenceFrames());
        Assertions.assertEquals(EntropyMode.CABAC, model.entropyMode());
    }
}
