// 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.UpdateIoTSecuritySolutionProperties;
import com.azure.resourcemanager.security.models.RecommendationConfigStatus;
import com.azure.resourcemanager.security.models.RecommendationConfigurationProperties;
import com.azure.resourcemanager.security.models.RecommendationType;
import com.azure.resourcemanager.security.models.UserDefinedResourcesProperties;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class UpdateIoTSecuritySolutionPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        UpdateIoTSecuritySolutionProperties model =
            BinaryData
                .fromString(
                    "{\"userDefinedResources\":{\"query\":\"xdbabphlwr\",\"querySubscriptions\":[\"fkts\",\"hsucoc\"]},\"recommendationsConfiguration\":[{\"recommendationType\":\"IoT_PrivilegedDockerOptions\",\"name\":\"zt\",\"status\":\"Disabled\"},{\"recommendationType\":\"IoT_InconsistentModuleSettings\",\"name\":\"wrqpue\",\"status\":\"Enabled\"}]}")
                .toObject(UpdateIoTSecuritySolutionProperties.class);
        Assertions.assertEquals("xdbabphlwr", model.userDefinedResources().query());
        Assertions.assertEquals("fkts", model.userDefinedResources().querySubscriptions().get(0));
        Assertions
            .assertEquals(
                RecommendationType.IO_T_PRIVILEGED_DOCKER_OPTIONS,
                model.recommendationsConfiguration().get(0).recommendationType());
        Assertions
            .assertEquals(RecommendationConfigStatus.DISABLED, model.recommendationsConfiguration().get(0).status());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        UpdateIoTSecuritySolutionProperties model =
            new UpdateIoTSecuritySolutionProperties()
                .withUserDefinedResources(
                    new UserDefinedResourcesProperties()
                        .withQuery("xdbabphlwr")
                        .withQuerySubscriptions(Arrays.asList("fkts", "hsucoc")))
                .withRecommendationsConfiguration(
                    Arrays
                        .asList(
                            new RecommendationConfigurationProperties()
                                .withRecommendationType(RecommendationType.IO_T_PRIVILEGED_DOCKER_OPTIONS)
                                .withStatus(RecommendationConfigStatus.DISABLED),
                            new RecommendationConfigurationProperties()
                                .withRecommendationType(RecommendationType.IO_T_INCONSISTENT_MODULE_SETTINGS)
                                .withStatus(RecommendationConfigStatus.ENABLED)));
        model = BinaryData.fromObject(model).toObject(UpdateIoTSecuritySolutionProperties.class);
        Assertions.assertEquals("xdbabphlwr", model.userDefinedResources().query());
        Assertions.assertEquals("fkts", model.userDefinedResources().querySubscriptions().get(0));
        Assertions
            .assertEquals(
                RecommendationType.IO_T_PRIVILEGED_DOCKER_OPTIONS,
                model.recommendationsConfiguration().get(0).recommendationType());
        Assertions
            .assertEquals(RecommendationConfigStatus.DISABLED, model.recommendationsConfiguration().get(0).status());
    }
}
