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

package com.azure.resourcemanager.policyinsights.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.policyinsights.fluent.models.SummarizeResultsInner;
import com.azure.resourcemanager.policyinsights.models.Summary;
import com.azure.resourcemanager.policyinsights.models.SummaryResults;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class SummarizeResultsInnerTests {
    @Test
    public void testDeserialize() {
        SummarizeResultsInner model =
            BinaryData
                .fromString(
                    "{\"@odata.context\":\"xobbcswsrt\",\"@odata.count\":1836763667,\"value\":[{\"@odata.id\":\"bpbewtghfgb\",\"@odata.context\":\"gw\",\"results\":{\"queryResultsUri\":\"lvqhjkbegibtnmx\",\"nonCompliantResources\":1742737473,\"nonCompliantPolicies\":695269764,\"resourceDetails\":[],\"policyDetails\":[],\"policyGroupDetails\":[]},\"policyAssignments\":[]},{\"@odata.id\":\"cgwrtzjuz\",\"@odata.context\":\"yzm\",\"results\":{\"queryResultsUri\":\"ongmtsa\",\"nonCompliantResources\":1151721891,\"nonCompliantPolicies\":1264115895,\"resourceDetails\":[],\"policyDetails\":[],\"policyGroupDetails\":[]},\"policyAssignments\":[]},{\"@odata.id\":\"knftguvriuh\",\"@odata.context\":\"wmdyvxqtay\",\"results\":{\"queryResultsUri\":\"wroyqbexrmcq\",\"nonCompliantResources\":1430552166,\"nonCompliantPolicies\":865624949,\"resourceDetails\":[],\"policyDetails\":[],\"policyGroupDetails\":[]},\"policyAssignments\":[]},{\"@odata.id\":\"e\",\"@odata.context\":\"sgzvahapjyzhpv\",\"results\":{\"queryResultsUri\":\"cjrvxdjzlmwlxkv\",\"nonCompliantResources\":2069794521,\"nonCompliantPolicies\":2083539395,\"resourceDetails\":[],\"policyDetails\":[],\"policyGroupDetails\":[]},\"policyAssignments\":[]}]}")
                .toObject(SummarizeResultsInner.class);
        Assertions.assertEquals("lvqhjkbegibtnmx", model.value().get(0).results().queryResultsUri());
        Assertions.assertEquals(1742737473, model.value().get(0).results().nonCompliantResources());
        Assertions.assertEquals(695269764, model.value().get(0).results().nonCompliantPolicies());
    }

    @Test
    public void testSerialize() {
        SummarizeResultsInner model =
            new SummarizeResultsInner()
                .withValue(
                    Arrays
                        .asList(
                            new Summary()
                                .withResults(
                                    new SummaryResults()
                                        .withQueryResultsUri("lvqhjkbegibtnmx")
                                        .withNonCompliantResources(1742737473)
                                        .withNonCompliantPolicies(695269764)
                                        .withResourceDetails(Arrays.asList())
                                        .withPolicyDetails(Arrays.asList())
                                        .withPolicyGroupDetails(Arrays.asList()))
                                .withPolicyAssignments(Arrays.asList()),
                            new Summary()
                                .withResults(
                                    new SummaryResults()
                                        .withQueryResultsUri("ongmtsa")
                                        .withNonCompliantResources(1151721891)
                                        .withNonCompliantPolicies(1264115895)
                                        .withResourceDetails(Arrays.asList())
                                        .withPolicyDetails(Arrays.asList())
                                        .withPolicyGroupDetails(Arrays.asList()))
                                .withPolicyAssignments(Arrays.asList()),
                            new Summary()
                                .withResults(
                                    new SummaryResults()
                                        .withQueryResultsUri("wroyqbexrmcq")
                                        .withNonCompliantResources(1430552166)
                                        .withNonCompliantPolicies(865624949)
                                        .withResourceDetails(Arrays.asList())
                                        .withPolicyDetails(Arrays.asList())
                                        .withPolicyGroupDetails(Arrays.asList()))
                                .withPolicyAssignments(Arrays.asList()),
                            new Summary()
                                .withResults(
                                    new SummaryResults()
                                        .withQueryResultsUri("cjrvxdjzlmwlxkv")
                                        .withNonCompliantResources(2069794521)
                                        .withNonCompliantPolicies(2083539395)
                                        .withResourceDetails(Arrays.asList())
                                        .withPolicyDetails(Arrays.asList())
                                        .withPolicyGroupDetails(Arrays.asList()))
                                .withPolicyAssignments(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(SummarizeResultsInner.class);
        Assertions.assertEquals("lvqhjkbegibtnmx", model.value().get(0).results().queryResultsUri());
        Assertions.assertEquals(1742737473, model.value().get(0).results().nonCompliantResources());
        Assertions.assertEquals(695269764, model.value().get(0).results().nonCompliantPolicies());
    }
}
