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

package com.azure.resourcemanager.synapse.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.synapse.fluent.models.MaintenanceWindowOptionsInner;
import com.azure.resourcemanager.synapse.models.DayOfWeek;
import com.azure.resourcemanager.synapse.models.MaintenanceWindowTimeRange;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class MaintenanceWindowOptionsInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        MaintenanceWindowOptionsInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"isEnabled\":false,\"maintenanceWindowCycles\":[{\"dayOfWeek\":\"Saturday\",\"startTime\":\"sjnkal\",\"duration\":\"tiiswacffg\"},{\"dayOfWeek\":\"Wednesday\",\"startTime\":\"ewkfvhqcrai\",\"duration\":\"pnppfuf\"},{\"dayOfWeek\":\"Monday\",\"startTime\":\"mh\",\"duration\":\"xyjrxsagafcnih\"},{\"dayOfWeek\":\"Tuesday\",\"startTime\":\"pnedgf\",\"duration\":\"vkcvqvpkeqd\"}],\"minDurationInMinutes\":978047634,\"defaultDurationInMinutes\":1258366887,\"minCycles\":649477703,\"timeGranularityInMinutes\":60814629,\"allowMultipleMaintenanceWindowsPerCycle\":true},\"id\":\"tbobz\",\"name\":\"opcjwvnhd\",\"type\":\"d\"}")
                .toObject(MaintenanceWindowOptionsInner.class);
        Assertions.assertEquals(false, model.isEnabled());
        Assertions.assertEquals(DayOfWeek.SATURDAY, model.maintenanceWindowCycles().get(0).dayOfWeek());
        Assertions.assertEquals("sjnkal", model.maintenanceWindowCycles().get(0).startTime());
        Assertions.assertEquals("tiiswacffg", model.maintenanceWindowCycles().get(0).duration());
        Assertions.assertEquals(978047634, model.minDurationInMinutes());
        Assertions.assertEquals(1258366887, model.defaultDurationInMinutes());
        Assertions.assertEquals(649477703, model.minCycles());
        Assertions.assertEquals(60814629, model.timeGranularityInMinutes());
        Assertions.assertEquals(true, model.allowMultipleMaintenanceWindowsPerCycle());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        MaintenanceWindowOptionsInner model =
            new MaintenanceWindowOptionsInner()
                .withIsEnabled(false)
                .withMaintenanceWindowCycles(
                    Arrays
                        .asList(
                            new MaintenanceWindowTimeRange()
                                .withDayOfWeek(DayOfWeek.SATURDAY)
                                .withStartTime("sjnkal")
                                .withDuration("tiiswacffg"),
                            new MaintenanceWindowTimeRange()
                                .withDayOfWeek(DayOfWeek.WEDNESDAY)
                                .withStartTime("ewkfvhqcrai")
                                .withDuration("pnppfuf"),
                            new MaintenanceWindowTimeRange()
                                .withDayOfWeek(DayOfWeek.MONDAY)
                                .withStartTime("mh")
                                .withDuration("xyjrxsagafcnih"),
                            new MaintenanceWindowTimeRange()
                                .withDayOfWeek(DayOfWeek.TUESDAY)
                                .withStartTime("pnedgf")
                                .withDuration("vkcvqvpkeqd")))
                .withMinDurationInMinutes(978047634)
                .withDefaultDurationInMinutes(1258366887)
                .withMinCycles(649477703)
                .withTimeGranularityInMinutes(60814629)
                .withAllowMultipleMaintenanceWindowsPerCycle(true);
        model = BinaryData.fromObject(model).toObject(MaintenanceWindowOptionsInner.class);
        Assertions.assertEquals(false, model.isEnabled());
        Assertions.assertEquals(DayOfWeek.SATURDAY, model.maintenanceWindowCycles().get(0).dayOfWeek());
        Assertions.assertEquals("sjnkal", model.maintenanceWindowCycles().get(0).startTime());
        Assertions.assertEquals("tiiswacffg", model.maintenanceWindowCycles().get(0).duration());
        Assertions.assertEquals(978047634, model.minDurationInMinutes());
        Assertions.assertEquals(1258366887, model.defaultDurationInMinutes());
        Assertions.assertEquals(649477703, model.minCycles());
        Assertions.assertEquals(60814629, model.timeGranularityInMinutes());
        Assertions.assertEquals(true, model.allowMultipleMaintenanceWindowsPerCycle());
    }
}
