// 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.models.EndpointType;
import com.azure.resourcemanager.netapp.models.ReplicationObject;
import com.azure.resourcemanager.netapp.models.ReplicationSchedule;
import com.azure.resourcemanager.netapp.models.VolumeBackupProperties;
import com.azure.resourcemanager.netapp.models.VolumePropertiesDataProtection;
import com.azure.resourcemanager.netapp.models.VolumeRelocationProperties;
import com.azure.resourcemanager.netapp.models.VolumeSnapshotProperties;
import org.junit.jupiter.api.Assertions;

public final class VolumePropertiesDataProtectionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        VolumePropertiesDataProtection model =
            BinaryData
                .fromString(
                    "{\"backup\":{\"backupPolicyId\":\"iw\",\"policyEnforced\":true,\"backupEnabled\":true},\"replication\":{\"replicationId\":\"zpuzycisp\",\"endpointType\":\"dst\",\"replicationSchedule\":\"daily\",\"remoteVolumeResourceId\":\"mgkbrpyydhibn\",\"remoteVolumeRegion\":\"qkpikadrgvtqagnb\"},\"snapshot\":{\"snapshotPolicyId\":\"hijggme\"},\"volumeRelocation\":{\"relocationRequested\":true,\"readyToBeFinalized\":false}}")
                .toObject(VolumePropertiesDataProtection.class);
        Assertions.assertEquals("iw", model.backup().backupPolicyId());
        Assertions.assertEquals(true, model.backup().policyEnforced());
        Assertions.assertEquals(true, model.backup().backupEnabled());
        Assertions.assertEquals("zpuzycisp", model.replication().replicationId());
        Assertions.assertEquals(EndpointType.DST, model.replication().endpointType());
        Assertions.assertEquals(ReplicationSchedule.DAILY, model.replication().replicationSchedule());
        Assertions.assertEquals("mgkbrpyydhibn", model.replication().remoteVolumeResourceId());
        Assertions.assertEquals("qkpikadrgvtqagnb", model.replication().remoteVolumeRegion());
        Assertions.assertEquals("hijggme", model.snapshot().snapshotPolicyId());
        Assertions.assertEquals(true, model.volumeRelocation().relocationRequested());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        VolumePropertiesDataProtection model =
            new VolumePropertiesDataProtection()
                .withBackup(
                    new VolumeBackupProperties()
                        .withBackupPolicyId("iw")
                        .withPolicyEnforced(true)
                        .withBackupEnabled(true))
                .withReplication(
                    new ReplicationObject()
                        .withReplicationId("zpuzycisp")
                        .withEndpointType(EndpointType.DST)
                        .withReplicationSchedule(ReplicationSchedule.DAILY)
                        .withRemoteVolumeResourceId("mgkbrpyydhibn")
                        .withRemoteVolumeRegion("qkpikadrgvtqagnb"))
                .withSnapshot(new VolumeSnapshotProperties().withSnapshotPolicyId("hijggme"))
                .withVolumeRelocation(new VolumeRelocationProperties().withRelocationRequested(true));
        model = BinaryData.fromObject(model).toObject(VolumePropertiesDataProtection.class);
        Assertions.assertEquals("iw", model.backup().backupPolicyId());
        Assertions.assertEquals(true, model.backup().policyEnforced());
        Assertions.assertEquals(true, model.backup().backupEnabled());
        Assertions.assertEquals("zpuzycisp", model.replication().replicationId());
        Assertions.assertEquals(EndpointType.DST, model.replication().endpointType());
        Assertions.assertEquals(ReplicationSchedule.DAILY, model.replication().replicationSchedule());
        Assertions.assertEquals("mgkbrpyydhibn", model.replication().remoteVolumeResourceId());
        Assertions.assertEquals("qkpikadrgvtqagnb", model.replication().remoteVolumeRegion());
        Assertions.assertEquals("hijggme", model.snapshot().snapshotPolicyId());
        Assertions.assertEquals(true, model.volumeRelocation().relocationRequested());
    }
}
