// 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.RecoveryOption;
import com.azure.resourcemanager.dataprotection.models.RestoreFilesTargetInfo;
import com.azure.resourcemanager.dataprotection.models.RestoreTargetLocationType;
import com.azure.resourcemanager.dataprotection.models.TargetDetails;
import org.junit.jupiter.api.Assertions;

public final class RestoreFilesTargetInfoTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        RestoreFilesTargetInfo model =
            BinaryData
                .fromString(
                    "{\"objectType\":\"RestoreFilesTargetInfo\",\"targetDetails\":{\"filePrefix\":\"uhbxvvy\",\"restoreTargetLocationType\":\"AzureFiles\",\"url\":\"s\",\"targetResourceArmId\":\"byrqufeg\"},\"recoveryOption\":\"FailIfExists\",\"restoreLocation\":\"wz\"}")
                .toObject(RestoreFilesTargetInfo.class);
        Assertions.assertEquals(RecoveryOption.FAIL_IF_EXISTS, model.recoveryOption());
        Assertions.assertEquals("wz", model.restoreLocation());
        Assertions.assertEquals("uhbxvvy", model.targetDetails().filePrefix());
        Assertions
            .assertEquals(RestoreTargetLocationType.AZURE_FILES, model.targetDetails().restoreTargetLocationType());
        Assertions.assertEquals("s", model.targetDetails().url());
        Assertions.assertEquals("byrqufeg", model.targetDetails().targetResourceArmId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        RestoreFilesTargetInfo model =
            new RestoreFilesTargetInfo()
                .withRecoveryOption(RecoveryOption.FAIL_IF_EXISTS)
                .withRestoreLocation("wz")
                .withTargetDetails(
                    new TargetDetails()
                        .withFilePrefix("uhbxvvy")
                        .withRestoreTargetLocationType(RestoreTargetLocationType.AZURE_FILES)
                        .withUrl("s")
                        .withTargetResourceArmId("byrqufeg"));
        model = BinaryData.fromObject(model).toObject(RestoreFilesTargetInfo.class);
        Assertions.assertEquals(RecoveryOption.FAIL_IF_EXISTS, model.recoveryOption());
        Assertions.assertEquals("wz", model.restoreLocation());
        Assertions.assertEquals("uhbxvvy", model.targetDetails().filePrefix());
        Assertions
            .assertEquals(RestoreTargetLocationType.AZURE_FILES, model.targetDetails().restoreTargetLocationType());
        Assertions.assertEquals("s", model.targetDetails().url());
        Assertions.assertEquals("byrqufeg", model.targetDetails().targetResourceArmId());
    }
}
