// 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.CbcsDrmConfiguration;
import com.azure.resourcemanager.mediaservices.models.StreamingPolicyFairPlayConfiguration;
import com.azure.resourcemanager.mediaservices.models.StreamingPolicyPlayReadyConfiguration;
import com.azure.resourcemanager.mediaservices.models.StreamingPolicyWidevineConfiguration;
import org.junit.jupiter.api.Assertions;

public final class CbcsDrmConfigurationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        CbcsDrmConfiguration model =
            BinaryData
                .fromString(
                    "{\"fairPlay\":{\"customLicenseAcquisitionUrlTemplate\":\"zpyqsemwab\",\"allowPersistentLicense\":false},\"playReady\":{\"customLicenseAcquisitionUrlTemplate\":\"hhszh\",\"playReadyCustomAttributes\":\"plvwiwubmwmbes\"},\"widevine\":{\"customLicenseAcquisitionUrlTemplate\":\"k\"}}")
                .toObject(CbcsDrmConfiguration.class);
        Assertions.assertEquals("zpyqsemwab", model.fairPlay().customLicenseAcquisitionUrlTemplate());
        Assertions.assertEquals(false, model.fairPlay().allowPersistentLicense());
        Assertions.assertEquals("hhszh", model.playReady().customLicenseAcquisitionUrlTemplate());
        Assertions.assertEquals("plvwiwubmwmbes", model.playReady().playReadyCustomAttributes());
        Assertions.assertEquals("k", model.widevine().customLicenseAcquisitionUrlTemplate());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        CbcsDrmConfiguration model =
            new CbcsDrmConfiguration()
                .withFairPlay(
                    new StreamingPolicyFairPlayConfiguration()
                        .withCustomLicenseAcquisitionUrlTemplate("zpyqsemwab")
                        .withAllowPersistentLicense(false))
                .withPlayReady(
                    new StreamingPolicyPlayReadyConfiguration()
                        .withCustomLicenseAcquisitionUrlTemplate("hhszh")
                        .withPlayReadyCustomAttributes("plvwiwubmwmbes"))
                .withWidevine(new StreamingPolicyWidevineConfiguration().withCustomLicenseAcquisitionUrlTemplate("k"));
        model = BinaryData.fromObject(model).toObject(CbcsDrmConfiguration.class);
        Assertions.assertEquals("zpyqsemwab", model.fairPlay().customLicenseAcquisitionUrlTemplate());
        Assertions.assertEquals(false, model.fairPlay().allowPersistentLicense());
        Assertions.assertEquals("hhszh", model.playReady().customLicenseAcquisitionUrlTemplate());
        Assertions.assertEquals("plvwiwubmwmbes", model.playReady().playReadyCustomAttributes());
        Assertions.assertEquals("k", model.widevine().customLicenseAcquisitionUrlTemplate());
    }
}
