// 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.TransformInner;
import com.azure.resourcemanager.mediaservices.models.OnErrorType;
import com.azure.resourcemanager.mediaservices.models.Priority;
import com.azure.resourcemanager.mediaservices.models.TransformOutput;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class TransformInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        TransformInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"created\":\"2020-12-27T06:38:54Z\",\"description\":\"mkh\",\"lastModified\":\"2021-08-19T13:39:55Z\",\"outputs\":[{\"onError\":\"ContinueJob\",\"relativePriority\":\"Low\"},{\"onError\":\"ContinueJob\",\"relativePriority\":\"Normal\"},{\"onError\":\"ContinueJob\",\"relativePriority\":\"Normal\"}]},\"id\":\"bpbewtghfgb\",\"name\":\"c\",\"type\":\"wxzvlvqhjkb\"}")
                .toObject(TransformInner.class);
        Assertions.assertEquals("mkh", model.description());
        Assertions.assertEquals(OnErrorType.CONTINUE_JOB, model.outputs().get(0).onError());
        Assertions.assertEquals(Priority.LOW, model.outputs().get(0).relativePriority());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        TransformInner model =
            new TransformInner()
                .withDescription("mkh")
                .withOutputs(
                    Arrays
                        .asList(
                            new TransformOutput()
                                .withOnError(OnErrorType.CONTINUE_JOB)
                                .withRelativePriority(Priority.LOW),
                            new TransformOutput()
                                .withOnError(OnErrorType.CONTINUE_JOB)
                                .withRelativePriority(Priority.NORMAL),
                            new TransformOutput()
                                .withOnError(OnErrorType.CONTINUE_JOB)
                                .withRelativePriority(Priority.NORMAL)));
        model = BinaryData.fromObject(model).toObject(TransformInner.class);
        Assertions.assertEquals("mkh", model.description());
        Assertions.assertEquals(OnErrorType.CONTINUE_JOB, model.outputs().get(0).onError());
        Assertions.assertEquals(Priority.LOW, model.outputs().get(0).relativePriority());
    }
}
