// 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.AzureBackupRecoveryPointBasedRestoreRequest;
import com.azure.resourcemanager.dataprotection.models.IdentityDetails;
import com.azure.resourcemanager.dataprotection.models.RecoveryOption;
import com.azure.resourcemanager.dataprotection.models.RestoreTargetInfoBase;
import com.azure.resourcemanager.dataprotection.models.SourceDataStoreType;
import org.junit.jupiter.api.Assertions;

public final class AzureBackupRecoveryPointBasedRestoreRequestTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AzureBackupRecoveryPointBasedRestoreRequest model =
            BinaryData
                .fromString(
                    "{\"objectType\":\"AzureBackupRecoveryPointBasedRestoreRequest\",\"recoveryPointId\":\"cbihwqk\",\"restoreTargetInfo\":{\"objectType\":\"RestoreTargetInfoBase\",\"recoveryOption\":\"FailIfExists\",\"restoreLocation\":\"ntwjch\"},\"sourceDataStoreType\":\"VaultStore\",\"sourceResourceId\":\"oihxumwctondzjlu\",\"identityDetails\":{\"useSystemAssignedIdentity\":true,\"userAssignedIdentityArmUrl\":\"wggytsbwtovvt\"}}")
                .toObject(AzureBackupRecoveryPointBasedRestoreRequest.class);
        Assertions.assertEquals(RecoveryOption.FAIL_IF_EXISTS, model.restoreTargetInfo().recoveryOption());
        Assertions.assertEquals("ntwjch", model.restoreTargetInfo().restoreLocation());
        Assertions.assertEquals(SourceDataStoreType.VAULT_STORE, model.sourceDataStoreType());
        Assertions.assertEquals("oihxumwctondzjlu", model.sourceResourceId());
        Assertions.assertEquals(true, model.identityDetails().useSystemAssignedIdentity());
        Assertions.assertEquals("wggytsbwtovvt", model.identityDetails().userAssignedIdentityArmUrl());
        Assertions.assertEquals("cbihwqk", model.recoveryPointId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AzureBackupRecoveryPointBasedRestoreRequest model =
            new AzureBackupRecoveryPointBasedRestoreRequest()
                .withRestoreTargetInfo(
                    new RestoreTargetInfoBase()
                        .withRecoveryOption(RecoveryOption.FAIL_IF_EXISTS)
                        .withRestoreLocation("ntwjch"))
                .withSourceDataStoreType(SourceDataStoreType.VAULT_STORE)
                .withSourceResourceId("oihxumwctondzjlu")
                .withIdentityDetails(
                    new IdentityDetails()
                        .withUseSystemAssignedIdentity(true)
                        .withUserAssignedIdentityArmUrl("wggytsbwtovvt"))
                .withRecoveryPointId("cbihwqk");
        model = BinaryData.fromObject(model).toObject(AzureBackupRecoveryPointBasedRestoreRequest.class);
        Assertions.assertEquals(RecoveryOption.FAIL_IF_EXISTS, model.restoreTargetInfo().recoveryOption());
        Assertions.assertEquals("ntwjch", model.restoreTargetInfo().restoreLocation());
        Assertions.assertEquals(SourceDataStoreType.VAULT_STORE, model.sourceDataStoreType());
        Assertions.assertEquals("oihxumwctondzjlu", model.sourceResourceId());
        Assertions.assertEquals(true, model.identityDetails().useSystemAssignedIdentity());
        Assertions.assertEquals("wggytsbwtovvt", model.identityDetails().userAssignedIdentityArmUrl());
        Assertions.assertEquals("cbihwqk", model.recoveryPointId());
    }
}
