// 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) Go Code Generator. DO NOT EDIT.

package armstoragemover

import "encoding/json"

func unmarshalEndpointBasePropertiesClassification(rawMsg json.RawMessage) (EndpointBasePropertiesClassification, 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 EndpointBasePropertiesClassification
	switch m["endpointType"] {
	case string(EndpointTypeAzureStorageBlobContainer):
		b = &AzureStorageBlobContainerEndpointProperties{}
	case string(EndpointTypeNfsMount):
		b = &NfsMountEndpointProperties{}
	case string(EndpointTypeAzureStorageSmbFileShare):
		b = &AzureStorageSmbFileShareEndpointProperties{}
	case string(EndpointTypeSmbMount):
		b = &SmbMountEndpointProperties{}
	case string(EndpointTypeAzureStorageNfsFileShare):
		b = &AzureStorageNfsFileShareEndpointProperties{}
	case string(EndpointTypeAzureMultiCloudConnector):
		b = &AzureMultiCloudConnectorEndpointProperties{}
	default:
		b = &EndpointBaseProperties{}
	}
	if err := json.Unmarshal(rawMsg, b); err != nil {
		return nil, err
	}
	return b, nil
}

func unmarshalEndpointBaseUpdatePropertiesClassification(rawMsg json.RawMessage) (EndpointBaseUpdatePropertiesClassification, 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 EndpointBaseUpdatePropertiesClassification
	switch m["endpointType"] {
	case string(EndpointTypeAzureStorageBlobContainer):
		b = &AzureStorageBlobContainerEndpointUpdateProperties{}
	case string(EndpointTypeNfsMount):
		b = &NfsMountEndpointUpdateProperties{}
	case string(EndpointTypeAzureStorageSmbFileShare):
		b = &AzureStorageSmbFileShareEndpointUpdateProperties{}
	case string(EndpointTypeAzureStorageNfsFileShare):
		b = &AzureStorageNfsFileShareEndpointUpdateProperties{}
	case string(EndpointTypeAzureMultiCloudConnector):
		b = &AzureMultiCloudConnectorEndpointUpdateProperties{}
	case string(EndpointTypeSmbMount):
		b = &SmbMountEndpointUpdateProperties{}
	default:
		b = &EndpointBaseUpdateProperties{}
	}
	if err := json.Unmarshal(rawMsg, b); err != nil {
		return nil, err
	}
	return b, nil
}
