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

package com.azure.resourcemanager.recoveryservicesbackup.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardOperationDetail;
import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardProxyBase;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ResourceGuardProxyBaseTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ResourceGuardProxyBase model =
            BinaryData
                .fromString(
                    "{\"resourceGuardResourceId\":\"xfrdd\",\"resourceGuardOperationDetails\":[{\"vaultCriticalOperation\":\"tizzronasxif\",\"defaultResourceRequest\":\"zq\"},{\"vaultCriticalOperation\":\"hftwesgog\",\"defaultResourceRequest\":\"honnxkrlgnyhmos\"}],\"lastUpdatedTime\":\"kkgthr\",\"description\":\"hxjbdhqxvc\"}")
                .toObject(ResourceGuardProxyBase.class);
        Assertions.assertEquals("xfrdd", model.resourceGuardResourceId());
        Assertions.assertEquals("tizzronasxif", model.resourceGuardOperationDetails().get(0).vaultCriticalOperation());
        Assertions.assertEquals("zq", model.resourceGuardOperationDetails().get(0).defaultResourceRequest());
        Assertions.assertEquals("kkgthr", model.lastUpdatedTime());
        Assertions.assertEquals("hxjbdhqxvc", model.description());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ResourceGuardProxyBase model =
            new ResourceGuardProxyBase()
                .withResourceGuardResourceId("xfrdd")
                .withResourceGuardOperationDetails(
                    Arrays
                        .asList(
                            new ResourceGuardOperationDetail()
                                .withVaultCriticalOperation("tizzronasxif")
                                .withDefaultResourceRequest("zq"),
                            new ResourceGuardOperationDetail()
                                .withVaultCriticalOperation("hftwesgog")
                                .withDefaultResourceRequest("honnxkrlgnyhmos")))
                .withLastUpdatedTime("kkgthr")
                .withDescription("hxjbdhqxvc");
        model = BinaryData.fromObject(model).toObject(ResourceGuardProxyBase.class);
        Assertions.assertEquals("xfrdd", model.resourceGuardResourceId());
        Assertions.assertEquals("tizzronasxif", model.resourceGuardOperationDetails().get(0).vaultCriticalOperation());
        Assertions.assertEquals("zq", model.resourceGuardOperationDetails().get(0).defaultResourceRequest());
        Assertions.assertEquals("kkgthr", model.lastUpdatedTime());
        Assertions.assertEquals("hxjbdhqxvc", model.description());
    }
}
