// 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 armcloudhealth

import "encoding/json"

func unmarshalAuthenticationSettingPropertiesClassification(rawMsg json.RawMessage) (AuthenticationSettingPropertiesClassification, 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 AuthenticationSettingPropertiesClassification
	switch m["authenticationKind"] {
	case string(AuthenticationKindManagedIdentity):
		b = &ManagedIdentityAuthenticationSettingProperties{}
	default:
		b = &AuthenticationSettingProperties{}
	}
	if err := json.Unmarshal(rawMsg, b); err != nil {
		return nil, err
	}
	return b, nil
}

func unmarshalSignalDefinitionPropertiesClassification(rawMsg json.RawMessage) (SignalDefinitionPropertiesClassification, 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 SignalDefinitionPropertiesClassification
	switch m["signalKind"] {
	case string(SignalKindAzureResourceMetric):
		b = &ResourceMetricSignalDefinitionProperties{}
	case string(SignalKindLogAnalyticsQuery):
		b = &LogAnalyticsQuerySignalDefinitionProperties{}
	case string(SignalKindPrometheusMetricsQuery):
		b = &PrometheusMetricsSignalDefinitionProperties{}
	default:
		b = &SignalDefinitionProperties{}
	}
	if err := json.Unmarshal(rawMsg, b); err != nil {
		return nil, err
	}
	return b, nil
}
