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

package com.azure.resourcemanager.devtestlabs.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleCreationParameterProperties;
import com.azure.resourcemanager.devtestlabs.models.DayDetails;
import com.azure.resourcemanager.devtestlabs.models.EnableStatus;
import com.azure.resourcemanager.devtestlabs.models.HourDetails;
import com.azure.resourcemanager.devtestlabs.models.NotificationSettings;
import com.azure.resourcemanager.devtestlabs.models.WeekDetails;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ScheduleCreationParameterPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ScheduleCreationParameterProperties model =
            BinaryData
                .fromString(
                    "{\"status\":\"Disabled\",\"taskType\":\"qamvdkfwynwcvtbv\",\"weeklyRecurrence\":{\"weekdays\":[\"mtnvyq\",\"atkzwpcnpw\"],\"time\":\"jaesgvvsccya\"},\"dailyRecurrence\":{\"time\":\"qfhwyg\"},\"hourlyRecurrence\":{\"minute\":1249464934},\"timeZoneId\":\"kfxu\",\"notificationSettings\":{\"status\":\"Enabled\",\"timeInMinutes\":1095077901,\"webhookUrl\":\"muhapfcqdpsqxqv\",\"emailRecipient\":\"vuoy\",\"notificationLocale\":\"ccelve\"},\"targetResourceId\":\"ypql\"}")
                .toObject(ScheduleCreationParameterProperties.class);
        Assertions.assertEquals(EnableStatus.DISABLED, model.status());
        Assertions.assertEquals("qamvdkfwynwcvtbv", model.taskType());
        Assertions.assertEquals("mtnvyq", model.weeklyRecurrence().weekdays().get(0));
        Assertions.assertEquals("jaesgvvsccya", model.weeklyRecurrence().time());
        Assertions.assertEquals("qfhwyg", model.dailyRecurrence().time());
        Assertions.assertEquals(1249464934, model.hourlyRecurrence().minute());
        Assertions.assertEquals("kfxu", model.timeZoneId());
        Assertions.assertEquals(EnableStatus.ENABLED, model.notificationSettings().status());
        Assertions.assertEquals(1095077901, model.notificationSettings().timeInMinutes());
        Assertions.assertEquals("muhapfcqdpsqxqv", model.notificationSettings().webhookUrl());
        Assertions.assertEquals("vuoy", model.notificationSettings().emailRecipient());
        Assertions.assertEquals("ccelve", model.notificationSettings().notificationLocale());
        Assertions.assertEquals("ypql", model.targetResourceId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ScheduleCreationParameterProperties model =
            new ScheduleCreationParameterProperties()
                .withStatus(EnableStatus.DISABLED)
                .withTaskType("qamvdkfwynwcvtbv")
                .withWeeklyRecurrence(
                    new WeekDetails().withWeekdays(Arrays.asList("mtnvyq", "atkzwpcnpw")).withTime("jaesgvvsccya"))
                .withDailyRecurrence(new DayDetails().withTime("qfhwyg"))
                .withHourlyRecurrence(new HourDetails().withMinute(1249464934))
                .withTimeZoneId("kfxu")
                .withNotificationSettings(
                    new NotificationSettings()
                        .withStatus(EnableStatus.ENABLED)
                        .withTimeInMinutes(1095077901)
                        .withWebhookUrl("muhapfcqdpsqxqv")
                        .withEmailRecipient("vuoy")
                        .withNotificationLocale("ccelve"))
                .withTargetResourceId("ypql");
        model = BinaryData.fromObject(model).toObject(ScheduleCreationParameterProperties.class);
        Assertions.assertEquals(EnableStatus.DISABLED, model.status());
        Assertions.assertEquals("qamvdkfwynwcvtbv", model.taskType());
        Assertions.assertEquals("mtnvyq", model.weeklyRecurrence().weekdays().get(0));
        Assertions.assertEquals("jaesgvvsccya", model.weeklyRecurrence().time());
        Assertions.assertEquals("qfhwyg", model.dailyRecurrence().time());
        Assertions.assertEquals(1249464934, model.hourlyRecurrence().minute());
        Assertions.assertEquals("kfxu", model.timeZoneId());
        Assertions.assertEquals(EnableStatus.ENABLED, model.notificationSettings().status());
        Assertions.assertEquals(1095077901, model.notificationSettings().timeInMinutes());
        Assertions.assertEquals("muhapfcqdpsqxqv", model.notificationSettings().webhookUrl());
        Assertions.assertEquals("vuoy", model.notificationSettings().emailRecipient());
        Assertions.assertEquals("ccelve", model.notificationSettings().notificationLocale());
        Assertions.assertEquals("ypql", model.targetResourceId());
    }
}
