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

public final class AzureWorkloadAutoProtectionIntentTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AzureWorkloadAutoProtectionIntent model =
            BinaryData
                .fromString(
                    "{\"protectionIntentItemType\":\"AzureWorkloadAutoProtectionIntent\",\"backupManagementType\":\"AzureSql\",\"sourceResourceId\":\"fulopmjnlexwhcb\",\"itemId\":\"ibkeph\",\"policyId\":\"uerct\",\"protectionState\":\"NotProtected\"}")
                .toObject(AzureWorkloadAutoProtectionIntent.class);
        Assertions.assertEquals(BackupManagementType.AZURE_SQL, model.backupManagementType());
        Assertions.assertEquals("fulopmjnlexwhcb", model.sourceResourceId());
        Assertions.assertEquals("ibkeph", model.itemId());
        Assertions.assertEquals("uerct", model.policyId());
        Assertions.assertEquals(ProtectionStatus.NOT_PROTECTED, model.protectionState());
    }

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