// 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.MaintenanceWindowsProperties;
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 MaintenanceWindowsPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        MaintenanceWindowsProperties model =
            BinaryData
                .fromString(
                    "{\"timeRanges\":[{\"dayOfWeek\":\"Tuesday\",\"startTime\":\"wlauwzizxbmpg\",\"duration\":\"efuzmuvpbttd\"},{\"dayOfWeek\":\"Sunday\",\"startTime\":\"p\",\"duration\":\"ebmnzbtbhjpglk\"},{\"dayOfWeek\":\"Monday\",\"startTime\":\"dneu\",\"duration\":\"fphsdyhtozfikdow\"},{\"dayOfWeek\":\"Sunday\",\"startTime\":\"v\",\"duration\":\"xclvit\"}]}")
                .toObject(MaintenanceWindowsProperties.class);
        Assertions.assertEquals(DayOfWeek.TUESDAY, model.timeRanges().get(0).dayOfWeek());
        Assertions.assertEquals("wlauwzizxbmpg", model.timeRanges().get(0).startTime());
        Assertions.assertEquals("efuzmuvpbttd", model.timeRanges().get(0).duration());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        MaintenanceWindowsProperties model =
            new MaintenanceWindowsProperties()
                .withTimeRanges(
                    Arrays
                        .asList(
                            new MaintenanceWindowTimeRange()
                                .withDayOfWeek(DayOfWeek.TUESDAY)
                                .withStartTime("wlauwzizxbmpg")
                                .withDuration("efuzmuvpbttd"),
                            new MaintenanceWindowTimeRange()
                                .withDayOfWeek(DayOfWeek.SUNDAY)
                                .withStartTime("p")
                                .withDuration("ebmnzbtbhjpglk"),
                            new MaintenanceWindowTimeRange()
                                .withDayOfWeek(DayOfWeek.MONDAY)
                                .withStartTime("dneu")
                                .withDuration("fphsdyhtozfikdow"),
                            new MaintenanceWindowTimeRange()
                                .withDayOfWeek(DayOfWeek.SUNDAY)
                                .withStartTime("v")
                                .withDuration("xclvit")));
        model = BinaryData.fromObject(model).toObject(MaintenanceWindowsProperties.class);
        Assertions.assertEquals(DayOfWeek.TUESDAY, model.timeRanges().get(0).dayOfWeek());
        Assertions.assertEquals("wlauwzizxbmpg", model.timeRanges().get(0).startTime());
        Assertions.assertEquals("efuzmuvpbttd", model.timeRanges().get(0).duration());
    }
}
