// 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.AudioOverlay;
import java.time.Duration;
import org.junit.jupiter.api.Assertions;

public final class AudioOverlayTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AudioOverlay model =
            BinaryData
                .fromString(
                    "{\"@odata.type\":\"#Microsoft.Media.AudioOverlay\",\"inputLabel\":\"acegfnmntf\",\"start\":\"PT49H27M36S\",\"end\":\"PT150H52M6S\",\"fadeInDuration\":\"PT221H48M18S\",\"fadeOutDuration\":\"PT147H47M11S\",\"audioGainLevel\":33.91120911397068}")
                .toObject(AudioOverlay.class);
        Assertions.assertEquals("acegfnmntf", model.inputLabel());
        Assertions.assertEquals(Duration.parse("PT49H27M36S"), model.start());
        Assertions.assertEquals(Duration.parse("PT150H52M6S"), model.end());
        Assertions.assertEquals(Duration.parse("PT221H48M18S"), model.fadeInDuration());
        Assertions.assertEquals(Duration.parse("PT147H47M11S"), model.fadeOutDuration());
        Assertions.assertEquals(33.91120911397068D, model.audioGainLevel());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AudioOverlay model =
            new AudioOverlay()
                .withInputLabel("acegfnmntf")
                .withStart(Duration.parse("PT49H27M36S"))
                .withEnd(Duration.parse("PT150H52M6S"))
                .withFadeInDuration(Duration.parse("PT221H48M18S"))
                .withFadeOutDuration(Duration.parse("PT147H47M11S"))
                .withAudioGainLevel(33.91120911397068D);
        model = BinaryData.fromObject(model).toObject(AudioOverlay.class);
        Assertions.assertEquals("acegfnmntf", model.inputLabel());
        Assertions.assertEquals(Duration.parse("PT49H27M36S"), model.start());
        Assertions.assertEquals(Duration.parse("PT150H52M6S"), model.end());
        Assertions.assertEquals(Duration.parse("PT221H48M18S"), model.fadeInDuration());
        Assertions.assertEquals(Duration.parse("PT147H47M11S"), model.fadeOutDuration());
        Assertions.assertEquals(33.91120911397068D, model.audioGainLevel());
    }
}
