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

package com.azure.resourcemanager.desktopvirtualization.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.desktopvirtualization.fluent.models.ScalingPlanPooledScheduleInner;
import com.azure.resourcemanager.desktopvirtualization.models.ScalingPlanPooledScheduleList;
import com.azure.resourcemanager.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm;
import com.azure.resourcemanager.desktopvirtualization.models.StopHostsWhen;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ScalingPlanPooledScheduleListTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ScalingPlanPooledScheduleList model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"daysOfWeek\":[],\"rampUpLoadBalancingAlgorithm\":\"BreadthFirst\",\"rampUpMinimumHostsPct\":989865410,\"rampUpCapacityThresholdPct\":1111271416,\"peakLoadBalancingAlgorithm\":\"DepthFirst\",\"rampDownLoadBalancingAlgorithm\":\"BreadthFirst\",\"rampDownMinimumHostsPct\":956878361,\"rampDownCapacityThresholdPct\":1391467998,\"rampDownForceLogoffUsers\":false,\"rampDownStopHostsWhen\":\"ZeroActiveSessions\",\"rampDownWaitTimeMinutes\":1493031892,\"rampDownNotificationMessage\":\"klyaxuconu\",\"offPeakLoadBalancingAlgorithm\":\"BreadthFirst\"},\"id\":\"kbeype\",\"name\":\"rmjmwvvjektc\",\"type\":\"senhwlrs\"},{\"properties\":{\"daysOfWeek\":[],\"rampUpLoadBalancingAlgorithm\":\"BreadthFirst\",\"rampUpMinimumHostsPct\":1396036166,\"rampUpCapacityThresholdPct\":1792150681,\"peakLoadBalancingAlgorithm\":\"DepthFirst\",\"rampDownLoadBalancingAlgorithm\":\"DepthFirst\",\"rampDownMinimumHostsPct\":878153378,\"rampDownCapacityThresholdPct\":946081931,\"rampDownForceLogoffUsers\":true,\"rampDownStopHostsWhen\":\"ZeroActiveSessions\",\"rampDownWaitTimeMinutes\":267259716,\"rampDownNotificationMessage\":\"fcivfsnkym\",\"offPeakLoadBalancingAlgorithm\":\"BreadthFirst\"},\"id\":\"hjfbebrjcxe\",\"name\":\"fuwutttxf\",\"type\":\"jrbirphxepcyv\"}],\"nextLink\":\"fnljky\"}")
                .toObject(ScalingPlanPooledScheduleList.class);
        Assertions
            .assertEquals(
                SessionHostLoadBalancingAlgorithm.BREADTH_FIRST, model.value().get(0).rampUpLoadBalancingAlgorithm());
        Assertions.assertEquals(989865410, model.value().get(0).rampUpMinimumHostsPct());
        Assertions.assertEquals(1111271416, model.value().get(0).rampUpCapacityThresholdPct());
        Assertions
            .assertEquals(
                SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.value().get(0).peakLoadBalancingAlgorithm());
        Assertions
            .assertEquals(
                SessionHostLoadBalancingAlgorithm.BREADTH_FIRST, model.value().get(0).rampDownLoadBalancingAlgorithm());
        Assertions.assertEquals(956878361, model.value().get(0).rampDownMinimumHostsPct());
        Assertions.assertEquals(1391467998, model.value().get(0).rampDownCapacityThresholdPct());
        Assertions.assertEquals(false, model.value().get(0).rampDownForceLogoffUsers());
        Assertions.assertEquals(StopHostsWhen.ZERO_ACTIVE_SESSIONS, model.value().get(0).rampDownStopHostsWhen());
        Assertions.assertEquals(1493031892, model.value().get(0).rampDownWaitTimeMinutes());
        Assertions.assertEquals("klyaxuconu", model.value().get(0).rampDownNotificationMessage());
        Assertions
            .assertEquals(
                SessionHostLoadBalancingAlgorithm.BREADTH_FIRST, model.value().get(0).offPeakLoadBalancingAlgorithm());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ScalingPlanPooledScheduleList model =
            new ScalingPlanPooledScheduleList()
                .withValue(
                    Arrays
                        .asList(
                            new ScalingPlanPooledScheduleInner()
                                .withDaysOfWeek(Arrays.asList())
                                .withRampUpLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.BREADTH_FIRST)
                                .withRampUpMinimumHostsPct(989865410)
                                .withRampUpCapacityThresholdPct(1111271416)
                                .withPeakLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST)
                                .withRampDownLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.BREADTH_FIRST)
                                .withRampDownMinimumHostsPct(956878361)
                                .withRampDownCapacityThresholdPct(1391467998)
                                .withRampDownForceLogoffUsers(false)
                                .withRampDownStopHostsWhen(StopHostsWhen.ZERO_ACTIVE_SESSIONS)
                                .withRampDownWaitTimeMinutes(1493031892)
                                .withRampDownNotificationMessage("klyaxuconu")
                                .withOffPeakLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.BREADTH_FIRST),
                            new ScalingPlanPooledScheduleInner()
                                .withDaysOfWeek(Arrays.asList())
                                .withRampUpLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.BREADTH_FIRST)
                                .withRampUpMinimumHostsPct(1396036166)
                                .withRampUpCapacityThresholdPct(1792150681)
                                .withPeakLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST)
                                .withRampDownLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST)
                                .withRampDownMinimumHostsPct(878153378)
                                .withRampDownCapacityThresholdPct(946081931)
                                .withRampDownForceLogoffUsers(true)
                                .withRampDownStopHostsWhen(StopHostsWhen.ZERO_ACTIVE_SESSIONS)
                                .withRampDownWaitTimeMinutes(267259716)
                                .withRampDownNotificationMessage("fcivfsnkym")
                                .withOffPeakLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.BREADTH_FIRST)));
        model = BinaryData.fromObject(model).toObject(ScalingPlanPooledScheduleList.class);
        Assertions
            .assertEquals(
                SessionHostLoadBalancingAlgorithm.BREADTH_FIRST, model.value().get(0).rampUpLoadBalancingAlgorithm());
        Assertions.assertEquals(989865410, model.value().get(0).rampUpMinimumHostsPct());
        Assertions.assertEquals(1111271416, model.value().get(0).rampUpCapacityThresholdPct());
        Assertions
            .assertEquals(
                SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.value().get(0).peakLoadBalancingAlgorithm());
        Assertions
            .assertEquals(
                SessionHostLoadBalancingAlgorithm.BREADTH_FIRST, model.value().get(0).rampDownLoadBalancingAlgorithm());
        Assertions.assertEquals(956878361, model.value().get(0).rampDownMinimumHostsPct());
        Assertions.assertEquals(1391467998, model.value().get(0).rampDownCapacityThresholdPct());
        Assertions.assertEquals(false, model.value().get(0).rampDownForceLogoffUsers());
        Assertions.assertEquals(StopHostsWhen.ZERO_ACTIVE_SESSIONS, model.value().get(0).rampDownStopHostsWhen());
        Assertions.assertEquals(1493031892, model.value().get(0).rampDownWaitTimeMinutes());
        Assertions.assertEquals("klyaxuconu", model.value().get(0).rampDownNotificationMessage());
        Assertions
            .assertEquals(
                SessionHostLoadBalancingAlgorithm.BREADTH_FIRST, model.value().get(0).offPeakLoadBalancingAlgorithm());
    }
}
