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

package com.azure.resourcemanager.netapp.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.netapp.fluent.models.SnapshotPolicyProperties;
import com.azure.resourcemanager.netapp.models.DailySchedule;
import com.azure.resourcemanager.netapp.models.HourlySchedule;
import com.azure.resourcemanager.netapp.models.MonthlySchedule;
import com.azure.resourcemanager.netapp.models.WeeklySchedule;
import org.junit.jupiter.api.Assertions;

public final class SnapshotPolicyPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SnapshotPolicyProperties model =
            BinaryData
                .fromString(
                    "{\"hourlySchedule\":{\"snapshotsToKeep\":540761199,\"minute\":1878855914,\"usedBytes\":7872271488067797669},\"dailySchedule\":{\"snapshotsToKeep\":1470162172,\"hour\":1117825443,\"minute\":677878330,\"usedBytes\":2093041238668627370},\"weeklySchedule\":{\"snapshotsToKeep\":1188392360,\"day\":\"dzu\",\"hour\":566185577,\"minute\":1316965845,\"usedBytes\":5116891970547577634},\"monthlySchedule\":{\"snapshotsToKeep\":1008975068,\"daysOfMonth\":\"iwjmygtdssls\",\"hour\":464714758,\"minute\":478767297,\"usedBytes\":3503486836446743621},\"enabled\":true,\"provisioningState\":\"yqsemwa\"}")
                .toObject(SnapshotPolicyProperties.class);
        Assertions.assertEquals(540761199, model.hourlySchedule().snapshotsToKeep());
        Assertions.assertEquals(1878855914, model.hourlySchedule().minute());
        Assertions.assertEquals(7872271488067797669L, model.hourlySchedule().usedBytes());
        Assertions.assertEquals(1470162172, model.dailySchedule().snapshotsToKeep());
        Assertions.assertEquals(1117825443, model.dailySchedule().hour());
        Assertions.assertEquals(677878330, model.dailySchedule().minute());
        Assertions.assertEquals(2093041238668627370L, model.dailySchedule().usedBytes());
        Assertions.assertEquals(1188392360, model.weeklySchedule().snapshotsToKeep());
        Assertions.assertEquals("dzu", model.weeklySchedule().day());
        Assertions.assertEquals(566185577, model.weeklySchedule().hour());
        Assertions.assertEquals(1316965845, model.weeklySchedule().minute());
        Assertions.assertEquals(5116891970547577634L, model.weeklySchedule().usedBytes());
        Assertions.assertEquals(1008975068, model.monthlySchedule().snapshotsToKeep());
        Assertions.assertEquals("iwjmygtdssls", model.monthlySchedule().daysOfMonth());
        Assertions.assertEquals(464714758, model.monthlySchedule().hour());
        Assertions.assertEquals(478767297, model.monthlySchedule().minute());
        Assertions.assertEquals(3503486836446743621L, model.monthlySchedule().usedBytes());
        Assertions.assertEquals(true, model.enabled());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SnapshotPolicyProperties model =
            new SnapshotPolicyProperties()
                .withHourlySchedule(
                    new HourlySchedule()
                        .withSnapshotsToKeep(540761199)
                        .withMinute(1878855914)
                        .withUsedBytes(7872271488067797669L))
                .withDailySchedule(
                    new DailySchedule()
                        .withSnapshotsToKeep(1470162172)
                        .withHour(1117825443)
                        .withMinute(677878330)
                        .withUsedBytes(2093041238668627370L))
                .withWeeklySchedule(
                    new WeeklySchedule()
                        .withSnapshotsToKeep(1188392360)
                        .withDay("dzu")
                        .withHour(566185577)
                        .withMinute(1316965845)
                        .withUsedBytes(5116891970547577634L))
                .withMonthlySchedule(
                    new MonthlySchedule()
                        .withSnapshotsToKeep(1008975068)
                        .withDaysOfMonth("iwjmygtdssls")
                        .withHour(464714758)
                        .withMinute(478767297)
                        .withUsedBytes(3503486836446743621L))
                .withEnabled(true);
        model = BinaryData.fromObject(model).toObject(SnapshotPolicyProperties.class);
        Assertions.assertEquals(540761199, model.hourlySchedule().snapshotsToKeep());
        Assertions.assertEquals(1878855914, model.hourlySchedule().minute());
        Assertions.assertEquals(7872271488067797669L, model.hourlySchedule().usedBytes());
        Assertions.assertEquals(1470162172, model.dailySchedule().snapshotsToKeep());
        Assertions.assertEquals(1117825443, model.dailySchedule().hour());
        Assertions.assertEquals(677878330, model.dailySchedule().minute());
        Assertions.assertEquals(2093041238668627370L, model.dailySchedule().usedBytes());
        Assertions.assertEquals(1188392360, model.weeklySchedule().snapshotsToKeep());
        Assertions.assertEquals("dzu", model.weeklySchedule().day());
        Assertions.assertEquals(566185577, model.weeklySchedule().hour());
        Assertions.assertEquals(1316965845, model.weeklySchedule().minute());
        Assertions.assertEquals(5116891970547577634L, model.weeklySchedule().usedBytes());
        Assertions.assertEquals(1008975068, model.monthlySchedule().snapshotsToKeep());
        Assertions.assertEquals("iwjmygtdssls", model.monthlySchedule().daysOfMonth());
        Assertions.assertEquals(464714758, model.monthlySchedule().hour());
        Assertions.assertEquals(478767297, model.monthlySchedule().minute());
        Assertions.assertEquals(3503486836446743621L, model.monthlySchedule().usedBytes());
        Assertions.assertEquals(true, model.enabled());
    }
}
