// 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.fluent.models.DeletedBackupInstanceResourceInner;
import com.azure.resourcemanager.dataprotection.models.DeletedBackupInstance;
import com.azure.resourcemanager.dataprotection.models.DeletedBackupInstanceResourceList;
import com.azure.resourcemanager.dataprotection.models.ValidationType;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class DeletedBackupInstanceResourceListTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DeletedBackupInstanceResourceList model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"friendlyName\":\"ppg\",\"currentProtectionState\":\"ProtectionError\",\"provisioningState\":\"nyiropuhpi\",\"validationType\":\"DeepValidation\",\"objectType\":\"ylgqgitxmedjvcsl\"},\"id\":\"qwwncw\",\"name\":\"zhxgktrmgucn\",\"type\":\"pkteo\"},{\"properties\":{\"friendlyName\":\"pt\",\"currentProtectionState\":\"SoftDeleted\",\"provisioningState\":\"b\",\"validationType\":\"DeepValidation\",\"objectType\":\"op\"},\"id\":\"qrhhu\",\"name\":\"opppcqeq\",\"type\":\"ol\"}],\"nextLink\":\"ahzxctobgbk\"}")
                .toObject(DeletedBackupInstanceResourceList.class);
        Assertions.assertEquals("ahzxctobgbk", model.nextLink());
        Assertions.assertEquals("ppg", model.value().get(0).properties().friendlyName());
        Assertions.assertEquals(ValidationType.DEEP_VALIDATION, model.value().get(0).properties().validationType());
        Assertions.assertEquals("ylgqgitxmedjvcsl", model.value().get(0).properties().objectType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DeletedBackupInstanceResourceList model =
            new DeletedBackupInstanceResourceList()
                .withNextLink("ahzxctobgbk")
                .withValue(
                    Arrays
                        .asList(
                            new DeletedBackupInstanceResourceInner()
                                .withProperties(
                                    new DeletedBackupInstance()
                                        .withFriendlyName("ppg")
                                        .withValidationType(ValidationType.DEEP_VALIDATION)
                                        .withObjectType("ylgqgitxmedjvcsl")),
                            new DeletedBackupInstanceResourceInner()
                                .withProperties(
                                    new DeletedBackupInstance()
                                        .withFriendlyName("pt")
                                        .withValidationType(ValidationType.DEEP_VALIDATION)
                                        .withObjectType("op"))));
        model = BinaryData.fromObject(model).toObject(DeletedBackupInstanceResourceList.class);
        Assertions.assertEquals("ahzxctobgbk", model.nextLink());
        Assertions.assertEquals("ppg", model.value().get(0).properties().friendlyName());
        Assertions.assertEquals(ValidationType.DEEP_VALIDATION, model.value().get(0).properties().validationType());
        Assertions.assertEquals("ylgqgitxmedjvcsl", model.value().get(0).properties().objectType());
    }
}
