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

package com.azure.resourcemanager.appcontainers.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.appcontainers.models.DiagnosticDataProviderMetadata;
import com.azure.resourcemanager.appcontainers.models.DiagnosticDataProviderMetadataPropertyBagItem;
import com.azure.resourcemanager.appcontainers.models.DiagnosticDataTableResponseObject;
import com.azure.resourcemanager.appcontainers.models.DiagnosticRendering;
import com.azure.resourcemanager.appcontainers.models.DiagnosticSupportTopic;
import com.azure.resourcemanager.appcontainers.models.DiagnosticsDataApiResponse;
import com.azure.resourcemanager.appcontainers.models.DiagnosticsDefinition;
import com.azure.resourcemanager.appcontainers.models.DiagnosticsProperties;
import com.azure.resourcemanager.appcontainers.models.DiagnosticsStatus;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class DiagnosticsPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DiagnosticsProperties model =
            BinaryData
                .fromString(
                    "{\"metadata\":{\"id\":\"talmett\",\"name\":\"gdslqxihhrmoo\",\"description\":\"qseypxiutcxa\",\"author\":\"hyrpetogebjoxs\",\"category\":\"vnh\",\"supportTopicList\":[{\"id\":\"q\",\"pesId\":\"kzjcjbtrgae\"},{\"id\":\"vibr\",\"pesId\":\"jsto\"},{\"id\":\"eitpkxztmo\",\"pesId\":\"klf\"}],\"analysisTypes\":[\"gfcwqmpimaqxzhem\",\"yhohujswtwkozzwc\"],\"type\":\"kb\",\"score\":85.47861},\"dataset\":[{\"table\":{\"tableName\":\"jwltlwtjjgu\",\"columns\":[],\"rows\":[]},\"renderingProperties\":{\"type\":663696450,\"title\":\"vkcdmxzr\",\"description\":\"aimlnwiaaom\",\"isVisible\":false}},{\"table\":{\"tableName\":\"z\",\"columns\":[],\"rows\":[]},\"renderingProperties\":{\"type\":1226042956,\"title\":\"wwnpj\",\"description\":\"fz\",\"isVisible\":false}},{\"table\":{\"tableName\":\"wahfbousnfepgfew\",\"columns\":[],\"rows\":[]},\"renderingProperties\":{\"type\":1791330628,\"title\":\"ncxykxhdjhlimm\",\"description\":\"x\",\"isVisible\":true}}],\"status\":{\"message\":\"orxvxcjzhqiz\",\"statusId\":444626662},\"dataProviderMetadata\":{\"providerName\":\"gqscj\",\"propertyBag\":[{\"name\":\"juhdqazkmtgguwpi\",\"value\":\"ajc\"},{\"name\":\"m\",\"value\":\"hfcf\"}]}}")
                .toObject(DiagnosticsProperties.class);
        Assertions.assertEquals("gfcwqmpimaqxzhem", model.metadata().analysisTypes().get(0));
        Assertions.assertEquals("jwltlwtjjgu", model.dataset().get(0).table().tableName());
        Assertions.assertEquals(663696450, model.dataset().get(0).renderingProperties().type());
        Assertions.assertEquals("vkcdmxzr", model.dataset().get(0).renderingProperties().title());
        Assertions.assertEquals("aimlnwiaaom", model.dataset().get(0).renderingProperties().description());
        Assertions.assertEquals(false, model.dataset().get(0).renderingProperties().isVisible());
        Assertions.assertEquals("orxvxcjzhqiz", model.status().message());
        Assertions.assertEquals(444626662, model.status().statusId());
        Assertions.assertEquals("gqscj", model.dataProviderMetadata().providerName());
        Assertions.assertEquals("juhdqazkmtgguwpi", model.dataProviderMetadata().propertyBag().get(0).name());
        Assertions.assertEquals("ajc", model.dataProviderMetadata().propertyBag().get(0).value());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DiagnosticsProperties model =
            new DiagnosticsProperties()
                .withMetadata(
                    new DiagnosticsDefinition()
                        .withSupportTopicList(
                            Arrays
                                .asList(
                                    new DiagnosticSupportTopic(),
                                    new DiagnosticSupportTopic(),
                                    new DiagnosticSupportTopic()))
                        .withAnalysisTypes(Arrays.asList("gfcwqmpimaqxzhem", "yhohujswtwkozzwc")))
                .withDataset(
                    Arrays
                        .asList(
                            new DiagnosticsDataApiResponse()
                                .withTable(
                                    new DiagnosticDataTableResponseObject()
                                        .withTableName("jwltlwtjjgu")
                                        .withColumns(Arrays.asList())
                                        .withRows(Arrays.asList()))
                                .withRenderingProperties(
                                    new DiagnosticRendering()
                                        .withType(663696450)
                                        .withTitle("vkcdmxzr")
                                        .withDescription("aimlnwiaaom")
                                        .withIsVisible(false)),
                            new DiagnosticsDataApiResponse()
                                .withTable(
                                    new DiagnosticDataTableResponseObject()
                                        .withTableName("z")
                                        .withColumns(Arrays.asList())
                                        .withRows(Arrays.asList()))
                                .withRenderingProperties(
                                    new DiagnosticRendering()
                                        .withType(1226042956)
                                        .withTitle("wwnpj")
                                        .withDescription("fz")
                                        .withIsVisible(false)),
                            new DiagnosticsDataApiResponse()
                                .withTable(
                                    new DiagnosticDataTableResponseObject()
                                        .withTableName("wahfbousnfepgfew")
                                        .withColumns(Arrays.asList())
                                        .withRows(Arrays.asList()))
                                .withRenderingProperties(
                                    new DiagnosticRendering()
                                        .withType(1791330628)
                                        .withTitle("ncxykxhdjhlimm")
                                        .withDescription("x")
                                        .withIsVisible(true))))
                .withStatus(new DiagnosticsStatus().withMessage("orxvxcjzhqiz").withStatusId(444626662))
                .withDataProviderMetadata(
                    new DiagnosticDataProviderMetadata()
                        .withProviderName("gqscj")
                        .withPropertyBag(
                            Arrays
                                .asList(
                                    new DiagnosticDataProviderMetadataPropertyBagItem()
                                        .withName("juhdqazkmtgguwpi")
                                        .withValue("ajc"),
                                    new DiagnosticDataProviderMetadataPropertyBagItem()
                                        .withName("m")
                                        .withValue("hfcf"))));
        model = BinaryData.fromObject(model).toObject(DiagnosticsProperties.class);
        Assertions.assertEquals("gfcwqmpimaqxzhem", model.metadata().analysisTypes().get(0));
        Assertions.assertEquals("jwltlwtjjgu", model.dataset().get(0).table().tableName());
        Assertions.assertEquals(663696450, model.dataset().get(0).renderingProperties().type());
        Assertions.assertEquals("vkcdmxzr", model.dataset().get(0).renderingProperties().title());
        Assertions.assertEquals("aimlnwiaaom", model.dataset().get(0).renderingProperties().description());
        Assertions.assertEquals(false, model.dataset().get(0).renderingProperties().isVisible());
        Assertions.assertEquals("orxvxcjzhqiz", model.status().message());
        Assertions.assertEquals(444626662, model.status().statusId());
        Assertions.assertEquals("gqscj", model.dataProviderMetadata().providerName());
        Assertions.assertEquals("juhdqazkmtgguwpi", model.dataProviderMetadata().propertyBag().get(0).name());
        Assertions.assertEquals("ajc", model.dataProviderMetadata().propertyBag().get(0).value());
    }
}
