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

package com.azure.resourcemanager.workloads.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.workloads.fluent.models.SapLandscapeMonitorProperties;
import com.azure.resourcemanager.workloads.models.SapLandscapeMonitorMetricThresholds;
import com.azure.resourcemanager.workloads.models.SapLandscapeMonitorPropertiesGrouping;
import com.azure.resourcemanager.workloads.models.SapLandscapeMonitorSidMapping;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class SapLandscapeMonitorPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SapLandscapeMonitorProperties model =
            BinaryData
                .fromString(
                    "{\"provisioningState\":\"Accepted\",\"grouping\":{\"landscape\":[{\"name\":\"dyhtozfikdowwquu\",\"topSid\":[]}],\"sapApplication\":[{\"name\":\"lvithhqzonosgg\",\"topSid\":[]},{\"name\":\"ohfwds\",\"topSid\":[]}]},\"topMetricsThresholds\":[{\"name\":\"jutiiswacff\",\"green\":6.1475635,\"yellow\":20.9651,\"red\":76.94174},{\"name\":\"fvhqc\",\"green\":81.842606,\"yellow\":27.79339,\"red\":1.6355693},{\"name\":\"pfuflrw\",\"green\":90.98357,\"yellow\":28.890497,\"red\":79.59478}]}")
                .toObject(SapLandscapeMonitorProperties.class);
        Assertions.assertEquals("dyhtozfikdowwquu", model.grouping().landscape().get(0).name());
        Assertions.assertEquals("lvithhqzonosgg", model.grouping().sapApplication().get(0).name());
        Assertions.assertEquals("jutiiswacff", model.topMetricsThresholds().get(0).name());
        Assertions.assertEquals(6.1475635F, model.topMetricsThresholds().get(0).green());
        Assertions.assertEquals(20.9651F, model.topMetricsThresholds().get(0).yellow());
        Assertions.assertEquals(76.94174F, model.topMetricsThresholds().get(0).red());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SapLandscapeMonitorProperties model =
            new SapLandscapeMonitorProperties()
                .withGrouping(
                    new SapLandscapeMonitorPropertiesGrouping()
                        .withLandscape(
                            Arrays
                                .asList(
                                    new SapLandscapeMonitorSidMapping()
                                        .withName("dyhtozfikdowwquu")
                                        .withTopSid(Arrays.asList())))
                        .withSapApplication(
                            Arrays
                                .asList(
                                    new SapLandscapeMonitorSidMapping()
                                        .withName("lvithhqzonosgg")
                                        .withTopSid(Arrays.asList()),
                                    new SapLandscapeMonitorSidMapping()
                                        .withName("ohfwds")
                                        .withTopSid(Arrays.asList()))))
                .withTopMetricsThresholds(
                    Arrays
                        .asList(
                            new SapLandscapeMonitorMetricThresholds()
                                .withName("jutiiswacff")
                                .withGreen(6.1475635F)
                                .withYellow(20.9651F)
                                .withRed(76.94174F),
                            new SapLandscapeMonitorMetricThresholds()
                                .withName("fvhqc")
                                .withGreen(81.842606F)
                                .withYellow(27.79339F)
                                .withRed(1.6355693F),
                            new SapLandscapeMonitorMetricThresholds()
                                .withName("pfuflrw")
                                .withGreen(90.98357F)
                                .withYellow(28.890497F)
                                .withRed(79.59478F)));
        model = BinaryData.fromObject(model).toObject(SapLandscapeMonitorProperties.class);
        Assertions.assertEquals("dyhtozfikdowwquu", model.grouping().landscape().get(0).name());
        Assertions.assertEquals("lvithhqzonosgg", model.grouping().sapApplication().get(0).name());
        Assertions.assertEquals("jutiiswacff", model.topMetricsThresholds().get(0).name());
        Assertions.assertEquals(6.1475635F, model.topMetricsThresholds().get(0).green());
        Assertions.assertEquals(20.9651F, model.topMetricsThresholds().get(0).yellow());
        Assertions.assertEquals(76.94174F, model.topMetricsThresholds().get(0).red());
    }
}
