// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

package fake

import (
	"encoding/json"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4"
)

func unmarshalFeatureSupportRequestClassification(rawMsg json.RawMessage) (armrecoveryservicesbackup.FeatureSupportRequestClassification, error) {
	if rawMsg == nil || string(rawMsg) == "null" {
		return nil, nil
	}
	var m map[string]any
	if err := json.Unmarshal(rawMsg, &m); err != nil {
		return nil, err
	}
	var b armrecoveryservicesbackup.FeatureSupportRequestClassification
	switch m["featureType"] {
	case "AzureBackupGoals":
		b = &armrecoveryservicesbackup.AzureBackupGoalFeatureSupportRequest{}
	case "AzureVMResourceBackup":
		b = &armrecoveryservicesbackup.AzureVMResourceFeatureSupportRequest{}
	default:
		b = &armrecoveryservicesbackup.FeatureSupportRequest{}
	}
	if err := json.Unmarshal(rawMsg, b); err != nil {
		return nil, err
	}
	return b, nil
}

func unmarshalFetchTieringCostInfoRequestClassification(rawMsg json.RawMessage) (armrecoveryservicesbackup.FetchTieringCostInfoRequestClassification, error) {
	if rawMsg == nil || string(rawMsg) == "null" {
		return nil, nil
	}
	var m map[string]any
	if err := json.Unmarshal(rawMsg, &m); err != nil {
		return nil, err
	}
	var b armrecoveryservicesbackup.FetchTieringCostInfoRequestClassification
	switch m["objectType"] {
	case "FetchTieringCostInfoForRehydrationRequest":
		b = &armrecoveryservicesbackup.FetchTieringCostInfoForRehydrationRequest{}
	case "FetchTieringCostSavingsInfoForPolicyRequest":
		b = &armrecoveryservicesbackup.FetchTieringCostSavingsInfoForPolicyRequest{}
	case "FetchTieringCostSavingsInfoForProtectedItemRequest":
		b = &armrecoveryservicesbackup.FetchTieringCostSavingsInfoForProtectedItemRequest{}
	case "FetchTieringCostSavingsInfoForVaultRequest":
		b = &armrecoveryservicesbackup.FetchTieringCostSavingsInfoForVaultRequest{}
	default:
		b = &armrecoveryservicesbackup.FetchTieringCostInfoRequest{}
	}
	if err := json.Unmarshal(rawMsg, b); err != nil {
		return nil, err
	}
	return b, nil
}
