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

public final class VideoOverlayTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        VideoOverlay model =
            BinaryData
                .fromString(
                    "{\"@odata.type\":\"#Microsoft.Media.VideoOverlay\",\"position\":{\"left\":\"zmegnitgvk\",\"top\":\"zyqdrfegcealzx\",\"width\":\"cansymoyqhlwigd\",\"height\":\"bkbxgomfa\"},\"opacity\":67.37119600885748,\"cropRectangle\":{\"left\":\"vdaeyyguxakjsq\",\"top\":\"zbezkgimsidxasic\",\"width\":\"yvvjskgfmo\",\"height\":\"ah\"},\"inputLabel\":\"qgatjeaahhvjhhn\",\"start\":\"PT193H41M36S\",\"end\":\"PT205H48M20S\",\"fadeInDuration\":\"PT38H59M39S\",\"fadeOutDuration\":\"PT83H32M15S\",\"audioGainLevel\":15.81435793256083}")
                .toObject(VideoOverlay.class);
        Assertions.assertEquals("qgatjeaahhvjhhn", model.inputLabel());
        Assertions.assertEquals(Duration.parse("PT193H41M36S"), model.start());
        Assertions.assertEquals(Duration.parse("PT205H48M20S"), model.end());
        Assertions.assertEquals(Duration.parse("PT38H59M39S"), model.fadeInDuration());
        Assertions.assertEquals(Duration.parse("PT83H32M15S"), model.fadeOutDuration());
        Assertions.assertEquals(15.81435793256083D, model.audioGainLevel());
        Assertions.assertEquals("zmegnitgvk", model.position().left());
        Assertions.assertEquals("zyqdrfegcealzx", model.position().top());
        Assertions.assertEquals("cansymoyqhlwigd", model.position().width());
        Assertions.assertEquals("bkbxgomfa", model.position().height());
        Assertions.assertEquals(67.37119600885748D, model.opacity());
        Assertions.assertEquals("vdaeyyguxakjsq", model.cropRectangle().left());
        Assertions.assertEquals("zbezkgimsidxasic", model.cropRectangle().top());
        Assertions.assertEquals("yvvjskgfmo", model.cropRectangle().width());
        Assertions.assertEquals("ah", model.cropRectangle().height());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        VideoOverlay model =
            new VideoOverlay()
                .withInputLabel("qgatjeaahhvjhhn")
                .withStart(Duration.parse("PT193H41M36S"))
                .withEnd(Duration.parse("PT205H48M20S"))
                .withFadeInDuration(Duration.parse("PT38H59M39S"))
                .withFadeOutDuration(Duration.parse("PT83H32M15S"))
                .withAudioGainLevel(15.81435793256083D)
                .withPosition(
                    new Rectangle()
                        .withLeft("zmegnitgvk")
                        .withTop("zyqdrfegcealzx")
                        .withWidth("cansymoyqhlwigd")
                        .withHeight("bkbxgomfa"))
                .withOpacity(67.37119600885748D)
                .withCropRectangle(
                    new Rectangle()
                        .withLeft("vdaeyyguxakjsq")
                        .withTop("zbezkgimsidxasic")
                        .withWidth("yvvjskgfmo")
                        .withHeight("ah"));
        model = BinaryData.fromObject(model).toObject(VideoOverlay.class);
        Assertions.assertEquals("qgatjeaahhvjhhn", model.inputLabel());
        Assertions.assertEquals(Duration.parse("PT193H41M36S"), model.start());
        Assertions.assertEquals(Duration.parse("PT205H48M20S"), model.end());
        Assertions.assertEquals(Duration.parse("PT38H59M39S"), model.fadeInDuration());
        Assertions.assertEquals(Duration.parse("PT83H32M15S"), model.fadeOutDuration());
        Assertions.assertEquals(15.81435793256083D, model.audioGainLevel());
        Assertions.assertEquals("zmegnitgvk", model.position().left());
        Assertions.assertEquals("zyqdrfegcealzx", model.position().top());
        Assertions.assertEquals("cansymoyqhlwigd", model.position().width());
        Assertions.assertEquals("bkbxgomfa", model.position().height());
        Assertions.assertEquals(67.37119600885748D, model.opacity());
        Assertions.assertEquals("vdaeyyguxakjsq", model.cropRectangle().left());
        Assertions.assertEquals("zbezkgimsidxasic", model.cropRectangle().top());
        Assertions.assertEquals("yvvjskgfmo", model.cropRectangle().width());
        Assertions.assertEquals("ah", model.cropRectangle().height());
    }
}
