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

public final class AzureWorkloadSqlAutoProtectionIntentTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AzureWorkloadSqlAutoProtectionIntent model =
            BinaryData
                .fromString(
                    "{\"protectionIntentItemType\":\"AzureWorkloadSQLAutoProtectionIntent\",\"workloadItemType\":\"SAPAseSystem\",\"backupManagementType\":\"Invalid\",\"sourceResourceId\":\"pbrlcyrduczkgofx\",\"itemId\":\"srucvcrrpcjtt\",\"policyId\":\"t\",\"protectionState\":\"Protecting\"}")
                .toObject(AzureWorkloadSqlAutoProtectionIntent.class);
        Assertions.assertEquals(BackupManagementType.INVALID, model.backupManagementType());
        Assertions.assertEquals("pbrlcyrduczkgofx", model.sourceResourceId());
        Assertions.assertEquals("srucvcrrpcjtt", model.itemId());
        Assertions.assertEquals("t", model.policyId());
        Assertions.assertEquals(ProtectionStatus.PROTECTING, model.protectionState());
        Assertions.assertEquals(WorkloadItemType.SAPASE_SYSTEM, model.workloadItemType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AzureWorkloadSqlAutoProtectionIntent model =
            new AzureWorkloadSqlAutoProtectionIntent()
                .withBackupManagementType(BackupManagementType.INVALID)
                .withSourceResourceId("pbrlcyrduczkgofx")
                .withItemId("srucvcrrpcjtt")
                .withPolicyId("t")
                .withProtectionState(ProtectionStatus.PROTECTING)
                .withWorkloadItemType(WorkloadItemType.SAPASE_SYSTEM);
        model = BinaryData.fromObject(model).toObject(AzureWorkloadSqlAutoProtectionIntent.class);
        Assertions.assertEquals(BackupManagementType.INVALID, model.backupManagementType());
        Assertions.assertEquals("pbrlcyrduczkgofx", model.sourceResourceId());
        Assertions.assertEquals("srucvcrrpcjtt", model.itemId());
        Assertions.assertEquals("t", model.policyId());
        Assertions.assertEquals(ProtectionStatus.PROTECTING, model.protectionState());
        Assertions.assertEquals(WorkloadItemType.SAPASE_SYSTEM, model.workloadItemType());
    }
}
