// 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.AzureWorkloadContainerAutoProtectionIntent;
import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus;
import org.junit.jupiter.api.Assertions;

public final class AzureWorkloadContainerAutoProtectionIntentTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AzureWorkloadContainerAutoProtectionIntent model =
            BinaryData
                .fromString(
                    "{\"protectionIntentItemType\":\"AzureWorkloadContainerAutoProtectionIntent\",\"backupManagementType\":\"AzureSql\",\"sourceResourceId\":\"ee\",\"itemId\":\"lgvvpaseksgbu\",\"policyId\":\"ntuygdhgaqipir\",\"protectionState\":\"ProtectionFailed\"}")
                .toObject(AzureWorkloadContainerAutoProtectionIntent.class);
        Assertions.assertEquals(BackupManagementType.AZURE_SQL, model.backupManagementType());
        Assertions.assertEquals("ee", model.sourceResourceId());
        Assertions.assertEquals("lgvvpaseksgbu", model.itemId());
        Assertions.assertEquals("ntuygdhgaqipir", model.policyId());
        Assertions.assertEquals(ProtectionStatus.PROTECTION_FAILED, model.protectionState());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AzureWorkloadContainerAutoProtectionIntent model =
            new AzureWorkloadContainerAutoProtectionIntent()
                .withBackupManagementType(BackupManagementType.AZURE_SQL)
                .withSourceResourceId("ee")
                .withItemId("lgvvpaseksgbu")
                .withPolicyId("ntuygdhgaqipir")
                .withProtectionState(ProtectionStatus.PROTECTION_FAILED);
        model = BinaryData.fromObject(model).toObject(AzureWorkloadContainerAutoProtectionIntent.class);
        Assertions.assertEquals(BackupManagementType.AZURE_SQL, model.backupManagementType());
        Assertions.assertEquals("ee", model.sourceResourceId());
        Assertions.assertEquals("lgvvpaseksgbu", model.itemId());
        Assertions.assertEquals("ntuygdhgaqipir", model.policyId());
        Assertions.assertEquals(ProtectionStatus.PROTECTION_FAILED, model.protectionState());
    }
}
