// 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.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 ScalingScheduleTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ScalingSchedule model =
            BinaryData
                .fromString(
                    "{\"name\":\"asxazjpqyegualhb\",\"daysOfWeek\":[\"Monday\",\"Sunday\"],\"rampUpStartTime\":{\"hour\":497531730,\"minute\":2029322855},\"rampUpLoadBalancingAlgorithm\":\"DepthFirst\",\"rampUpMinimumHostsPct\":303390013,\"rampUpCapacityThresholdPct\":943978504,\"peakStartTime\":{\"hour\":1894973970,\"minute\":678602064},\"peakLoadBalancingAlgorithm\":\"DepthFirst\",\"rampDownStartTime\":{\"hour\":271444945,\"minute\":719647330},\"rampDownLoadBalancingAlgorithm\":\"DepthFirst\",\"rampDownMinimumHostsPct\":264825105,\"rampDownCapacityThresholdPct\":1581858778,\"rampDownForceLogoffUsers\":false,\"rampDownStopHostsWhen\":\"ZeroActiveSessions\",\"rampDownWaitTimeMinutes\":34788734,\"rampDownNotificationMessage\":\"cftadeh\",\"offPeakStartTime\":{\"hour\":1636345438,\"minute\":1194387790},\"offPeakLoadBalancingAlgorithm\":\"DepthFirst\"}")
                .toObject(ScalingSchedule.class);
        Assertions.assertEquals("asxazjpqyegualhb", model.name());
        Assertions.assertEquals(ScalingScheduleDaysOfWeekItem.MONDAY, model.daysOfWeek().get(0));
        Assertions.assertEquals(497531730, model.rampUpStartTime().hour());
        Assertions.assertEquals(2029322855, model.rampUpStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.rampUpLoadBalancingAlgorithm());
        Assertions.assertEquals(303390013, model.rampUpMinimumHostsPct());
        Assertions.assertEquals(943978504, model.rampUpCapacityThresholdPct());
        Assertions.assertEquals(1894973970, model.peakStartTime().hour());
        Assertions.assertEquals(678602064, model.peakStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.peakLoadBalancingAlgorithm());
        Assertions.assertEquals(271444945, model.rampDownStartTime().hour());
        Assertions.assertEquals(719647330, model.rampDownStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.rampDownLoadBalancingAlgorithm());
        Assertions.assertEquals(264825105, model.rampDownMinimumHostsPct());
        Assertions.assertEquals(1581858778, model.rampDownCapacityThresholdPct());
        Assertions.assertEquals(false, model.rampDownForceLogoffUsers());
        Assertions.assertEquals(StopHostsWhen.ZERO_ACTIVE_SESSIONS, model.rampDownStopHostsWhen());
        Assertions.assertEquals(34788734, model.rampDownWaitTimeMinutes());
        Assertions.assertEquals("cftadeh", model.rampDownNotificationMessage());
        Assertions.assertEquals(1636345438, model.offPeakStartTime().hour());
        Assertions.assertEquals(1194387790, model.offPeakStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.offPeakLoadBalancingAlgorithm());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ScalingSchedule model =
            new ScalingSchedule()
                .withName("asxazjpqyegualhb")
                .withDaysOfWeek(
                    Arrays.asList(ScalingScheduleDaysOfWeekItem.MONDAY, ScalingScheduleDaysOfWeekItem.SUNDAY))
                .withRampUpStartTime(new Time().withHour(497531730).withMinute(2029322855))
                .withRampUpLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST)
                .withRampUpMinimumHostsPct(303390013)
                .withRampUpCapacityThresholdPct(943978504)
                .withPeakStartTime(new Time().withHour(1894973970).withMinute(678602064))
                .withPeakLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST)
                .withRampDownStartTime(new Time().withHour(271444945).withMinute(719647330))
                .withRampDownLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST)
                .withRampDownMinimumHostsPct(264825105)
                .withRampDownCapacityThresholdPct(1581858778)
                .withRampDownForceLogoffUsers(false)
                .withRampDownStopHostsWhen(StopHostsWhen.ZERO_ACTIVE_SESSIONS)
                .withRampDownWaitTimeMinutes(34788734)
                .withRampDownNotificationMessage("cftadeh")
                .withOffPeakStartTime(new Time().withHour(1636345438).withMinute(1194387790))
                .withOffPeakLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST);
        model = BinaryData.fromObject(model).toObject(ScalingSchedule.class);
        Assertions.assertEquals("asxazjpqyegualhb", model.name());
        Assertions.assertEquals(ScalingScheduleDaysOfWeekItem.MONDAY, model.daysOfWeek().get(0));
        Assertions.assertEquals(497531730, model.rampUpStartTime().hour());
        Assertions.assertEquals(2029322855, model.rampUpStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.rampUpLoadBalancingAlgorithm());
        Assertions.assertEquals(303390013, model.rampUpMinimumHostsPct());
        Assertions.assertEquals(943978504, model.rampUpCapacityThresholdPct());
        Assertions.assertEquals(1894973970, model.peakStartTime().hour());
        Assertions.assertEquals(678602064, model.peakStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.peakLoadBalancingAlgorithm());
        Assertions.assertEquals(271444945, model.rampDownStartTime().hour());
        Assertions.assertEquals(719647330, model.rampDownStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.rampDownLoadBalancingAlgorithm());
        Assertions.assertEquals(264825105, model.rampDownMinimumHostsPct());
        Assertions.assertEquals(1581858778, model.rampDownCapacityThresholdPct());
        Assertions.assertEquals(false, model.rampDownForceLogoffUsers());
        Assertions.assertEquals(StopHostsWhen.ZERO_ACTIVE_SESSIONS, model.rampDownStopHostsWhen());
        Assertions.assertEquals(34788734, model.rampDownWaitTimeMinutes());
        Assertions.assertEquals("cftadeh", model.rampDownNotificationMessage());
        Assertions.assertEquals(1636345438, model.offPeakStartTime().hour());
        Assertions.assertEquals(1194387790, model.offPeakStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.offPeakLoadBalancingAlgorithm());
    }
}
