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

package com.azure.resourcemanager.dataprotection.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.dataprotection.models.RecoveryPointDataStoreDetails;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class RecoveryPointDataStoreDetailsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        RecoveryPointDataStoreDetails model =
            BinaryData
                .fromString(
                    "{\"creationTime\":\"2021-10-02T02:42:21Z\",\"expiryTime\":\"2021-09-17T13:51:22Z\",\"id\":\"llqwjygvjayvblmh\",\"metaData\":\"zuhbxvvyhgsopb\",\"state\":\"qufegxuvwzfbn\",\"type\":\"mctlpdngitv\",\"visible\":true,\"rehydrationExpiryTime\":\"2021-02-28T20:17:33Z\",\"rehydrationStatus\":\"DELETE_IN_PROGRESS\"}")
                .toObject(RecoveryPointDataStoreDetails.class);
        Assertions.assertEquals(OffsetDateTime.parse("2021-10-02T02:42:21Z"), model.creationTime());
        Assertions.assertEquals(OffsetDateTime.parse("2021-09-17T13:51:22Z"), model.expiryTime());
        Assertions.assertEquals("llqwjygvjayvblmh", model.id());
        Assertions.assertEquals("zuhbxvvyhgsopb", model.metadata());
        Assertions.assertEquals("qufegxuvwzfbn", model.state());
        Assertions.assertEquals("mctlpdngitv", model.type());
        Assertions.assertEquals(true, model.visible());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        RecoveryPointDataStoreDetails model =
            new RecoveryPointDataStoreDetails()
                .withCreationTime(OffsetDateTime.parse("2021-10-02T02:42:21Z"))
                .withExpiryTime(OffsetDateTime.parse("2021-09-17T13:51:22Z"))
                .withId("llqwjygvjayvblmh")
                .withMetadata("zuhbxvvyhgsopb")
                .withState("qufegxuvwzfbn")
                .withType("mctlpdngitv")
                .withVisible(true);
        model = BinaryData.fromObject(model).toObject(RecoveryPointDataStoreDetails.class);
        Assertions.assertEquals(OffsetDateTime.parse("2021-10-02T02:42:21Z"), model.creationTime());
        Assertions.assertEquals(OffsetDateTime.parse("2021-09-17T13:51:22Z"), model.expiryTime());
        Assertions.assertEquals("llqwjygvjayvblmh", model.id());
        Assertions.assertEquals("zuhbxvvyhgsopb", model.metadata());
        Assertions.assertEquals("qufegxuvwzfbn", model.state());
        Assertions.assertEquals("mctlpdngitv", model.type());
        Assertions.assertEquals(true, model.visible());
    }
}
