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

package com.azure.resourcemanager.security.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionAnalyticsModelProperties;
import com.azure.resourcemanager.security.models.IoTSecurityAlertedDevice;
import com.azure.resourcemanager.security.models.IoTSecurityDeviceAlert;
import com.azure.resourcemanager.security.models.IoTSecurityDeviceRecommendation;
import java.util.Arrays;

public final class IoTSecuritySolutionAnalyticsModelPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        IoTSecuritySolutionAnalyticsModelProperties model =
            BinaryData
                .fromString(
                    "{\"metrics\":{\"high\":2202893815567667311,\"medium\":5776325152256074523,\"low\":2732685754264877829},\"unhealthyDeviceCount\":3928242933963476014,\"devicesMetrics\":[{\"date\":\"2021-03-07T15:05:13Z\",\"devicesMetrics\":{\"high\":319665118186558655,\"medium\":3857673152007757003,\"low\":2825151831912713640}},{\"date\":\"2021-06-24T08:22:45Z\",\"devicesMetrics\":{\"high\":2116320352279967667,\"medium\":962291776216015099,\"low\":6718667665096544770}},{\"date\":\"2021-09-22T11:52:27Z\",\"devicesMetrics\":{\"high\":2840285264321299730,\"medium\":6255558235157330938,\"low\":3221959502351885450}},{\"date\":\"2021-10-09T14:43:40Z\",\"devicesMetrics\":{\"high\":4392160629829565824,\"medium\":1781523879629973808,\"low\":3301208873451353508}}],\"topAlertedDevices\":[{\"deviceId\":\"zq\",\"alertsCount\":8605356393131124323},{\"deviceId\":\"pmueefjzwfqk\",\"alertsCount\":7502146387336972702},{\"deviceId\":\"suyonobglaocq\",\"alertsCount\":2903733515306491145},{\"deviceId\":\"g\",\"alertsCount\":4531156159452032810}],\"mostPrevalentDeviceAlerts\":[{\"alertDisplayName\":\"moyrxvwfudwpz\",\"reportedSeverity\":\"High\",\"alertsCount\":6087131419458323367},{\"alertDisplayName\":\"lrqjbhckfr\",\"reportedSeverity\":\"Low\",\"alertsCount\":6356911616351908297}],\"mostPrevalentDeviceRecommendations\":[{\"recommendationDisplayName\":\"pycanuzbpz\",\"reportedSeverity\":\"High\",\"devicesCount\":3708510664132188472},{\"recommendationDisplayName\":\"crnwbmeh\",\"reportedSeverity\":\"High\",\"devicesCount\":455506710783591694},{\"recommendationDisplayName\":\"srtslhspkdeem\",\"reportedSeverity\":\"Informational\",\"devicesCount\":5804956821269941754},{\"recommendationDisplayName\":\"kv\",\"reportedSeverity\":\"Low\",\"devicesCount\":8799257187575805529}]}")
                .toObject(IoTSecuritySolutionAnalyticsModelProperties.class);
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        IoTSecuritySolutionAnalyticsModelProperties model =
            new IoTSecuritySolutionAnalyticsModelProperties()
                .withTopAlertedDevices(
                    Arrays
                        .asList(
                            new IoTSecurityAlertedDevice(),
                            new IoTSecurityAlertedDevice(),
                            new IoTSecurityAlertedDevice(),
                            new IoTSecurityAlertedDevice()))
                .withMostPrevalentDeviceAlerts(
                    Arrays.asList(new IoTSecurityDeviceAlert(), new IoTSecurityDeviceAlert()))
                .withMostPrevalentDeviceRecommendations(
                    Arrays
                        .asList(
                            new IoTSecurityDeviceRecommendation(),
                            new IoTSecurityDeviceRecommendation(),
                            new IoTSecurityDeviceRecommendation(),
                            new IoTSecurityDeviceRecommendation()));
        model = BinaryData.fromObject(model).toObject(IoTSecuritySolutionAnalyticsModelProperties.class);
    }
}
