// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.dataprotection.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.dataprotection.models.BackupCriteria;
import com.azure.resourcemanager.dataprotection.models.RetentionTag;
import com.azure.resourcemanager.dataprotection.models.TaggingCriteria;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class TaggingCriteriaTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        TaggingCriteria model =
            BinaryData
                .fromString(
                    "{\"criteria\":[{\"objectType\":\"BackupCriteria\"},{\"objectType\":\"BackupCriteria\"},{\"objectType\":\"BackupCriteria\"},{\"objectType\":\"BackupCriteria\"}],\"isDefault\":true,\"taggingPriority\":1690476720955095356,\"tagInfo\":{\"eTag\":\"vhixbjxy\",\"id\":\"n\",\"tagName\":\"lrcoolsttpki\"}}")
                .toObject(TaggingCriteria.class);
        Assertions.assertEquals(true, model.isDefault());
        Assertions.assertEquals(1690476720955095356L, model.taggingPriority());
        Assertions.assertEquals("lrcoolsttpki", model.tagInfo().tagName());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        TaggingCriteria model =
            new TaggingCriteria()
                .withCriteria(
                    Arrays
                        .asList(new BackupCriteria(), new BackupCriteria(), new BackupCriteria(), new BackupCriteria()))
                .withIsDefault(true)
                .withTaggingPriority(1690476720955095356L)
                .withTagInfo(new RetentionTag().withTagName("lrcoolsttpki"));
        model = BinaryData.fromObject(model).toObject(TaggingCriteria.class);
        Assertions.assertEquals(true, model.isDefault());
        Assertions.assertEquals(1690476720955095356L, model.taggingPriority());
        Assertions.assertEquals("lrcoolsttpki", model.tagInfo().tagName());
    }
}
