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

package com.azure.resourcemanager.logz.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.logz.models.FilteringTag;
import com.azure.resourcemanager.logz.models.LogRules;
import com.azure.resourcemanager.logz.models.TagAction;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class LogRulesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        LogRules model =
            BinaryData
                .fromString(
                    "{\"sendAadLogs\":false,\"sendSubscriptionLogs\":false,\"sendActivityLogs\":false,\"filteringTags\":[{\"name\":\"ajrmvdjwzrlovmc\",\"value\":\"hijco\",\"action\":\"Include\"},{\"name\":\"bzaqsqsycbkbfk\",\"value\":\"kdkexxp\",\"action\":\"Include\"},{\"name\":\"xaxcfjpgddtocjjx\",\"value\":\"pmouexhdz\",\"action\":\"Include\"},{\"name\":\"eojnxqbzvddn\",\"value\":\"ndei\",\"action\":\"Exclude\"}]}")
                .toObject(LogRules.class);
        Assertions.assertEquals(false, model.sendAadLogs());
        Assertions.assertEquals(false, model.sendSubscriptionLogs());
        Assertions.assertEquals(false, model.sendActivityLogs());
        Assertions.assertEquals("ajrmvdjwzrlovmc", model.filteringTags().get(0).name());
        Assertions.assertEquals("hijco", model.filteringTags().get(0).value());
        Assertions.assertEquals(TagAction.INCLUDE, model.filteringTags().get(0).action());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        LogRules model =
            new LogRules()
                .withSendAadLogs(false)
                .withSendSubscriptionLogs(false)
                .withSendActivityLogs(false)
                .withFilteringTags(
                    Arrays
                        .asList(
                            new FilteringTag()
                                .withName("ajrmvdjwzrlovmc")
                                .withValue("hijco")
                                .withAction(TagAction.INCLUDE),
                            new FilteringTag()
                                .withName("bzaqsqsycbkbfk")
                                .withValue("kdkexxp")
                                .withAction(TagAction.INCLUDE),
                            new FilteringTag()
                                .withName("xaxcfjpgddtocjjx")
                                .withValue("pmouexhdz")
                                .withAction(TagAction.INCLUDE),
                            new FilteringTag()
                                .withName("eojnxqbzvddn")
                                .withValue("ndei")
                                .withAction(TagAction.EXCLUDE)));
        model = BinaryData.fromObject(model).toObject(LogRules.class);
        Assertions.assertEquals(false, model.sendAadLogs());
        Assertions.assertEquals(false, model.sendSubscriptionLogs());
        Assertions.assertEquals(false, model.sendActivityLogs());
        Assertions.assertEquals("ajrmvdjwzrlovmc", model.filteringTags().get(0).name());
        Assertions.assertEquals("hijco", model.filteringTags().get(0).value());
        Assertions.assertEquals(TagAction.INCLUDE, model.filteringTags().get(0).action());
    }
}
