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

package com.azure.resourcemanager.recoveryservicesbackup.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.recoveryservicesbackup.models.DailyRetentionFormat;
import com.azure.resourcemanager.recoveryservicesbackup.models.Day;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class DailyRetentionFormatTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DailyRetentionFormat model =
            BinaryData
                .fromString(
                    "{\"daysOfTheMonth\":[{\"date\":623740399,\"isLast\":true},{\"date\":1873206195,\"isLast\":false},{\"date\":1022409810,\"isLast\":false},{\"date\":1935612973,\"isLast\":true}]}")
                .toObject(DailyRetentionFormat.class);
        Assertions.assertEquals(623740399, model.daysOfTheMonth().get(0).date());
        Assertions.assertEquals(true, model.daysOfTheMonth().get(0).isLast());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DailyRetentionFormat model =
            new DailyRetentionFormat()
                .withDaysOfTheMonth(
                    Arrays
                        .asList(
                            new Day().withDate(623740399).withIsLast(true),
                            new Day().withDate(1873206195).withIsLast(false),
                            new Day().withDate(1022409810).withIsLast(false),
                            new Day().withDate(1935612973).withIsLast(true)));
        model = BinaryData.fromObject(model).toObject(DailyRetentionFormat.class);
        Assertions.assertEquals(623740399, model.daysOfTheMonth().get(0).date());
        Assertions.assertEquals(true, model.daysOfTheMonth().get(0).isLast());
    }
}
