// 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.ScalingPlanPooledScheduleProperties;
import com.azure.resourcemanager.desktopvirtualization.models.DayOfWeek;
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 ScalingPlanPooledSchedulePropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ScalingPlanPooledScheduleProperties model =
            BinaryData
                .fromString(
                    "{\"daysOfWeek\":[\"Wednesday\",\"Wednesday\",\"Friday\",\"Saturday\"],\"rampUpStartTime\":{\"hour\":435987287,\"minute\":1665159346},\"rampUpLoadBalancingAlgorithm\":\"DepthFirst\",\"rampUpMinimumHostsPct\":382213486,\"rampUpCapacityThresholdPct\":947981025,\"peakStartTime\":{\"hour\":1718564660,\"minute\":746400217},\"peakLoadBalancingAlgorithm\":\"BreadthFirst\",\"rampDownStartTime\":{\"hour\":1037618415,\"minute\":362966046},\"rampDownLoadBalancingAlgorithm\":\"DepthFirst\",\"rampDownMinimumHostsPct\":1027327550,\"rampDownCapacityThresholdPct\":22083476,\"rampDownForceLogoffUsers\":false,\"rampDownStopHostsWhen\":\"ZeroActiveSessions\",\"rampDownWaitTimeMinutes\":558148580,\"rampDownNotificationMessage\":\"eyeam\",\"offPeakStartTime\":{\"hour\":1616519742,\"minute\":1995660983},\"offPeakLoadBalancingAlgorithm\":\"DepthFirst\"}")
                .toObject(ScalingPlanPooledScheduleProperties.class);
        Assertions.assertEquals(DayOfWeek.WEDNESDAY, model.daysOfWeek().get(0));
        Assertions.assertEquals(435987287, model.rampUpStartTime().hour());
        Assertions.assertEquals(1665159346, model.rampUpStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.rampUpLoadBalancingAlgorithm());
        Assertions.assertEquals(382213486, model.rampUpMinimumHostsPct());
        Assertions.assertEquals(947981025, model.rampUpCapacityThresholdPct());
        Assertions.assertEquals(1718564660, model.peakStartTime().hour());
        Assertions.assertEquals(746400217, model.peakStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.BREADTH_FIRST, model.peakLoadBalancingAlgorithm());
        Assertions.assertEquals(1037618415, model.rampDownStartTime().hour());
        Assertions.assertEquals(362966046, model.rampDownStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.rampDownLoadBalancingAlgorithm());
        Assertions.assertEquals(1027327550, model.rampDownMinimumHostsPct());
        Assertions.assertEquals(22083476, model.rampDownCapacityThresholdPct());
        Assertions.assertEquals(false, model.rampDownForceLogoffUsers());
        Assertions.assertEquals(StopHostsWhen.ZERO_ACTIVE_SESSIONS, model.rampDownStopHostsWhen());
        Assertions.assertEquals(558148580, model.rampDownWaitTimeMinutes());
        Assertions.assertEquals("eyeam", model.rampDownNotificationMessage());
        Assertions.assertEquals(1616519742, model.offPeakStartTime().hour());
        Assertions.assertEquals(1995660983, model.offPeakStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.offPeakLoadBalancingAlgorithm());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ScalingPlanPooledScheduleProperties model =
            new ScalingPlanPooledScheduleProperties()
                .withDaysOfWeek(
                    Arrays.asList(DayOfWeek.WEDNESDAY, DayOfWeek.WEDNESDAY, DayOfWeek.FRIDAY, DayOfWeek.SATURDAY))
                .withRampUpStartTime(new Time().withHour(435987287).withMinute(1665159346))
                .withRampUpLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST)
                .withRampUpMinimumHostsPct(382213486)
                .withRampUpCapacityThresholdPct(947981025)
                .withPeakStartTime(new Time().withHour(1718564660).withMinute(746400217))
                .withPeakLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.BREADTH_FIRST)
                .withRampDownStartTime(new Time().withHour(1037618415).withMinute(362966046))
                .withRampDownLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST)
                .withRampDownMinimumHostsPct(1027327550)
                .withRampDownCapacityThresholdPct(22083476)
                .withRampDownForceLogoffUsers(false)
                .withRampDownStopHostsWhen(StopHostsWhen.ZERO_ACTIVE_SESSIONS)
                .withRampDownWaitTimeMinutes(558148580)
                .withRampDownNotificationMessage("eyeam")
                .withOffPeakStartTime(new Time().withHour(1616519742).withMinute(1995660983))
                .withOffPeakLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST);
        model = BinaryData.fromObject(model).toObject(ScalingPlanPooledScheduleProperties.class);
        Assertions.assertEquals(DayOfWeek.WEDNESDAY, model.daysOfWeek().get(0));
        Assertions.assertEquals(435987287, model.rampUpStartTime().hour());
        Assertions.assertEquals(1665159346, model.rampUpStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.rampUpLoadBalancingAlgorithm());
        Assertions.assertEquals(382213486, model.rampUpMinimumHostsPct());
        Assertions.assertEquals(947981025, model.rampUpCapacityThresholdPct());
        Assertions.assertEquals(1718564660, model.peakStartTime().hour());
        Assertions.assertEquals(746400217, model.peakStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.BREADTH_FIRST, model.peakLoadBalancingAlgorithm());
        Assertions.assertEquals(1037618415, model.rampDownStartTime().hour());
        Assertions.assertEquals(362966046, model.rampDownStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.rampDownLoadBalancingAlgorithm());
        Assertions.assertEquals(1027327550, model.rampDownMinimumHostsPct());
        Assertions.assertEquals(22083476, model.rampDownCapacityThresholdPct());
        Assertions.assertEquals(false, model.rampDownForceLogoffUsers());
        Assertions.assertEquals(StopHostsWhen.ZERO_ACTIVE_SESSIONS, model.rampDownStopHostsWhen());
        Assertions.assertEquals(558148580, model.rampDownWaitTimeMinutes());
        Assertions.assertEquals("eyeam", model.rampDownNotificationMessage());
        Assertions.assertEquals(1616519742, model.offPeakStartTime().hour());
        Assertions.assertEquals(1995660983, model.offPeakStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.offPeakLoadBalancingAlgorithm());
    }
}
