// 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.MaintenanceWindowsInner;
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 MaintenanceWindowsInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        MaintenanceWindowsInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"timeRanges\":[{\"dayOfWeek\":\"Sunday\",\"startTime\":\"eodkwobda\",\"duration\":\"tibqdxbxwakb\"},{\"dayOfWeek\":\"Wednesday\",\"startTime\":\"ndlkzgxhurip\",\"duration\":\"podxunkb\"}]},\"id\":\"bxmubyynt\",\"name\":\"lrb\",\"type\":\"tkoievseotgq\"}")
                .toObject(MaintenanceWindowsInner.class);
        Assertions.assertEquals(DayOfWeek.SUNDAY, model.timeRanges().get(0).dayOfWeek());
        Assertions.assertEquals("eodkwobda", model.timeRanges().get(0).startTime());
        Assertions.assertEquals("tibqdxbxwakb", model.timeRanges().get(0).duration());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        MaintenanceWindowsInner model =
            new MaintenanceWindowsInner()
                .withTimeRanges(
                    Arrays
                        .asList(
                            new MaintenanceWindowTimeRange()
                                .withDayOfWeek(DayOfWeek.SUNDAY)
                                .withStartTime("eodkwobda")
                                .withDuration("tibqdxbxwakb"),
                            new MaintenanceWindowTimeRange()
                                .withDayOfWeek(DayOfWeek.WEDNESDAY)
                                .withStartTime("ndlkzgxhurip")
                                .withDuration("podxunkb")));
        model = BinaryData.fromObject(model).toObject(MaintenanceWindowsInner.class);
        Assertions.assertEquals(DayOfWeek.SUNDAY, model.timeRanges().get(0).dayOfWeek());
        Assertions.assertEquals("eodkwobda", model.timeRanges().get(0).startTime());
        Assertions.assertEquals("tibqdxbxwakb", model.timeRanges().get(0).duration());
    }
}
