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

public final class LiveOutputInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        LiveOutputInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"description\":\"mvpp\",\"assetName\":\"o\",\"archiveWindowLength\":\"PT26H6M38S\",\"rewindWindowLength\":\"PT39H37M46S\",\"manifestName\":\"dphqamv\",\"hls\":{\"fragmentsPerTsSegment\":1561885870},\"outputSnapTime\":7096751901031996251,\"created\":\"2021-02-02T13:52:10Z\",\"lastModified\":\"2021-07-20T08:38:57Z\",\"provisioningState\":\"kayh\",\"resourceState\":\"Creating\"},\"id\":\"yqiatkzwp\",\"name\":\"npwzcjaes\",\"type\":\"vvsccyajguq\"}")
                .toObject(LiveOutputInner.class);
        Assertions.assertEquals("mvpp", model.description());
        Assertions.assertEquals("o", model.assetName());
        Assertions.assertEquals(Duration.parse("PT26H6M38S"), model.archiveWindowLength());
        Assertions.assertEquals(Duration.parse("PT39H37M46S"), model.rewindWindowLength());
        Assertions.assertEquals("dphqamv", model.manifestName());
        Assertions.assertEquals(1561885870, model.hls().fragmentsPerTsSegment());
        Assertions.assertEquals(7096751901031996251L, model.outputSnapTime());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        LiveOutputInner model =
            new LiveOutputInner()
                .withDescription("mvpp")
                .withAssetName("o")
                .withArchiveWindowLength(Duration.parse("PT26H6M38S"))
                .withRewindWindowLength(Duration.parse("PT39H37M46S"))
                .withManifestName("dphqamv")
                .withHls(new Hls().withFragmentsPerTsSegment(1561885870))
                .withOutputSnapTime(7096751901031996251L);
        model = BinaryData.fromObject(model).toObject(LiveOutputInner.class);
        Assertions.assertEquals("mvpp", model.description());
        Assertions.assertEquals("o", model.assetName());
        Assertions.assertEquals(Duration.parse("PT26H6M38S"), model.archiveWindowLength());
        Assertions.assertEquals(Duration.parse("PT39H37M46S"), model.rewindWindowLength());
        Assertions.assertEquals("dphqamv", model.manifestName());
        Assertions.assertEquals(1561885870, model.hls().fragmentsPerTsSegment());
        Assertions.assertEquals(7096751901031996251L, model.outputSnapTime());
    }
}
