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

public final class OverlayTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        Overlay model =
            BinaryData
                .fromString(
                    "{\"@odata.type\":\"Overlay\",\"inputLabel\":\"iogsjkmnwq\",\"start\":\"PT131H57M43S\",\"end\":\"PT86H14M23S\",\"fadeInDuration\":\"PT18H24M56S\",\"fadeOutDuration\":\"PT35H12M55S\",\"audioGainLevel\":91.7369090402623}")
                .toObject(Overlay.class);
        Assertions.assertEquals("iogsjkmnwq", model.inputLabel());
        Assertions.assertEquals(Duration.parse("PT131H57M43S"), model.start());
        Assertions.assertEquals(Duration.parse("PT86H14M23S"), model.end());
        Assertions.assertEquals(Duration.parse("PT18H24M56S"), model.fadeInDuration());
        Assertions.assertEquals(Duration.parse("PT35H12M55S"), model.fadeOutDuration());
        Assertions.assertEquals(91.7369090402623D, model.audioGainLevel());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        Overlay model =
            new Overlay()
                .withInputLabel("iogsjkmnwq")
                .withStart(Duration.parse("PT131H57M43S"))
                .withEnd(Duration.parse("PT86H14M23S"))
                .withFadeInDuration(Duration.parse("PT18H24M56S"))
                .withFadeOutDuration(Duration.parse("PT35H12M55S"))
                .withAudioGainLevel(91.7369090402623D);
        model = BinaryData.fromObject(model).toObject(Overlay.class);
        Assertions.assertEquals("iogsjkmnwq", model.inputLabel());
        Assertions.assertEquals(Duration.parse("PT131H57M43S"), model.start());
        Assertions.assertEquals(Duration.parse("PT86H14M23S"), model.end());
        Assertions.assertEquals(Duration.parse("PT18H24M56S"), model.fadeInDuration());
        Assertions.assertEquals(Duration.parse("PT35H12M55S"), model.fadeOutDuration());
        Assertions.assertEquals(91.7369090402623D, model.audioGainLevel());
    }
}
