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

public final class ContentKeyPolicyPlayReadyPlayRightTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ContentKeyPolicyPlayReadyPlayRight model =
            BinaryData
                .fromString(
                    "{\"firstPlayExpiration\":\"PT233H43M50S\",\"scmsRestriction\":1811866943,\"agcAndColorStripeRestriction\":616874585,\"explicitAnalogTelevisionOutputRestriction\":{\"bestEffort\":false,\"configurationData\":81583943},\"digitalVideoOnlyContentRestriction\":false,\"imageConstraintForAnalogComponentVideoRestriction\":false,\"imageConstraintForAnalogComputerMonitorRestriction\":true,\"allowPassingVideoContentToUnknownOutput\":\"Allowed\",\"uncompressedDigitalVideoOpl\":2098917747,\"compressedDigitalVideoOpl\":211422779,\"analogVideoOpl\":1426151715,\"compressedDigitalAudioOpl\":1010837093,\"uncompressedDigitalAudioOpl\":537781185}")
                .toObject(ContentKeyPolicyPlayReadyPlayRight.class);
        Assertions.assertEquals(Duration.parse("PT233H43M50S"), model.firstPlayExpiration());
        Assertions.assertEquals(1811866943, model.scmsRestriction());
        Assertions.assertEquals(616874585, model.agcAndColorStripeRestriction());
        Assertions.assertEquals(false, model.explicitAnalogTelevisionOutputRestriction().bestEffort());
        Assertions.assertEquals(81583943, model.explicitAnalogTelevisionOutputRestriction().configurationData());
        Assertions.assertEquals(false, model.digitalVideoOnlyContentRestriction());
        Assertions.assertEquals(false, model.imageConstraintForAnalogComponentVideoRestriction());
        Assertions.assertEquals(true, model.imageConstraintForAnalogComputerMonitorRestriction());
        Assertions
            .assertEquals(
                ContentKeyPolicyPlayReadyUnknownOutputPassingOption.ALLOWED,
                model.allowPassingVideoContentToUnknownOutput());
        Assertions.assertEquals(2098917747, model.uncompressedDigitalVideoOpl());
        Assertions.assertEquals(211422779, model.compressedDigitalVideoOpl());
        Assertions.assertEquals(1426151715, model.analogVideoOpl());
        Assertions.assertEquals(1010837093, model.compressedDigitalAudioOpl());
        Assertions.assertEquals(537781185, model.uncompressedDigitalAudioOpl());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ContentKeyPolicyPlayReadyPlayRight model =
            new ContentKeyPolicyPlayReadyPlayRight()
                .withFirstPlayExpiration(Duration.parse("PT233H43M50S"))
                .withScmsRestriction(1811866943)
                .withAgcAndColorStripeRestriction(616874585)
                .withExplicitAnalogTelevisionOutputRestriction(
                    new ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction()
                        .withBestEffort(false)
                        .withConfigurationData(81583943))
                .withDigitalVideoOnlyContentRestriction(false)
                .withImageConstraintForAnalogComponentVideoRestriction(false)
                .withImageConstraintForAnalogComputerMonitorRestriction(true)
                .withAllowPassingVideoContentToUnknownOutput(
                    ContentKeyPolicyPlayReadyUnknownOutputPassingOption.ALLOWED)
                .withUncompressedDigitalVideoOpl(2098917747)
                .withCompressedDigitalVideoOpl(211422779)
                .withAnalogVideoOpl(1426151715)
                .withCompressedDigitalAudioOpl(1010837093)
                .withUncompressedDigitalAudioOpl(537781185);
        model = BinaryData.fromObject(model).toObject(ContentKeyPolicyPlayReadyPlayRight.class);
        Assertions.assertEquals(Duration.parse("PT233H43M50S"), model.firstPlayExpiration());
        Assertions.assertEquals(1811866943, model.scmsRestriction());
        Assertions.assertEquals(616874585, model.agcAndColorStripeRestriction());
        Assertions.assertEquals(false, model.explicitAnalogTelevisionOutputRestriction().bestEffort());
        Assertions.assertEquals(81583943, model.explicitAnalogTelevisionOutputRestriction().configurationData());
        Assertions.assertEquals(false, model.digitalVideoOnlyContentRestriction());
        Assertions.assertEquals(false, model.imageConstraintForAnalogComponentVideoRestriction());
        Assertions.assertEquals(true, model.imageConstraintForAnalogComputerMonitorRestriction());
        Assertions
            .assertEquals(
                ContentKeyPolicyPlayReadyUnknownOutputPassingOption.ALLOWED,
                model.allowPassingVideoContentToUnknownOutput());
        Assertions.assertEquals(2098917747, model.uncompressedDigitalVideoOpl());
        Assertions.assertEquals(211422779, model.compressedDigitalVideoOpl());
        Assertions.assertEquals(1426151715, model.analogVideoOpl());
        Assertions.assertEquals(1010837093, model.compressedDigitalAudioOpl());
        Assertions.assertEquals(537781185, model.uncompressedDigitalAudioOpl());
    }
}
