// 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.ScalingPlanPatchProperties;
import com.azure.resourcemanager.desktopvirtualization.models.ScalingHostPoolReference;
import com.azure.resourcemanager.desktopvirtualization.models.ScalingSchedule;
import com.azure.resourcemanager.desktopvirtualization.models.ScalingScheduleDaysOfWeekItem;
import com.azure.resourcemanager.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm;
import com.azure.resourcemanager.desktopvirtualization.models.StopHostsWhen;
import com.azure.resourcemanager.desktopvirtualization.models.Time;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ScalingPlanPatchPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ScalingPlanPatchProperties model =
            BinaryData
                .fromString(
                    "{\"description\":\"sfcpkvxodpuozm\",\"friendlyName\":\"ydagfuaxbe\",\"timeZone\":\"iu\",\"exclusionTag\":\"ktwh\",\"schedules\":[{\"name\":\"zywqsmbsu\",\"daysOfWeek\":[\"Saturday\"],\"rampUpStartTime\":{\"hour\":26085617,\"minute\":1115871957},\"rampUpLoadBalancingAlgorithm\":\"BreadthFirst\",\"rampUpMinimumHostsPct\":994913433,\"rampUpCapacityThresholdPct\":908271116,\"peakStartTime\":{\"hour\":57544677,\"minute\":1510965337},\"peakLoadBalancingAlgorithm\":\"DepthFirst\",\"rampDownStartTime\":{\"hour\":376493890,\"minute\":830050857},\"rampDownLoadBalancingAlgorithm\":\"DepthFirst\",\"rampDownMinimumHostsPct\":980316888,\"rampDownCapacityThresholdPct\":1173289641,\"rampDownForceLogoffUsers\":false,\"rampDownStopHostsWhen\":\"ZeroSessions\",\"rampDownWaitTimeMinutes\":1867202070,\"rampDownNotificationMessage\":\"rrqnbpoczvyifqrv\",\"offPeakStartTime\":{\"hour\":983918139,\"minute\":1867018963},\"offPeakLoadBalancingAlgorithm\":\"BreadthFirst\"}],\"hostPoolReferences\":[{\"hostPoolArmPath\":\"vvdfwatkpnpul\",\"scalingPlanEnabled\":true}]}")
                .toObject(ScalingPlanPatchProperties.class);
        Assertions.assertEquals("sfcpkvxodpuozm", model.description());
        Assertions.assertEquals("ydagfuaxbe", model.friendlyName());
        Assertions.assertEquals("iu", model.timeZone());
        Assertions.assertEquals("ktwh", model.exclusionTag());
        Assertions.assertEquals("zywqsmbsu", model.schedules().get(0).name());
        Assertions.assertEquals(ScalingScheduleDaysOfWeekItem.SATURDAY, model.schedules().get(0).daysOfWeek().get(0));
        Assertions.assertEquals(26085617, model.schedules().get(0).rampUpStartTime().hour());
        Assertions.assertEquals(1115871957, model.schedules().get(0).rampUpStartTime().minute());
        Assertions
            .assertEquals(
                SessionHostLoadBalancingAlgorithm.BREADTH_FIRST,
                model.schedules().get(0).rampUpLoadBalancingAlgorithm());
        Assertions.assertEquals(994913433, model.schedules().get(0).rampUpMinimumHostsPct());
        Assertions.assertEquals(908271116, model.schedules().get(0).rampUpCapacityThresholdPct());
        Assertions.assertEquals(57544677, model.schedules().get(0).peakStartTime().hour());
        Assertions.assertEquals(1510965337, model.schedules().get(0).peakStartTime().minute());
        Assertions
            .assertEquals(
                SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.schedules().get(0).peakLoadBalancingAlgorithm());
        Assertions.assertEquals(376493890, model.schedules().get(0).rampDownStartTime().hour());
        Assertions.assertEquals(830050857, model.schedules().get(0).rampDownStartTime().minute());
        Assertions
            .assertEquals(
                SessionHostLoadBalancingAlgorithm.DEPTH_FIRST,
                model.schedules().get(0).rampDownLoadBalancingAlgorithm());
        Assertions.assertEquals(980316888, model.schedules().get(0).rampDownMinimumHostsPct());
        Assertions.assertEquals(1173289641, model.schedules().get(0).rampDownCapacityThresholdPct());
        Assertions.assertEquals(false, model.schedules().get(0).rampDownForceLogoffUsers());
        Assertions.assertEquals(StopHostsWhen.ZERO_SESSIONS, model.schedules().get(0).rampDownStopHostsWhen());
        Assertions.assertEquals(1867202070, model.schedules().get(0).rampDownWaitTimeMinutes());
        Assertions.assertEquals("rrqnbpoczvyifqrv", model.schedules().get(0).rampDownNotificationMessage());
        Assertions.assertEquals(983918139, model.schedules().get(0).offPeakStartTime().hour());
        Assertions.assertEquals(1867018963, model.schedules().get(0).offPeakStartTime().minute());
        Assertions
            .assertEquals(
                SessionHostLoadBalancingAlgorithm.BREADTH_FIRST,
                model.schedules().get(0).offPeakLoadBalancingAlgorithm());
        Assertions.assertEquals("vvdfwatkpnpul", model.hostPoolReferences().get(0).hostPoolArmPath());
        Assertions.assertEquals(true, model.hostPoolReferences().get(0).scalingPlanEnabled());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ScalingPlanPatchProperties model =
            new ScalingPlanPatchProperties()
                .withDescription("sfcpkvxodpuozm")
                .withFriendlyName("ydagfuaxbe")
                .withTimeZone("iu")
                .withExclusionTag("ktwh")
                .withSchedules(
                    Arrays
                        .asList(
                            new ScalingSchedule()
                                .withName("zywqsmbsu")
                                .withDaysOfWeek(Arrays.asList(ScalingScheduleDaysOfWeekItem.SATURDAY))
                                .withRampUpStartTime(new Time().withHour(26085617).withMinute(1115871957))
                                .withRampUpLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.BREADTH_FIRST)
                                .withRampUpMinimumHostsPct(994913433)
                                .withRampUpCapacityThresholdPct(908271116)
                                .withPeakStartTime(new Time().withHour(57544677).withMinute(1510965337))
                                .withPeakLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST)
                                .withRampDownStartTime(new Time().withHour(376493890).withMinute(830050857))
                                .withRampDownLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST)
                                .withRampDownMinimumHostsPct(980316888)
                                .withRampDownCapacityThresholdPct(1173289641)
                                .withRampDownForceLogoffUsers(false)
                                .withRampDownStopHostsWhen(StopHostsWhen.ZERO_SESSIONS)
                                .withRampDownWaitTimeMinutes(1867202070)
                                .withRampDownNotificationMessage("rrqnbpoczvyifqrv")
                                .withOffPeakStartTime(new Time().withHour(983918139).withMinute(1867018963))
                                .withOffPeakLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.BREADTH_FIRST)))
                .withHostPoolReferences(
                    Arrays
                        .asList(
                            new ScalingHostPoolReference()
                                .withHostPoolArmPath("vvdfwatkpnpul")
                                .withScalingPlanEnabled(true)));
        model = BinaryData.fromObject(model).toObject(ScalingPlanPatchProperties.class);
        Assertions.assertEquals("sfcpkvxodpuozm", model.description());
        Assertions.assertEquals("ydagfuaxbe", model.friendlyName());
        Assertions.assertEquals("iu", model.timeZone());
        Assertions.assertEquals("ktwh", model.exclusionTag());
        Assertions.assertEquals("zywqsmbsu", model.schedules().get(0).name());
        Assertions.assertEquals(ScalingScheduleDaysOfWeekItem.SATURDAY, model.schedules().get(0).daysOfWeek().get(0));
        Assertions.assertEquals(26085617, model.schedules().get(0).rampUpStartTime().hour());
        Assertions.assertEquals(1115871957, model.schedules().get(0).rampUpStartTime().minute());
        Assertions
            .assertEquals(
                SessionHostLoadBalancingAlgorithm.BREADTH_FIRST,
                model.schedules().get(0).rampUpLoadBalancingAlgorithm());
        Assertions.assertEquals(994913433, model.schedules().get(0).rampUpMinimumHostsPct());
        Assertions.assertEquals(908271116, model.schedules().get(0).rampUpCapacityThresholdPct());
        Assertions.assertEquals(57544677, model.schedules().get(0).peakStartTime().hour());
        Assertions.assertEquals(1510965337, model.schedules().get(0).peakStartTime().minute());
        Assertions
            .assertEquals(
                SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.schedules().get(0).peakLoadBalancingAlgorithm());
        Assertions.assertEquals(376493890, model.schedules().get(0).rampDownStartTime().hour());
        Assertions.assertEquals(830050857, model.schedules().get(0).rampDownStartTime().minute());
        Assertions
            .assertEquals(
                SessionHostLoadBalancingAlgorithm.DEPTH_FIRST,
                model.schedules().get(0).rampDownLoadBalancingAlgorithm());
        Assertions.assertEquals(980316888, model.schedules().get(0).rampDownMinimumHostsPct());
        Assertions.assertEquals(1173289641, model.schedules().get(0).rampDownCapacityThresholdPct());
        Assertions.assertEquals(false, model.schedules().get(0).rampDownForceLogoffUsers());
        Assertions.assertEquals(StopHostsWhen.ZERO_SESSIONS, model.schedules().get(0).rampDownStopHostsWhen());
        Assertions.assertEquals(1867202070, model.schedules().get(0).rampDownWaitTimeMinutes());
        Assertions.assertEquals("rrqnbpoczvyifqrv", model.schedules().get(0).rampDownNotificationMessage());
        Assertions.assertEquals(983918139, model.schedules().get(0).offPeakStartTime().hour());
        Assertions.assertEquals(1867018963, model.schedules().get(0).offPeakStartTime().minute());
        Assertions
            .assertEquals(
                SessionHostLoadBalancingAlgorithm.BREADTH_FIRST,
                model.schedules().get(0).offPeakLoadBalancingAlgorithm());
        Assertions.assertEquals("vvdfwatkpnpul", model.hostPoolReferences().get(0).hostPoolArmPath());
        Assertions.assertEquals(true, model.hostPoolReferences().get(0).scalingPlanEnabled());
    }
}
