// 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.DayOfWeek;
import com.azure.resourcemanager.desktopvirtualization.models.ScalingPlanPooledSchedulePatch;
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 ScalingPlanPooledSchedulePatchTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ScalingPlanPooledSchedulePatch model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"daysOfWeek\":[\"Thursday\",\"Saturday\"],\"rampUpStartTime\":{\"hour\":605545221,\"minute\":44381208},\"rampUpLoadBalancingAlgorithm\":\"BreadthFirst\",\"rampUpMinimumHostsPct\":1148741426,\"rampUpCapacityThresholdPct\":390798331,\"peakStartTime\":{\"hour\":1456647445,\"minute\":353771493},\"peakLoadBalancingAlgorithm\":\"DepthFirst\",\"rampDownStartTime\":{\"hour\":1446067033,\"minute\":248274393},\"rampDownLoadBalancingAlgorithm\":\"DepthFirst\",\"rampDownMinimumHostsPct\":583460875,\"rampDownCapacityThresholdPct\":1192449755,\"rampDownForceLogoffUsers\":true,\"rampDownStopHostsWhen\":\"ZeroSessions\",\"rampDownWaitTimeMinutes\":895884461,\"rampDownNotificationMessage\":\"mryw\",\"offPeakStartTime\":{\"hour\":2134987728,\"minute\":1133422967},\"offPeakLoadBalancingAlgorithm\":\"DepthFirst\"},\"id\":\"tiyqzrnkcqv\",\"name\":\"xlwhzlsicoh\",\"type\":\"qqn\"}")
                .toObject(ScalingPlanPooledSchedulePatch.class);
        Assertions.assertEquals(DayOfWeek.THURSDAY, model.daysOfWeek().get(0));
        Assertions.assertEquals(605545221, model.rampUpStartTime().hour());
        Assertions.assertEquals(44381208, model.rampUpStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.BREADTH_FIRST, model.rampUpLoadBalancingAlgorithm());
        Assertions.assertEquals(1148741426, model.rampUpMinimumHostsPct());
        Assertions.assertEquals(390798331, model.rampUpCapacityThresholdPct());
        Assertions.assertEquals(1456647445, model.peakStartTime().hour());
        Assertions.assertEquals(353771493, model.peakStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.peakLoadBalancingAlgorithm());
        Assertions.assertEquals(1446067033, model.rampDownStartTime().hour());
        Assertions.assertEquals(248274393, model.rampDownStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.rampDownLoadBalancingAlgorithm());
        Assertions.assertEquals(583460875, model.rampDownMinimumHostsPct());
        Assertions.assertEquals(1192449755, model.rampDownCapacityThresholdPct());
        Assertions.assertEquals(true, model.rampDownForceLogoffUsers());
        Assertions.assertEquals(StopHostsWhen.ZERO_SESSIONS, model.rampDownStopHostsWhen());
        Assertions.assertEquals(895884461, model.rampDownWaitTimeMinutes());
        Assertions.assertEquals("mryw", model.rampDownNotificationMessage());
        Assertions.assertEquals(2134987728, model.offPeakStartTime().hour());
        Assertions.assertEquals(1133422967, model.offPeakStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.offPeakLoadBalancingAlgorithm());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ScalingPlanPooledSchedulePatch model =
            new ScalingPlanPooledSchedulePatch()
                .withDaysOfWeek(Arrays.asList(DayOfWeek.THURSDAY, DayOfWeek.SATURDAY))
                .withRampUpStartTime(new Time().withHour(605545221).withMinute(44381208))
                .withRampUpLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.BREADTH_FIRST)
                .withRampUpMinimumHostsPct(1148741426)
                .withRampUpCapacityThresholdPct(390798331)
                .withPeakStartTime(new Time().withHour(1456647445).withMinute(353771493))
                .withPeakLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST)
                .withRampDownStartTime(new Time().withHour(1446067033).withMinute(248274393))
                .withRampDownLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST)
                .withRampDownMinimumHostsPct(583460875)
                .withRampDownCapacityThresholdPct(1192449755)
                .withRampDownForceLogoffUsers(true)
                .withRampDownStopHostsWhen(StopHostsWhen.ZERO_SESSIONS)
                .withRampDownWaitTimeMinutes(895884461)
                .withRampDownNotificationMessage("mryw")
                .withOffPeakStartTime(new Time().withHour(2134987728).withMinute(1133422967))
                .withOffPeakLoadBalancingAlgorithm(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST);
        model = BinaryData.fromObject(model).toObject(ScalingPlanPooledSchedulePatch.class);
        Assertions.assertEquals(DayOfWeek.THURSDAY, model.daysOfWeek().get(0));
        Assertions.assertEquals(605545221, model.rampUpStartTime().hour());
        Assertions.assertEquals(44381208, model.rampUpStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.BREADTH_FIRST, model.rampUpLoadBalancingAlgorithm());
        Assertions.assertEquals(1148741426, model.rampUpMinimumHostsPct());
        Assertions.assertEquals(390798331, model.rampUpCapacityThresholdPct());
        Assertions.assertEquals(1456647445, model.peakStartTime().hour());
        Assertions.assertEquals(353771493, model.peakStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.peakLoadBalancingAlgorithm());
        Assertions.assertEquals(1446067033, model.rampDownStartTime().hour());
        Assertions.assertEquals(248274393, model.rampDownStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.rampDownLoadBalancingAlgorithm());
        Assertions.assertEquals(583460875, model.rampDownMinimumHostsPct());
        Assertions.assertEquals(1192449755, model.rampDownCapacityThresholdPct());
        Assertions.assertEquals(true, model.rampDownForceLogoffUsers());
        Assertions.assertEquals(StopHostsWhen.ZERO_SESSIONS, model.rampDownStopHostsWhen());
        Assertions.assertEquals(895884461, model.rampDownWaitTimeMinutes());
        Assertions.assertEquals("mryw", model.rampDownNotificationMessage());
        Assertions.assertEquals(2134987728, model.offPeakStartTime().hour());
        Assertions.assertEquals(1133422967, model.offPeakStartTime().minute());
        Assertions.assertEquals(SessionHostLoadBalancingAlgorithm.DEPTH_FIRST, model.offPeakLoadBalancingAlgorithm());
    }
}
