// 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/datamigration/armdatamigration/v2"
)

func unmarshalCommandPropertiesClassification(rawMsg json.RawMessage) (armdatamigration.CommandPropertiesClassification, 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 armdatamigration.CommandPropertiesClassification
	switch m["commandType"] {
	case string(armdatamigration.CommandTypeMigrateSQLServerAzureDbSQLMiComplete):
		b = &armdatamigration.MigrateMISyncCompleteCommandProperties{}
	case string(armdatamigration.CommandTypeMigrateSyncCompleteDatabase):
		b = &armdatamigration.MigrateSyncCompleteCommandProperties{}
	case string(armdatamigration.CommandTypeCancel):
		b = &armdatamigration.MongoDbCancelCommand{}
	case string(armdatamigration.CommandTypeFinish):
		b = &armdatamigration.MongoDbFinishCommand{}
	case string(armdatamigration.CommandTypeRestart):
		b = &armdatamigration.MongoDbRestartCommand{}
	default:
		b = &armdatamigration.CommandProperties{}
	}
	if err := json.Unmarshal(rawMsg, b); err != nil {
		return nil, err
	}
	return b, nil
}
