// Code generated by azure-service-operator-codegen. DO NOT EDIT.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package v1api20220615

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/insights/v1api20220615/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/insights/v1api20220615/storage"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/configmaps"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/core"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/secrets"
	"github.com/rotisserie/eris"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"sigs.k8s.io/controller-runtime/pkg/conversion"
)

// +kubebuilder:object:root=true
// +kubebuilder:resource:categories={azure,insights}
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="Severity",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].severity"
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message"
// Generator information:
// - Generated from: /monitor/resource-manager/Microsoft.Insights/stable/2022-06-15/scheduledQueryRule_API.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}
type ScheduledQueryRule struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              ScheduledQueryRule_Spec   `json:"spec,omitempty"`
	Status            ScheduledQueryRule_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &ScheduledQueryRule{}

// GetConditions returns the conditions of the resource
func (rule *ScheduledQueryRule) GetConditions() conditions.Conditions {
	return rule.Status.Conditions
}

// SetConditions sets the conditions on the resource status
func (rule *ScheduledQueryRule) SetConditions(conditions conditions.Conditions) {
	rule.Status.Conditions = conditions
}

var _ conversion.Convertible = &ScheduledQueryRule{}

// ConvertFrom populates our ScheduledQueryRule from the provided hub ScheduledQueryRule
func (rule *ScheduledQueryRule) ConvertFrom(hub conversion.Hub) error {
	source, ok := hub.(*storage.ScheduledQueryRule)
	if !ok {
		return fmt.Errorf("expected insights/v1api20220615/storage/ScheduledQueryRule but received %T instead", hub)
	}

	return rule.AssignProperties_From_ScheduledQueryRule(source)
}

// ConvertTo populates the provided hub ScheduledQueryRule from our ScheduledQueryRule
func (rule *ScheduledQueryRule) ConvertTo(hub conversion.Hub) error {
	destination, ok := hub.(*storage.ScheduledQueryRule)
	if !ok {
		return fmt.Errorf("expected insights/v1api20220615/storage/ScheduledQueryRule but received %T instead", hub)
	}

	return rule.AssignProperties_To_ScheduledQueryRule(destination)
}

var _ configmaps.Exporter = &ScheduledQueryRule{}

// ConfigMapDestinationExpressions returns the Spec.OperatorSpec.ConfigMapExpressions property
func (rule *ScheduledQueryRule) ConfigMapDestinationExpressions() []*core.DestinationExpression {
	if rule.Spec.OperatorSpec == nil {
		return nil
	}
	return rule.Spec.OperatorSpec.ConfigMapExpressions
}

var _ secrets.Exporter = &ScheduledQueryRule{}

// SecretDestinationExpressions returns the Spec.OperatorSpec.SecretExpressions property
func (rule *ScheduledQueryRule) SecretDestinationExpressions() []*core.DestinationExpression {
	if rule.Spec.OperatorSpec == nil {
		return nil
	}
	return rule.Spec.OperatorSpec.SecretExpressions
}

var _ genruntime.ImportableResource = &ScheduledQueryRule{}

// InitializeSpec initializes the spec for this resource from the given status
func (rule *ScheduledQueryRule) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*ScheduledQueryRule_STATUS); ok {
		return rule.Spec.Initialize_From_ScheduledQueryRule_STATUS(s)
	}

	return fmt.Errorf("expected Status of type ScheduledQueryRule_STATUS but received %T instead", status)
}

var _ genruntime.KubernetesResource = &ScheduledQueryRule{}

// AzureName returns the Azure name of the resource
func (rule *ScheduledQueryRule) AzureName() string {
	return rule.Spec.AzureName
}

// GetAPIVersion returns the ARM API version of the resource. This is always "2022-06-15"
func (rule ScheduledQueryRule) GetAPIVersion() string {
	return "2022-06-15"
}

// GetResourceScope returns the scope of the resource
func (rule *ScheduledQueryRule) GetResourceScope() genruntime.ResourceScope {
	return genruntime.ResourceScopeResourceGroup
}

// GetSpec returns the specification of this resource
func (rule *ScheduledQueryRule) GetSpec() genruntime.ConvertibleSpec {
	return &rule.Spec
}

// GetStatus returns the status of this resource
func (rule *ScheduledQueryRule) GetStatus() genruntime.ConvertibleStatus {
	return &rule.Status
}

// GetSupportedOperations returns the operations supported by the resource
func (rule *ScheduledQueryRule) GetSupportedOperations() []genruntime.ResourceOperation {
	return []genruntime.ResourceOperation{
		genruntime.ResourceOperationDelete,
		genruntime.ResourceOperationGet,
		genruntime.ResourceOperationPut,
	}
}

// GetType returns the ARM Type of the resource. This is always "Microsoft.Insights/scheduledQueryRules"
func (rule *ScheduledQueryRule) GetType() string {
	return "Microsoft.Insights/scheduledQueryRules"
}

// NewEmptyStatus returns a new empty (blank) status
func (rule *ScheduledQueryRule) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &ScheduledQueryRule_STATUS{}
}

// Owner returns the ResourceReference of the owner
func (rule *ScheduledQueryRule) Owner() *genruntime.ResourceReference {
	if rule.Spec.Owner == nil {
		return nil
	}

	group, kind := genruntime.LookupOwnerGroupKind(rule.Spec)
	return rule.Spec.Owner.AsResourceReference(group, kind)
}

// SetStatus sets the status of this resource
func (rule *ScheduledQueryRule) SetStatus(status genruntime.ConvertibleStatus) error {
	// If we have exactly the right type of status, assign it
	if st, ok := status.(*ScheduledQueryRule_STATUS); ok {
		rule.Status = *st
		return nil
	}

	// Convert status to required version
	var st ScheduledQueryRule_STATUS
	err := status.ConvertStatusTo(&st)
	if err != nil {
		return eris.Wrap(err, "failed to convert status")
	}

	rule.Status = st
	return nil
}

// AssignProperties_From_ScheduledQueryRule populates our ScheduledQueryRule from the provided source ScheduledQueryRule
func (rule *ScheduledQueryRule) AssignProperties_From_ScheduledQueryRule(source *storage.ScheduledQueryRule) error {

	// ObjectMeta
	rule.ObjectMeta = *source.ObjectMeta.DeepCopy()

	// Spec
	var spec ScheduledQueryRule_Spec
	err := spec.AssignProperties_From_ScheduledQueryRule_Spec(&source.Spec)
	if err != nil {
		return eris.Wrap(err, "calling AssignProperties_From_ScheduledQueryRule_Spec() to populate field Spec")
	}
	rule.Spec = spec

	// Status
	var status ScheduledQueryRule_STATUS
	err = status.AssignProperties_From_ScheduledQueryRule_STATUS(&source.Status)
	if err != nil {
		return eris.Wrap(err, "calling AssignProperties_From_ScheduledQueryRule_STATUS() to populate field Status")
	}
	rule.Status = status

	// No error
	return nil
}

// AssignProperties_To_ScheduledQueryRule populates the provided destination ScheduledQueryRule from our ScheduledQueryRule
func (rule *ScheduledQueryRule) AssignProperties_To_ScheduledQueryRule(destination *storage.ScheduledQueryRule) error {

	// ObjectMeta
	destination.ObjectMeta = *rule.ObjectMeta.DeepCopy()

	// Spec
	var spec storage.ScheduledQueryRule_Spec
	err := rule.Spec.AssignProperties_To_ScheduledQueryRule_Spec(&spec)
	if err != nil {
		return eris.Wrap(err, "calling AssignProperties_To_ScheduledQueryRule_Spec() to populate field Spec")
	}
	destination.Spec = spec

	// Status
	var status storage.ScheduledQueryRule_STATUS
	err = rule.Status.AssignProperties_To_ScheduledQueryRule_STATUS(&status)
	if err != nil {
		return eris.Wrap(err, "calling AssignProperties_To_ScheduledQueryRule_STATUS() to populate field Status")
	}
	destination.Status = status

	// No error
	return nil
}

// OriginalGVK returns a GroupValueKind for the original API version used to create the resource
func (rule *ScheduledQueryRule) OriginalGVK() *schema.GroupVersionKind {
	return &schema.GroupVersionKind{
		Group:   GroupVersion.Group,
		Version: rule.Spec.OriginalVersion(),
		Kind:    "ScheduledQueryRule",
	}
}

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /monitor/resource-manager/Microsoft.Insights/stable/2022-06-15/scheduledQueryRule_API.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}
type ScheduledQueryRuleList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []ScheduledQueryRule `json:"items"`
}

// +kubebuilder:validation:Enum={"2022-06-15"}
type APIVersion string

const APIVersion_Value = APIVersion("2022-06-15")

type ScheduledQueryRule_Spec struct {
	// Actions: Actions to invoke when the alert fires.
	Actions *Actions `json:"actions,omitempty"`

	// AutoMitigate: The flag that indicates whether the alert should be automatically resolved or not. The default is true.
	// Relevant only for rules of the kind LogAlert.
	AutoMitigate *bool `json:"autoMitigate,omitempty"`

	// +kubebuilder:validation:Pattern="^[^#<>%&:\\?/{}*]{1,260}$"
	// AzureName: The name of the resource in Azure. This is often the same as the name of the resource in Kubernetes but it
	// doesn't have to be.
	AzureName string `json:"azureName,omitempty"`

	// CheckWorkspaceAlertsStorageConfigured: The flag which indicates whether this scheduled query rule should be stored in
	// the customer's storage. The default is false. Relevant only for rules of the kind LogAlert.
	CheckWorkspaceAlertsStorageConfigured *bool `json:"checkWorkspaceAlertsStorageConfigured,omitempty"`

	// Criteria: The rule criteria that defines the conditions of the scheduled query rule.
	Criteria *ScheduledQueryRuleCriteria `json:"criteria,omitempty"`

	// Description: The description of the scheduled query rule.
	Description *string `json:"description,omitempty"`

	// DisplayName: The display name of the alert rule
	DisplayName *string `json:"displayName,omitempty"`

	// Enabled: The flag which indicates whether this scheduled query rule is enabled. Value should be true or false
	Enabled *bool `json:"enabled,omitempty"`

	// EvaluationFrequency: How often the scheduled query rule is evaluated represented in ISO 8601 duration format. Relevant
	// and required only for rules of the kind LogAlert.
	EvaluationFrequency *string `json:"evaluationFrequency,omitempty"`

	// Kind: Indicates the type of scheduled query rule. The default is LogAlert.
	Kind *ScheduledQueryRule_Kind_Spec `json:"kind,omitempty"`

	// +kubebuilder:validation:Required
	// Location: The geo-location where the resource lives
	Location *string `json:"location,omitempty"`

	// MuteActionsDuration: Mute actions for the chosen period of time (in ISO 8601 duration format) after the alert is fired.
	// Relevant only for rules of the kind LogAlert.
	MuteActionsDuration *string `json:"muteActionsDuration,omitempty"`

	// OperatorSpec: The specification for configuring operator behavior. This field is interpreted by the operator and not
	// passed directly to Azure
	OperatorSpec *ScheduledQueryRuleOperatorSpec `json:"operatorSpec,omitempty"`

	// OverrideQueryTimeRange: If specified then overrides the query time range (default is
	// WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert.
	OverrideQueryTimeRange *string `json:"overrideQueryTimeRange,omitempty"`

	// +kubebuilder:validation:Required
	// Owner: The owner of the resource. The owner controls where the resource goes when it is deployed. The owner also
	// controls the resources lifecycle. When the owner is deleted the resource will also be deleted. Owner is expected to be a
	// reference to a resources.azure.com/ResourceGroup resource
	Owner *genruntime.KnownResourceReference `group:"resources.azure.com" json:"owner,omitempty" kind:"ResourceGroup"`

	// ScopesReferences: The list of resource id's that this scheduled query rule is scoped to.
	ScopesReferences []genruntime.ResourceReference `armReference:"Scopes" json:"scopesReferences,omitempty"`

	// Severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only
	// for rules of the kind LogAlert.
	Severity *ScheduledQueryRuleProperties_Severity `json:"severity,omitempty"`

	// SkipQueryValidation: The flag which indicates whether the provided query should be validated or not. The default is
	// false. Relevant only for rules of the kind LogAlert.
	SkipQueryValidation *bool `json:"skipQueryValidation,omitempty"`

	// Tags: Resource tags.
	Tags map[string]string `json:"tags,omitempty"`

	// TargetResourceTypes: List of resource type of the target resource(s) on which the alert is created/updated. For example
	// if the scope is a resource group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a different alert
	// will be fired for each virtual machine in the resource group which meet the alert criteria. Relevant only for rules of
	// the kind LogAlert
	TargetResourceTypes []string `json:"targetResourceTypes,omitempty"`

	// WindowSize: The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size).
	// Relevant and required only for rules of the kind LogAlert.
	WindowSize *string `json:"windowSize,omitempty"`
}

var _ genruntime.ARMTransformer = &ScheduledQueryRule_Spec{}

// ConvertToARM converts from a Kubernetes CRD object to an ARM object
func (rule *ScheduledQueryRule_Spec) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {
	if rule == nil {
		return nil, nil
	}
	result := &arm.ScheduledQueryRule_Spec{}

	// Set property "Kind":
	if rule.Kind != nil {
		var temp string
		temp = string(*rule.Kind)
		kind := arm.ScheduledQueryRule_Kind_Spec(temp)
		result.Kind = &kind
	}

	// Set property "Location":
	if rule.Location != nil {
		location := *rule.Location
		result.Location = &location
	}

	// Set property "Name":
	result.Name = resolved.Name

	// Set property "Properties":
	if rule.Actions != nil ||
		rule.AutoMitigate != nil ||
		rule.CheckWorkspaceAlertsStorageConfigured != nil ||
		rule.Criteria != nil ||
		rule.Description != nil ||
		rule.DisplayName != nil ||
		rule.Enabled != nil ||
		rule.EvaluationFrequency != nil ||
		rule.MuteActionsDuration != nil ||
		rule.OverrideQueryTimeRange != nil ||
		rule.ScopesReferences != nil ||
		rule.Severity != nil ||
		rule.SkipQueryValidation != nil ||
		rule.TargetResourceTypes != nil ||
		rule.WindowSize != nil {
		result.Properties = &arm.ScheduledQueryRuleProperties{}
	}
	if rule.Actions != nil {
		actions_ARM, err := rule.Actions.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		actions := *actions_ARM.(*arm.Actions)
		result.Properties.Actions = &actions
	}
	if rule.AutoMitigate != nil {
		autoMitigate := *rule.AutoMitigate
		result.Properties.AutoMitigate = &autoMitigate
	}
	if rule.CheckWorkspaceAlertsStorageConfigured != nil {
		checkWorkspaceAlertsStorageConfigured := *rule.CheckWorkspaceAlertsStorageConfigured
		result.Properties.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured
	}
	if rule.Criteria != nil {
		criteria_ARM, err := rule.Criteria.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		criteria := *criteria_ARM.(*arm.ScheduledQueryRuleCriteria)
		result.Properties.Criteria = &criteria
	}
	if rule.Description != nil {
		description := *rule.Description
		result.Properties.Description = &description
	}
	if rule.DisplayName != nil {
		displayName := *rule.DisplayName
		result.Properties.DisplayName = &displayName
	}
	if rule.Enabled != nil {
		enabled := *rule.Enabled
		result.Properties.Enabled = &enabled
	}
	if rule.EvaluationFrequency != nil {
		evaluationFrequency := *rule.EvaluationFrequency
		result.Properties.EvaluationFrequency = &evaluationFrequency
	}
	if rule.MuteActionsDuration != nil {
		muteActionsDuration := *rule.MuteActionsDuration
		result.Properties.MuteActionsDuration = &muteActionsDuration
	}
	if rule.OverrideQueryTimeRange != nil {
		overrideQueryTimeRange := *rule.OverrideQueryTimeRange
		result.Properties.OverrideQueryTimeRange = &overrideQueryTimeRange
	}
	for _, item := range rule.ScopesReferences {
		itemARMID, err := resolved.ResolvedReferences.Lookup(item)
		if err != nil {
			return nil, err
		}
		result.Properties.Scopes = append(result.Properties.Scopes, itemARMID)
	}
	if rule.Severity != nil {
		var temp int
		temp = int(*rule.Severity)
		severity := arm.ScheduledQueryRuleProperties_Severity(temp)
		result.Properties.Severity = &severity
	}
	if rule.SkipQueryValidation != nil {
		skipQueryValidation := *rule.SkipQueryValidation
		result.Properties.SkipQueryValidation = &skipQueryValidation
	}
	for _, item := range rule.TargetResourceTypes {
		result.Properties.TargetResourceTypes = append(result.Properties.TargetResourceTypes, item)
	}
	if rule.WindowSize != nil {
		windowSize := *rule.WindowSize
		result.Properties.WindowSize = &windowSize
	}

	// Set property "Tags":
	if rule.Tags != nil {
		result.Tags = make(map[string]string, len(rule.Tags))
		for key, value := range rule.Tags {
			result.Tags[key] = value
		}
	}
	return result, nil
}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (rule *ScheduledQueryRule_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.ScheduledQueryRule_Spec{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (rule *ScheduledQueryRule_Spec) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.ScheduledQueryRule_Spec)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.ScheduledQueryRule_Spec, got %T", armInput)
	}

	// Set property "Actions":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Actions != nil {
			var actions1 Actions
			err := actions1.PopulateFromARM(owner, *typedInput.Properties.Actions)
			if err != nil {
				return err
			}
			actions := actions1
			rule.Actions = &actions
		}
	}

	// Set property "AutoMitigate":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AutoMitigate != nil {
			autoMitigate := *typedInput.Properties.AutoMitigate
			rule.AutoMitigate = &autoMitigate
		}
	}

	// Set property "AzureName":
	rule.SetAzureName(genruntime.ExtractKubernetesResourceNameFromARMName(typedInput.Name))

	// Set property "CheckWorkspaceAlertsStorageConfigured":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CheckWorkspaceAlertsStorageConfigured != nil {
			checkWorkspaceAlertsStorageConfigured := *typedInput.Properties.CheckWorkspaceAlertsStorageConfigured
			rule.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured
		}
	}

	// Set property "Criteria":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Criteria != nil {
			var criteria1 ScheduledQueryRuleCriteria
			err := criteria1.PopulateFromARM(owner, *typedInput.Properties.Criteria)
			if err != nil {
				return err
			}
			criteria := criteria1
			rule.Criteria = &criteria
		}
	}

	// Set property "Description":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Description != nil {
			description := *typedInput.Properties.Description
			rule.Description = &description
		}
	}

	// Set property "DisplayName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DisplayName != nil {
			displayName := *typedInput.Properties.DisplayName
			rule.DisplayName = &displayName
		}
	}

	// Set property "Enabled":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Enabled != nil {
			enabled := *typedInput.Properties.Enabled
			rule.Enabled = &enabled
		}
	}

	// Set property "EvaluationFrequency":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EvaluationFrequency != nil {
			evaluationFrequency := *typedInput.Properties.EvaluationFrequency
			rule.EvaluationFrequency = &evaluationFrequency
		}
	}

	// Set property "Kind":
	if typedInput.Kind != nil {
		var temp string
		temp = string(*typedInput.Kind)
		kind := ScheduledQueryRule_Kind_Spec(temp)
		rule.Kind = &kind
	}

	// Set property "Location":
	if typedInput.Location != nil {
		location := *typedInput.Location
		rule.Location = &location
	}

	// Set property "MuteActionsDuration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MuteActionsDuration != nil {
			muteActionsDuration := *typedInput.Properties.MuteActionsDuration
			rule.MuteActionsDuration = &muteActionsDuration
		}
	}

	// no assignment for property "OperatorSpec"

	// Set property "OverrideQueryTimeRange":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.OverrideQueryTimeRange != nil {
			overrideQueryTimeRange := *typedInput.Properties.OverrideQueryTimeRange
			rule.OverrideQueryTimeRange = &overrideQueryTimeRange
		}
	}

	// Set property "Owner":
	rule.Owner = &genruntime.KnownResourceReference{
		Name:  owner.Name,
		ARMID: owner.ARMID,
	}

	// no assignment for property "ScopesReferences"

	// Set property "Severity":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Severity != nil {
			var temp int
			temp = int(*typedInput.Properties.Severity)
			severity := ScheduledQueryRuleProperties_Severity(temp)
			rule.Severity = &severity
		}
	}

	// Set property "SkipQueryValidation":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SkipQueryValidation != nil {
			skipQueryValidation := *typedInput.Properties.SkipQueryValidation
			rule.SkipQueryValidation = &skipQueryValidation
		}
	}

	// Set property "Tags":
	if typedInput.Tags != nil {
		rule.Tags = make(map[string]string, len(typedInput.Tags))
		for key, value := range typedInput.Tags {
			rule.Tags[key] = value
		}
	}

	// Set property "TargetResourceTypes":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.TargetResourceTypes {
			rule.TargetResourceTypes = append(rule.TargetResourceTypes, item)
		}
	}

	// Set property "WindowSize":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.WindowSize != nil {
			windowSize := *typedInput.Properties.WindowSize
			rule.WindowSize = &windowSize
		}
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &ScheduledQueryRule_Spec{}

// ConvertSpecFrom populates our ScheduledQueryRule_Spec from the provided source
func (rule *ScheduledQueryRule_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error {
	src, ok := source.(*storage.ScheduledQueryRule_Spec)
	if ok {
		// Populate our instance from source
		return rule.AssignProperties_From_ScheduledQueryRule_Spec(src)
	}

	// Convert to an intermediate form
	src = &storage.ScheduledQueryRule_Spec{}
	err := src.ConvertSpecFrom(source)
	if err != nil {
		return eris.Wrap(err, "initial step of conversion in ConvertSpecFrom()")
	}

	// Update our instance from src
	err = rule.AssignProperties_From_ScheduledQueryRule_Spec(src)
	if err != nil {
		return eris.Wrap(err, "final step of conversion in ConvertSpecFrom()")
	}

	return nil
}

// ConvertSpecTo populates the provided destination from our ScheduledQueryRule_Spec
func (rule *ScheduledQueryRule_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error {
	dst, ok := destination.(*storage.ScheduledQueryRule_Spec)
	if ok {
		// Populate destination from our instance
		return rule.AssignProperties_To_ScheduledQueryRule_Spec(dst)
	}

	// Convert to an intermediate form
	dst = &storage.ScheduledQueryRule_Spec{}
	err := rule.AssignProperties_To_ScheduledQueryRule_Spec(dst)
	if err != nil {
		return eris.Wrap(err, "initial step of conversion in ConvertSpecTo()")
	}

	// Update dst from our instance
	err = dst.ConvertSpecTo(destination)
	if err != nil {
		return eris.Wrap(err, "final step of conversion in ConvertSpecTo()")
	}

	return nil
}

// AssignProperties_From_ScheduledQueryRule_Spec populates our ScheduledQueryRule_Spec from the provided source ScheduledQueryRule_Spec
func (rule *ScheduledQueryRule_Spec) AssignProperties_From_ScheduledQueryRule_Spec(source *storage.ScheduledQueryRule_Spec) error {

	// Actions
	if source.Actions != nil {
		var action Actions
		err := action.AssignProperties_From_Actions(source.Actions)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Actions() to populate field Actions")
		}
		rule.Actions = &action
	} else {
		rule.Actions = nil
	}

	// AutoMitigate
	if source.AutoMitigate != nil {
		autoMitigate := *source.AutoMitigate
		rule.AutoMitigate = &autoMitigate
	} else {
		rule.AutoMitigate = nil
	}

	// AzureName
	rule.AzureName = source.AzureName

	// CheckWorkspaceAlertsStorageConfigured
	if source.CheckWorkspaceAlertsStorageConfigured != nil {
		checkWorkspaceAlertsStorageConfigured := *source.CheckWorkspaceAlertsStorageConfigured
		rule.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured
	} else {
		rule.CheckWorkspaceAlertsStorageConfigured = nil
	}

	// Criteria
	if source.Criteria != nil {
		var criterion ScheduledQueryRuleCriteria
		err := criterion.AssignProperties_From_ScheduledQueryRuleCriteria(source.Criteria)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ScheduledQueryRuleCriteria() to populate field Criteria")
		}
		rule.Criteria = &criterion
	} else {
		rule.Criteria = nil
	}

	// Description
	rule.Description = genruntime.ClonePointerToString(source.Description)

	// DisplayName
	rule.DisplayName = genruntime.ClonePointerToString(source.DisplayName)

	// Enabled
	if source.Enabled != nil {
		enabled := *source.Enabled
		rule.Enabled = &enabled
	} else {
		rule.Enabled = nil
	}

	// EvaluationFrequency
	rule.EvaluationFrequency = genruntime.ClonePointerToString(source.EvaluationFrequency)

	// Kind
	if source.Kind != nil {
		kind := *source.Kind
		kindTemp := genruntime.ToEnum(kind, scheduledQueryRule_Kind_Spec_Values)
		rule.Kind = &kindTemp
	} else {
		rule.Kind = nil
	}

	// Location
	rule.Location = genruntime.ClonePointerToString(source.Location)

	// MuteActionsDuration
	rule.MuteActionsDuration = genruntime.ClonePointerToString(source.MuteActionsDuration)

	// OperatorSpec
	if source.OperatorSpec != nil {
		var operatorSpec ScheduledQueryRuleOperatorSpec
		err := operatorSpec.AssignProperties_From_ScheduledQueryRuleOperatorSpec(source.OperatorSpec)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ScheduledQueryRuleOperatorSpec() to populate field OperatorSpec")
		}
		rule.OperatorSpec = &operatorSpec
	} else {
		rule.OperatorSpec = nil
	}

	// OverrideQueryTimeRange
	rule.OverrideQueryTimeRange = genruntime.ClonePointerToString(source.OverrideQueryTimeRange)

	// Owner
	if source.Owner != nil {
		owner := source.Owner.Copy()
		rule.Owner = &owner
	} else {
		rule.Owner = nil
	}

	// ScopesReferences
	if source.ScopesReferences != nil {
		scopesReferenceList := make([]genruntime.ResourceReference, len(source.ScopesReferences))
		for scopesReferenceIndex, scopesReferenceItem := range source.ScopesReferences {
			scopesReferenceList[scopesReferenceIndex] = scopesReferenceItem.Copy()
		}
		rule.ScopesReferences = scopesReferenceList
	} else {
		rule.ScopesReferences = nil
	}

	// Severity
	if source.Severity != nil {
		severity := ScheduledQueryRuleProperties_Severity(*source.Severity)
		rule.Severity = &severity
	} else {
		rule.Severity = nil
	}

	// SkipQueryValidation
	if source.SkipQueryValidation != nil {
		skipQueryValidation := *source.SkipQueryValidation
		rule.SkipQueryValidation = &skipQueryValidation
	} else {
		rule.SkipQueryValidation = nil
	}

	// Tags
	rule.Tags = genruntime.CloneMapOfStringToString(source.Tags)

	// TargetResourceTypes
	rule.TargetResourceTypes = genruntime.CloneSliceOfString(source.TargetResourceTypes)

	// WindowSize
	rule.WindowSize = genruntime.ClonePointerToString(source.WindowSize)

	// No error
	return nil
}

// AssignProperties_To_ScheduledQueryRule_Spec populates the provided destination ScheduledQueryRule_Spec from our ScheduledQueryRule_Spec
func (rule *ScheduledQueryRule_Spec) AssignProperties_To_ScheduledQueryRule_Spec(destination *storage.ScheduledQueryRule_Spec) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// Actions
	if rule.Actions != nil {
		var action storage.Actions
		err := rule.Actions.AssignProperties_To_Actions(&action)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Actions() to populate field Actions")
		}
		destination.Actions = &action
	} else {
		destination.Actions = nil
	}

	// AutoMitigate
	if rule.AutoMitigate != nil {
		autoMitigate := *rule.AutoMitigate
		destination.AutoMitigate = &autoMitigate
	} else {
		destination.AutoMitigate = nil
	}

	// AzureName
	destination.AzureName = rule.AzureName

	// CheckWorkspaceAlertsStorageConfigured
	if rule.CheckWorkspaceAlertsStorageConfigured != nil {
		checkWorkspaceAlertsStorageConfigured := *rule.CheckWorkspaceAlertsStorageConfigured
		destination.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured
	} else {
		destination.CheckWorkspaceAlertsStorageConfigured = nil
	}

	// Criteria
	if rule.Criteria != nil {
		var criterion storage.ScheduledQueryRuleCriteria
		err := rule.Criteria.AssignProperties_To_ScheduledQueryRuleCriteria(&criterion)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ScheduledQueryRuleCriteria() to populate field Criteria")
		}
		destination.Criteria = &criterion
	} else {
		destination.Criteria = nil
	}

	// Description
	destination.Description = genruntime.ClonePointerToString(rule.Description)

	// DisplayName
	destination.DisplayName = genruntime.ClonePointerToString(rule.DisplayName)

	// Enabled
	if rule.Enabled != nil {
		enabled := *rule.Enabled
		destination.Enabled = &enabled
	} else {
		destination.Enabled = nil
	}

	// EvaluationFrequency
	destination.EvaluationFrequency = genruntime.ClonePointerToString(rule.EvaluationFrequency)

	// Kind
	if rule.Kind != nil {
		kind := string(*rule.Kind)
		destination.Kind = &kind
	} else {
		destination.Kind = nil
	}

	// Location
	destination.Location = genruntime.ClonePointerToString(rule.Location)

	// MuteActionsDuration
	destination.MuteActionsDuration = genruntime.ClonePointerToString(rule.MuteActionsDuration)

	// OperatorSpec
	if rule.OperatorSpec != nil {
		var operatorSpec storage.ScheduledQueryRuleOperatorSpec
		err := rule.OperatorSpec.AssignProperties_To_ScheduledQueryRuleOperatorSpec(&operatorSpec)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ScheduledQueryRuleOperatorSpec() to populate field OperatorSpec")
		}
		destination.OperatorSpec = &operatorSpec
	} else {
		destination.OperatorSpec = nil
	}

	// OriginalVersion
	destination.OriginalVersion = rule.OriginalVersion()

	// OverrideQueryTimeRange
	destination.OverrideQueryTimeRange = genruntime.ClonePointerToString(rule.OverrideQueryTimeRange)

	// Owner
	if rule.Owner != nil {
		owner := rule.Owner.Copy()
		destination.Owner = &owner
	} else {
		destination.Owner = nil
	}

	// ScopesReferences
	if rule.ScopesReferences != nil {
		scopesReferenceList := make([]genruntime.ResourceReference, len(rule.ScopesReferences))
		for scopesReferenceIndex, scopesReferenceItem := range rule.ScopesReferences {
			scopesReferenceList[scopesReferenceIndex] = scopesReferenceItem.Copy()
		}
		destination.ScopesReferences = scopesReferenceList
	} else {
		destination.ScopesReferences = nil
	}

	// Severity
	if rule.Severity != nil {
		severity := int(*rule.Severity)
		destination.Severity = &severity
	} else {
		destination.Severity = nil
	}

	// SkipQueryValidation
	if rule.SkipQueryValidation != nil {
		skipQueryValidation := *rule.SkipQueryValidation
		destination.SkipQueryValidation = &skipQueryValidation
	} else {
		destination.SkipQueryValidation = nil
	}

	// Tags
	destination.Tags = genruntime.CloneMapOfStringToString(rule.Tags)

	// TargetResourceTypes
	destination.TargetResourceTypes = genruntime.CloneSliceOfString(rule.TargetResourceTypes)

	// WindowSize
	destination.WindowSize = genruntime.ClonePointerToString(rule.WindowSize)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// No error
	return nil
}

// Initialize_From_ScheduledQueryRule_STATUS populates our ScheduledQueryRule_Spec from the provided source ScheduledQueryRule_STATUS
func (rule *ScheduledQueryRule_Spec) Initialize_From_ScheduledQueryRule_STATUS(source *ScheduledQueryRule_STATUS) error {

	// Actions
	if source.Actions != nil {
		var action Actions
		err := action.Initialize_From_Actions_STATUS(source.Actions)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_Actions_STATUS() to populate field Actions")
		}
		rule.Actions = &action
	} else {
		rule.Actions = nil
	}

	// AutoMitigate
	if source.AutoMitigate != nil {
		autoMitigate := *source.AutoMitigate
		rule.AutoMitigate = &autoMitigate
	} else {
		rule.AutoMitigate = nil
	}

	// CheckWorkspaceAlertsStorageConfigured
	if source.CheckWorkspaceAlertsStorageConfigured != nil {
		checkWorkspaceAlertsStorageConfigured := *source.CheckWorkspaceAlertsStorageConfigured
		rule.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured
	} else {
		rule.CheckWorkspaceAlertsStorageConfigured = nil
	}

	// Criteria
	if source.Criteria != nil {
		var criterion ScheduledQueryRuleCriteria
		err := criterion.Initialize_From_ScheduledQueryRuleCriteria_STATUS(source.Criteria)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_ScheduledQueryRuleCriteria_STATUS() to populate field Criteria")
		}
		rule.Criteria = &criterion
	} else {
		rule.Criteria = nil
	}

	// Description
	rule.Description = genruntime.ClonePointerToString(source.Description)

	// DisplayName
	rule.DisplayName = genruntime.ClonePointerToString(source.DisplayName)

	// Enabled
	if source.Enabled != nil {
		enabled := *source.Enabled
		rule.Enabled = &enabled
	} else {
		rule.Enabled = nil
	}

	// EvaluationFrequency
	rule.EvaluationFrequency = genruntime.ClonePointerToString(source.EvaluationFrequency)

	// Kind
	if source.Kind != nil {
		kind := genruntime.ToEnum(string(*source.Kind), scheduledQueryRule_Kind_Spec_Values)
		rule.Kind = &kind
	} else {
		rule.Kind = nil
	}

	// Location
	rule.Location = genruntime.ClonePointerToString(source.Location)

	// MuteActionsDuration
	rule.MuteActionsDuration = genruntime.ClonePointerToString(source.MuteActionsDuration)

	// OverrideQueryTimeRange
	rule.OverrideQueryTimeRange = genruntime.ClonePointerToString(source.OverrideQueryTimeRange)

	// Severity
	if source.Severity != nil {
		severity := ScheduledQueryRuleProperties_Severity(*source.Severity)
		rule.Severity = &severity
	} else {
		rule.Severity = nil
	}

	// SkipQueryValidation
	if source.SkipQueryValidation != nil {
		skipQueryValidation := *source.SkipQueryValidation
		rule.SkipQueryValidation = &skipQueryValidation
	} else {
		rule.SkipQueryValidation = nil
	}

	// Tags
	rule.Tags = genruntime.CloneMapOfStringToString(source.Tags)

	// TargetResourceTypes
	rule.TargetResourceTypes = genruntime.CloneSliceOfString(source.TargetResourceTypes)

	// WindowSize
	rule.WindowSize = genruntime.ClonePointerToString(source.WindowSize)

	// No error
	return nil
}

// OriginalVersion returns the original API version used to create the resource.
func (rule *ScheduledQueryRule_Spec) OriginalVersion() string {
	return GroupVersion.Version
}

// SetAzureName sets the Azure name of the resource
func (rule *ScheduledQueryRule_Spec) SetAzureName(azureName string) { rule.AzureName = azureName }

type ScheduledQueryRule_STATUS struct {
	// Actions: Actions to invoke when the alert fires.
	Actions *Actions_STATUS `json:"actions,omitempty"`

	// AutoMitigate: The flag that indicates whether the alert should be automatically resolved or not. The default is true.
	// Relevant only for rules of the kind LogAlert.
	AutoMitigate *bool `json:"autoMitigate,omitempty"`

	// CheckWorkspaceAlertsStorageConfigured: The flag which indicates whether this scheduled query rule should be stored in
	// the customer's storage. The default is false. Relevant only for rules of the kind LogAlert.
	CheckWorkspaceAlertsStorageConfigured *bool `json:"checkWorkspaceAlertsStorageConfigured,omitempty"`

	// Conditions: The observed state of the resource
	Conditions []conditions.Condition `json:"conditions,omitempty"`

	// CreatedWithApiVersion: The api-version used when creating this alert rule
	CreatedWithApiVersion *string `json:"createdWithApiVersion,omitempty"`

	// Criteria: The rule criteria that defines the conditions of the scheduled query rule.
	Criteria *ScheduledQueryRuleCriteria_STATUS `json:"criteria,omitempty"`

	// Description: The description of the scheduled query rule.
	Description *string `json:"description,omitempty"`

	// DisplayName: The display name of the alert rule
	DisplayName *string `json:"displayName,omitempty"`

	// Enabled: The flag which indicates whether this scheduled query rule is enabled. Value should be true or false
	Enabled *bool `json:"enabled,omitempty"`

	// Etag: The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per
	// the normal etag convention.  Entity tags are used for comparing two or more entities from the same requested resource.
	// HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and
	// If-Range (section 14.27) header fields.
	Etag *string `json:"etag,omitempty"`

	// EvaluationFrequency: How often the scheduled query rule is evaluated represented in ISO 8601 duration format. Relevant
	// and required only for rules of the kind LogAlert.
	EvaluationFrequency *string `json:"evaluationFrequency,omitempty"`

	// Id: Fully qualified resource ID for the resource. Ex -
	// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	Id *string `json:"id,omitempty"`

	// IsLegacyLogAnalyticsRule: True if alert rule is legacy Log Analytic rule
	IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty"`

	// IsWorkspaceAlertsStorageConfigured: The flag which indicates whether this scheduled query rule has been configured to be
	// stored in the customer's storage. The default is false.
	IsWorkspaceAlertsStorageConfigured *bool `json:"isWorkspaceAlertsStorageConfigured,omitempty"`

	// Kind: Indicates the type of scheduled query rule. The default is LogAlert.
	Kind *ScheduledQueryRule_Kind_STATUS `json:"kind,omitempty"`

	// Location: The geo-location where the resource lives
	Location *string `json:"location,omitempty"`

	// MuteActionsDuration: Mute actions for the chosen period of time (in ISO 8601 duration format) after the alert is fired.
	// Relevant only for rules of the kind LogAlert.
	MuteActionsDuration *string `json:"muteActionsDuration,omitempty"`

	// Name: The name of the resource
	Name *string `json:"name,omitempty"`

	// OverrideQueryTimeRange: If specified then overrides the query time range (default is
	// WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert.
	OverrideQueryTimeRange *string `json:"overrideQueryTimeRange,omitempty"`

	// Scopes: The list of resource id's that this scheduled query rule is scoped to.
	Scopes []string `json:"scopes,omitempty"`

	// Severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only
	// for rules of the kind LogAlert.
	Severity *ScheduledQueryRuleProperties_Severity_STATUS `json:"severity,omitempty"`

	// SkipQueryValidation: The flag which indicates whether the provided query should be validated or not. The default is
	// false. Relevant only for rules of the kind LogAlert.
	SkipQueryValidation *bool `json:"skipQueryValidation,omitempty"`

	// SystemData: SystemData of ScheduledQueryRule.
	SystemData *SystemData_STATUS `json:"systemData,omitempty"`

	// Tags: Resource tags.
	Tags map[string]string `json:"tags,omitempty"`

	// TargetResourceTypes: List of resource type of the target resource(s) on which the alert is created/updated. For example
	// if the scope is a resource group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a different alert
	// will be fired for each virtual machine in the resource group which meet the alert criteria. Relevant only for rules of
	// the kind LogAlert
	TargetResourceTypes []string `json:"targetResourceTypes,omitempty"`

	// Type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string `json:"type,omitempty"`

	// WindowSize: The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size).
	// Relevant and required only for rules of the kind LogAlert.
	WindowSize *string `json:"windowSize,omitempty"`
}

var _ genruntime.ConvertibleStatus = &ScheduledQueryRule_STATUS{}

// ConvertStatusFrom populates our ScheduledQueryRule_STATUS from the provided source
func (rule *ScheduledQueryRule_STATUS) ConvertStatusFrom(source genruntime.ConvertibleStatus) error {
	src, ok := source.(*storage.ScheduledQueryRule_STATUS)
	if ok {
		// Populate our instance from source
		return rule.AssignProperties_From_ScheduledQueryRule_STATUS(src)
	}

	// Convert to an intermediate form
	src = &storage.ScheduledQueryRule_STATUS{}
	err := src.ConvertStatusFrom(source)
	if err != nil {
		return eris.Wrap(err, "initial step of conversion in ConvertStatusFrom()")
	}

	// Update our instance from src
	err = rule.AssignProperties_From_ScheduledQueryRule_STATUS(src)
	if err != nil {
		return eris.Wrap(err, "final step of conversion in ConvertStatusFrom()")
	}

	return nil
}

// ConvertStatusTo populates the provided destination from our ScheduledQueryRule_STATUS
func (rule *ScheduledQueryRule_STATUS) ConvertStatusTo(destination genruntime.ConvertibleStatus) error {
	dst, ok := destination.(*storage.ScheduledQueryRule_STATUS)
	if ok {
		// Populate destination from our instance
		return rule.AssignProperties_To_ScheduledQueryRule_STATUS(dst)
	}

	// Convert to an intermediate form
	dst = &storage.ScheduledQueryRule_STATUS{}
	err := rule.AssignProperties_To_ScheduledQueryRule_STATUS(dst)
	if err != nil {
		return eris.Wrap(err, "initial step of conversion in ConvertStatusTo()")
	}

	// Update dst from our instance
	err = dst.ConvertStatusTo(destination)
	if err != nil {
		return eris.Wrap(err, "final step of conversion in ConvertStatusTo()")
	}

	return nil
}

var _ genruntime.FromARMConverter = &ScheduledQueryRule_STATUS{}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (rule *ScheduledQueryRule_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.ScheduledQueryRule_STATUS{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (rule *ScheduledQueryRule_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.ScheduledQueryRule_STATUS)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.ScheduledQueryRule_STATUS, got %T", armInput)
	}

	// Set property "Actions":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Actions != nil {
			var actions1 Actions_STATUS
			err := actions1.PopulateFromARM(owner, *typedInput.Properties.Actions)
			if err != nil {
				return err
			}
			actions := actions1
			rule.Actions = &actions
		}
	}

	// Set property "AutoMitigate":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AutoMitigate != nil {
			autoMitigate := *typedInput.Properties.AutoMitigate
			rule.AutoMitigate = &autoMitigate
		}
	}

	// Set property "CheckWorkspaceAlertsStorageConfigured":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CheckWorkspaceAlertsStorageConfigured != nil {
			checkWorkspaceAlertsStorageConfigured := *typedInput.Properties.CheckWorkspaceAlertsStorageConfigured
			rule.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured
		}
	}

	// no assignment for property "Conditions"

	// Set property "CreatedWithApiVersion":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CreatedWithApiVersion != nil {
			createdWithApiVersion := *typedInput.Properties.CreatedWithApiVersion
			rule.CreatedWithApiVersion = &createdWithApiVersion
		}
	}

	// Set property "Criteria":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Criteria != nil {
			var criteria1 ScheduledQueryRuleCriteria_STATUS
			err := criteria1.PopulateFromARM(owner, *typedInput.Properties.Criteria)
			if err != nil {
				return err
			}
			criteria := criteria1
			rule.Criteria = &criteria
		}
	}

	// Set property "Description":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Description != nil {
			description := *typedInput.Properties.Description
			rule.Description = &description
		}
	}

	// Set property "DisplayName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DisplayName != nil {
			displayName := *typedInput.Properties.DisplayName
			rule.DisplayName = &displayName
		}
	}

	// Set property "Enabled":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Enabled != nil {
			enabled := *typedInput.Properties.Enabled
			rule.Enabled = &enabled
		}
	}

	// Set property "Etag":
	if typedInput.Etag != nil {
		etag := *typedInput.Etag
		rule.Etag = &etag
	}

	// Set property "EvaluationFrequency":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EvaluationFrequency != nil {
			evaluationFrequency := *typedInput.Properties.EvaluationFrequency
			rule.EvaluationFrequency = &evaluationFrequency
		}
	}

	// Set property "Id":
	if typedInput.Id != nil {
		id := *typedInput.Id
		rule.Id = &id
	}

	// Set property "IsLegacyLogAnalyticsRule":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IsLegacyLogAnalyticsRule != nil {
			isLegacyLogAnalyticsRule := *typedInput.Properties.IsLegacyLogAnalyticsRule
			rule.IsLegacyLogAnalyticsRule = &isLegacyLogAnalyticsRule
		}
	}

	// Set property "IsWorkspaceAlertsStorageConfigured":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IsWorkspaceAlertsStorageConfigured != nil {
			isWorkspaceAlertsStorageConfigured := *typedInput.Properties.IsWorkspaceAlertsStorageConfigured
			rule.IsWorkspaceAlertsStorageConfigured = &isWorkspaceAlertsStorageConfigured
		}
	}

	// Set property "Kind":
	if typedInput.Kind != nil {
		var temp string
		temp = string(*typedInput.Kind)
		kind := ScheduledQueryRule_Kind_STATUS(temp)
		rule.Kind = &kind
	}

	// Set property "Location":
	if typedInput.Location != nil {
		location := *typedInput.Location
		rule.Location = &location
	}

	// Set property "MuteActionsDuration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MuteActionsDuration != nil {
			muteActionsDuration := *typedInput.Properties.MuteActionsDuration
			rule.MuteActionsDuration = &muteActionsDuration
		}
	}

	// Set property "Name":
	if typedInput.Name != nil {
		name := *typedInput.Name
		rule.Name = &name
	}

	// Set property "OverrideQueryTimeRange":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.OverrideQueryTimeRange != nil {
			overrideQueryTimeRange := *typedInput.Properties.OverrideQueryTimeRange
			rule.OverrideQueryTimeRange = &overrideQueryTimeRange
		}
	}

	// Set property "Scopes":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.Scopes {
			rule.Scopes = append(rule.Scopes, item)
		}
	}

	// Set property "Severity":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Severity != nil {
			var temp int
			temp = int(*typedInput.Properties.Severity)
			severity := ScheduledQueryRuleProperties_Severity_STATUS(temp)
			rule.Severity = &severity
		}
	}

	// Set property "SkipQueryValidation":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SkipQueryValidation != nil {
			skipQueryValidation := *typedInput.Properties.SkipQueryValidation
			rule.SkipQueryValidation = &skipQueryValidation
		}
	}

	// Set property "SystemData":
	if typedInput.SystemData != nil {
		var systemData1 SystemData_STATUS
		err := systemData1.PopulateFromARM(owner, *typedInput.SystemData)
		if err != nil {
			return err
		}
		systemData := systemData1
		rule.SystemData = &systemData
	}

	// Set property "Tags":
	if typedInput.Tags != nil {
		rule.Tags = make(map[string]string, len(typedInput.Tags))
		for key, value := range typedInput.Tags {
			rule.Tags[key] = value
		}
	}

	// Set property "TargetResourceTypes":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.TargetResourceTypes {
			rule.TargetResourceTypes = append(rule.TargetResourceTypes, item)
		}
	}

	// Set property "Type":
	if typedInput.Type != nil {
		typeVar := *typedInput.Type
		rule.Type = &typeVar
	}

	// Set property "WindowSize":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.WindowSize != nil {
			windowSize := *typedInput.Properties.WindowSize
			rule.WindowSize = &windowSize
		}
	}

	// No error
	return nil
}

// AssignProperties_From_ScheduledQueryRule_STATUS populates our ScheduledQueryRule_STATUS from the provided source ScheduledQueryRule_STATUS
func (rule *ScheduledQueryRule_STATUS) AssignProperties_From_ScheduledQueryRule_STATUS(source *storage.ScheduledQueryRule_STATUS) error {

	// Actions
	if source.Actions != nil {
		var action Actions_STATUS
		err := action.AssignProperties_From_Actions_STATUS(source.Actions)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Actions_STATUS() to populate field Actions")
		}
		rule.Actions = &action
	} else {
		rule.Actions = nil
	}

	// AutoMitigate
	if source.AutoMitigate != nil {
		autoMitigate := *source.AutoMitigate
		rule.AutoMitigate = &autoMitigate
	} else {
		rule.AutoMitigate = nil
	}

	// CheckWorkspaceAlertsStorageConfigured
	if source.CheckWorkspaceAlertsStorageConfigured != nil {
		checkWorkspaceAlertsStorageConfigured := *source.CheckWorkspaceAlertsStorageConfigured
		rule.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured
	} else {
		rule.CheckWorkspaceAlertsStorageConfigured = nil
	}

	// Conditions
	rule.Conditions = genruntime.CloneSliceOfCondition(source.Conditions)

	// CreatedWithApiVersion
	rule.CreatedWithApiVersion = genruntime.ClonePointerToString(source.CreatedWithApiVersion)

	// Criteria
	if source.Criteria != nil {
		var criterion ScheduledQueryRuleCriteria_STATUS
		err := criterion.AssignProperties_From_ScheduledQueryRuleCriteria_STATUS(source.Criteria)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ScheduledQueryRuleCriteria_STATUS() to populate field Criteria")
		}
		rule.Criteria = &criterion
	} else {
		rule.Criteria = nil
	}

	// Description
	rule.Description = genruntime.ClonePointerToString(source.Description)

	// DisplayName
	rule.DisplayName = genruntime.ClonePointerToString(source.DisplayName)

	// Enabled
	if source.Enabled != nil {
		enabled := *source.Enabled
		rule.Enabled = &enabled
	} else {
		rule.Enabled = nil
	}

	// Etag
	rule.Etag = genruntime.ClonePointerToString(source.Etag)

	// EvaluationFrequency
	rule.EvaluationFrequency = genruntime.ClonePointerToString(source.EvaluationFrequency)

	// Id
	rule.Id = genruntime.ClonePointerToString(source.Id)

	// IsLegacyLogAnalyticsRule
	if source.IsLegacyLogAnalyticsRule != nil {
		isLegacyLogAnalyticsRule := *source.IsLegacyLogAnalyticsRule
		rule.IsLegacyLogAnalyticsRule = &isLegacyLogAnalyticsRule
	} else {
		rule.IsLegacyLogAnalyticsRule = nil
	}

	// IsWorkspaceAlertsStorageConfigured
	if source.IsWorkspaceAlertsStorageConfigured != nil {
		isWorkspaceAlertsStorageConfigured := *source.IsWorkspaceAlertsStorageConfigured
		rule.IsWorkspaceAlertsStorageConfigured = &isWorkspaceAlertsStorageConfigured
	} else {
		rule.IsWorkspaceAlertsStorageConfigured = nil
	}

	// Kind
	if source.Kind != nil {
		kind := *source.Kind
		kindTemp := genruntime.ToEnum(kind, scheduledQueryRule_Kind_STATUS_Values)
		rule.Kind = &kindTemp
	} else {
		rule.Kind = nil
	}

	// Location
	rule.Location = genruntime.ClonePointerToString(source.Location)

	// MuteActionsDuration
	rule.MuteActionsDuration = genruntime.ClonePointerToString(source.MuteActionsDuration)

	// Name
	rule.Name = genruntime.ClonePointerToString(source.Name)

	// OverrideQueryTimeRange
	rule.OverrideQueryTimeRange = genruntime.ClonePointerToString(source.OverrideQueryTimeRange)

	// Scopes
	rule.Scopes = genruntime.CloneSliceOfString(source.Scopes)

	// Severity
	if source.Severity != nil {
		severity := ScheduledQueryRuleProperties_Severity_STATUS(*source.Severity)
		rule.Severity = &severity
	} else {
		rule.Severity = nil
	}

	// SkipQueryValidation
	if source.SkipQueryValidation != nil {
		skipQueryValidation := *source.SkipQueryValidation
		rule.SkipQueryValidation = &skipQueryValidation
	} else {
		rule.SkipQueryValidation = nil
	}

	// SystemData
	if source.SystemData != nil {
		var systemDatum SystemData_STATUS
		err := systemDatum.AssignProperties_From_SystemData_STATUS(source.SystemData)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SystemData_STATUS() to populate field SystemData")
		}
		rule.SystemData = &systemDatum
	} else {
		rule.SystemData = nil
	}

	// Tags
	rule.Tags = genruntime.CloneMapOfStringToString(source.Tags)

	// TargetResourceTypes
	rule.TargetResourceTypes = genruntime.CloneSliceOfString(source.TargetResourceTypes)

	// Type
	rule.Type = genruntime.ClonePointerToString(source.Type)

	// WindowSize
	rule.WindowSize = genruntime.ClonePointerToString(source.WindowSize)

	// No error
	return nil
}

// AssignProperties_To_ScheduledQueryRule_STATUS populates the provided destination ScheduledQueryRule_STATUS from our ScheduledQueryRule_STATUS
func (rule *ScheduledQueryRule_STATUS) AssignProperties_To_ScheduledQueryRule_STATUS(destination *storage.ScheduledQueryRule_STATUS) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// Actions
	if rule.Actions != nil {
		var action storage.Actions_STATUS
		err := rule.Actions.AssignProperties_To_Actions_STATUS(&action)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Actions_STATUS() to populate field Actions")
		}
		destination.Actions = &action
	} else {
		destination.Actions = nil
	}

	// AutoMitigate
	if rule.AutoMitigate != nil {
		autoMitigate := *rule.AutoMitigate
		destination.AutoMitigate = &autoMitigate
	} else {
		destination.AutoMitigate = nil
	}

	// CheckWorkspaceAlertsStorageConfigured
	if rule.CheckWorkspaceAlertsStorageConfigured != nil {
		checkWorkspaceAlertsStorageConfigured := *rule.CheckWorkspaceAlertsStorageConfigured
		destination.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured
	} else {
		destination.CheckWorkspaceAlertsStorageConfigured = nil
	}

	// Conditions
	destination.Conditions = genruntime.CloneSliceOfCondition(rule.Conditions)

	// CreatedWithApiVersion
	destination.CreatedWithApiVersion = genruntime.ClonePointerToString(rule.CreatedWithApiVersion)

	// Criteria
	if rule.Criteria != nil {
		var criterion storage.ScheduledQueryRuleCriteria_STATUS
		err := rule.Criteria.AssignProperties_To_ScheduledQueryRuleCriteria_STATUS(&criterion)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ScheduledQueryRuleCriteria_STATUS() to populate field Criteria")
		}
		destination.Criteria = &criterion
	} else {
		destination.Criteria = nil
	}

	// Description
	destination.Description = genruntime.ClonePointerToString(rule.Description)

	// DisplayName
	destination.DisplayName = genruntime.ClonePointerToString(rule.DisplayName)

	// Enabled
	if rule.Enabled != nil {
		enabled := *rule.Enabled
		destination.Enabled = &enabled
	} else {
		destination.Enabled = nil
	}

	// Etag
	destination.Etag = genruntime.ClonePointerToString(rule.Etag)

	// EvaluationFrequency
	destination.EvaluationFrequency = genruntime.ClonePointerToString(rule.EvaluationFrequency)

	// Id
	destination.Id = genruntime.ClonePointerToString(rule.Id)

	// IsLegacyLogAnalyticsRule
	if rule.IsLegacyLogAnalyticsRule != nil {
		isLegacyLogAnalyticsRule := *rule.IsLegacyLogAnalyticsRule
		destination.IsLegacyLogAnalyticsRule = &isLegacyLogAnalyticsRule
	} else {
		destination.IsLegacyLogAnalyticsRule = nil
	}

	// IsWorkspaceAlertsStorageConfigured
	if rule.IsWorkspaceAlertsStorageConfigured != nil {
		isWorkspaceAlertsStorageConfigured := *rule.IsWorkspaceAlertsStorageConfigured
		destination.IsWorkspaceAlertsStorageConfigured = &isWorkspaceAlertsStorageConfigured
	} else {
		destination.IsWorkspaceAlertsStorageConfigured = nil
	}

	// Kind
	if rule.Kind != nil {
		kind := string(*rule.Kind)
		destination.Kind = &kind
	} else {
		destination.Kind = nil
	}

	// Location
	destination.Location = genruntime.ClonePointerToString(rule.Location)

	// MuteActionsDuration
	destination.MuteActionsDuration = genruntime.ClonePointerToString(rule.MuteActionsDuration)

	// Name
	destination.Name = genruntime.ClonePointerToString(rule.Name)

	// OverrideQueryTimeRange
	destination.OverrideQueryTimeRange = genruntime.ClonePointerToString(rule.OverrideQueryTimeRange)

	// Scopes
	destination.Scopes = genruntime.CloneSliceOfString(rule.Scopes)

	// Severity
	if rule.Severity != nil {
		severity := int(*rule.Severity)
		destination.Severity = &severity
	} else {
		destination.Severity = nil
	}

	// SkipQueryValidation
	if rule.SkipQueryValidation != nil {
		skipQueryValidation := *rule.SkipQueryValidation
		destination.SkipQueryValidation = &skipQueryValidation
	} else {
		destination.SkipQueryValidation = nil
	}

	// SystemData
	if rule.SystemData != nil {
		var systemDatum storage.SystemData_STATUS
		err := rule.SystemData.AssignProperties_To_SystemData_STATUS(&systemDatum)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SystemData_STATUS() to populate field SystemData")
		}
		destination.SystemData = &systemDatum
	} else {
		destination.SystemData = nil
	}

	// Tags
	destination.Tags = genruntime.CloneMapOfStringToString(rule.Tags)

	// TargetResourceTypes
	destination.TargetResourceTypes = genruntime.CloneSliceOfString(rule.TargetResourceTypes)

	// Type
	destination.Type = genruntime.ClonePointerToString(rule.Type)

	// WindowSize
	destination.WindowSize = genruntime.ClonePointerToString(rule.WindowSize)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// No error
	return nil
}

// Actions to invoke when the alert fires.
type Actions struct {
	// ActionGroupsReferences: Action Group resource Ids to invoke when the alert fires.
	ActionGroupsReferences []genruntime.ResourceReference `armReference:"ActionGroups" json:"actionGroupsReferences,omitempty"`

	// CustomProperties: The properties of an alert payload.
	CustomProperties map[string]string `json:"customProperties,omitempty"`
}

var _ genruntime.ARMTransformer = &Actions{}

// ConvertToARM converts from a Kubernetes CRD object to an ARM object
func (actions *Actions) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {
	if actions == nil {
		return nil, nil
	}
	result := &arm.Actions{}

	// Set property "ActionGroups":
	for _, item := range actions.ActionGroupsReferences {
		itemARMID, err := resolved.ResolvedReferences.Lookup(item)
		if err != nil {
			return nil, err
		}
		result.ActionGroups = append(result.ActionGroups, itemARMID)
	}

	// Set property "CustomProperties":
	if actions.CustomProperties != nil {
		result.CustomProperties = make(map[string]string, len(actions.CustomProperties))
		for key, value := range actions.CustomProperties {
			result.CustomProperties[key] = value
		}
	}
	return result, nil
}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (actions *Actions) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.Actions{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (actions *Actions) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.Actions)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Actions, got %T", armInput)
	}

	// no assignment for property "ActionGroupsReferences"

	// Set property "CustomProperties":
	if typedInput.CustomProperties != nil {
		actions.CustomProperties = make(map[string]string, len(typedInput.CustomProperties))
		for key, value := range typedInput.CustomProperties {
			actions.CustomProperties[key] = value
		}
	}

	// No error
	return nil
}

// AssignProperties_From_Actions populates our Actions from the provided source Actions
func (actions *Actions) AssignProperties_From_Actions(source *storage.Actions) error {

	// ActionGroupsReferences
	if source.ActionGroupsReferences != nil {
		actionGroupsReferenceList := make([]genruntime.ResourceReference, len(source.ActionGroupsReferences))
		for actionGroupsReferenceIndex, actionGroupsReferenceItem := range source.ActionGroupsReferences {
			actionGroupsReferenceList[actionGroupsReferenceIndex] = actionGroupsReferenceItem.Copy()
		}
		actions.ActionGroupsReferences = actionGroupsReferenceList
	} else {
		actions.ActionGroupsReferences = nil
	}

	// CustomProperties
	actions.CustomProperties = genruntime.CloneMapOfStringToString(source.CustomProperties)

	// No error
	return nil
}

// AssignProperties_To_Actions populates the provided destination Actions from our Actions
func (actions *Actions) AssignProperties_To_Actions(destination *storage.Actions) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// ActionGroupsReferences
	if actions.ActionGroupsReferences != nil {
		actionGroupsReferenceList := make([]genruntime.ResourceReference, len(actions.ActionGroupsReferences))
		for actionGroupsReferenceIndex, actionGroupsReferenceItem := range actions.ActionGroupsReferences {
			actionGroupsReferenceList[actionGroupsReferenceIndex] = actionGroupsReferenceItem.Copy()
		}
		destination.ActionGroupsReferences = actionGroupsReferenceList
	} else {
		destination.ActionGroupsReferences = nil
	}

	// CustomProperties
	destination.CustomProperties = genruntime.CloneMapOfStringToString(actions.CustomProperties)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// No error
	return nil
}

// Initialize_From_Actions_STATUS populates our Actions from the provided source Actions_STATUS
func (actions *Actions) Initialize_From_Actions_STATUS(source *Actions_STATUS) error {

	// CustomProperties
	actions.CustomProperties = genruntime.CloneMapOfStringToString(source.CustomProperties)

	// No error
	return nil
}

// Actions to invoke when the alert fires.
type Actions_STATUS struct {
	// ActionGroups: Action Group resource Ids to invoke when the alert fires.
	ActionGroups []string `json:"actionGroups,omitempty"`

	// CustomProperties: The properties of an alert payload.
	CustomProperties map[string]string `json:"customProperties,omitempty"`
}

var _ genruntime.FromARMConverter = &Actions_STATUS{}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (actions *Actions_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.Actions_STATUS{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (actions *Actions_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.Actions_STATUS)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Actions_STATUS, got %T", armInput)
	}

	// Set property "ActionGroups":
	for _, item := range typedInput.ActionGroups {
		actions.ActionGroups = append(actions.ActionGroups, item)
	}

	// Set property "CustomProperties":
	if typedInput.CustomProperties != nil {
		actions.CustomProperties = make(map[string]string, len(typedInput.CustomProperties))
		for key, value := range typedInput.CustomProperties {
			actions.CustomProperties[key] = value
		}
	}

	// No error
	return nil
}

// AssignProperties_From_Actions_STATUS populates our Actions_STATUS from the provided source Actions_STATUS
func (actions *Actions_STATUS) AssignProperties_From_Actions_STATUS(source *storage.Actions_STATUS) error {

	// ActionGroups
	actions.ActionGroups = genruntime.CloneSliceOfString(source.ActionGroups)

	// CustomProperties
	actions.CustomProperties = genruntime.CloneMapOfStringToString(source.CustomProperties)

	// No error
	return nil
}

// AssignProperties_To_Actions_STATUS populates the provided destination Actions_STATUS from our Actions_STATUS
func (actions *Actions_STATUS) AssignProperties_To_Actions_STATUS(destination *storage.Actions_STATUS) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// ActionGroups
	destination.ActionGroups = genruntime.CloneSliceOfString(actions.ActionGroups)

	// CustomProperties
	destination.CustomProperties = genruntime.CloneMapOfStringToString(actions.CustomProperties)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"LogAlert","LogToMetric"}
type ScheduledQueryRule_Kind_Spec string

const (
	ScheduledQueryRule_Kind_Spec_LogAlert    = ScheduledQueryRule_Kind_Spec("LogAlert")
	ScheduledQueryRule_Kind_Spec_LogToMetric = ScheduledQueryRule_Kind_Spec("LogToMetric")
)

// Mapping from string to ScheduledQueryRule_Kind_Spec
var scheduledQueryRule_Kind_Spec_Values = map[string]ScheduledQueryRule_Kind_Spec{
	"logalert":    ScheduledQueryRule_Kind_Spec_LogAlert,
	"logtometric": ScheduledQueryRule_Kind_Spec_LogToMetric,
}

type ScheduledQueryRule_Kind_STATUS string

const (
	ScheduledQueryRule_Kind_STATUS_LogAlert    = ScheduledQueryRule_Kind_STATUS("LogAlert")
	ScheduledQueryRule_Kind_STATUS_LogToMetric = ScheduledQueryRule_Kind_STATUS("LogToMetric")
)

// Mapping from string to ScheduledQueryRule_Kind_STATUS
var scheduledQueryRule_Kind_STATUS_Values = map[string]ScheduledQueryRule_Kind_STATUS{
	"logalert":    ScheduledQueryRule_Kind_STATUS_LogAlert,
	"logtometric": ScheduledQueryRule_Kind_STATUS_LogToMetric,
}

// The rule criteria that defines the conditions of the scheduled query rule.
type ScheduledQueryRuleCriteria struct {
	// AllOf: A list of conditions to evaluate against the specified scopes
	AllOf []Condition `json:"allOf,omitempty"`
}

var _ genruntime.ARMTransformer = &ScheduledQueryRuleCriteria{}

// ConvertToARM converts from a Kubernetes CRD object to an ARM object
func (criteria *ScheduledQueryRuleCriteria) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {
	if criteria == nil {
		return nil, nil
	}
	result := &arm.ScheduledQueryRuleCriteria{}

	// Set property "AllOf":
	for _, item := range criteria.AllOf {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.AllOf = append(result.AllOf, *item_ARM.(*arm.Condition))
	}
	return result, nil
}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (criteria *ScheduledQueryRuleCriteria) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.ScheduledQueryRuleCriteria{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (criteria *ScheduledQueryRuleCriteria) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.ScheduledQueryRuleCriteria)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.ScheduledQueryRuleCriteria, got %T", armInput)
	}

	// Set property "AllOf":
	for _, item := range typedInput.AllOf {
		var item1 Condition
		err := item1.PopulateFromARM(owner, item)
		if err != nil {
			return err
		}
		criteria.AllOf = append(criteria.AllOf, item1)
	}

	// No error
	return nil
}

// AssignProperties_From_ScheduledQueryRuleCriteria populates our ScheduledQueryRuleCriteria from the provided source ScheduledQueryRuleCriteria
func (criteria *ScheduledQueryRuleCriteria) AssignProperties_From_ScheduledQueryRuleCriteria(source *storage.ScheduledQueryRuleCriteria) error {

	// AllOf
	if source.AllOf != nil {
		allOfList := make([]Condition, len(source.AllOf))
		for allOfIndex, allOfItem := range source.AllOf {
			var allOf Condition
			err := allOf.AssignProperties_From_Condition(&allOfItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_Condition() to populate field AllOf")
			}
			allOfList[allOfIndex] = allOf
		}
		criteria.AllOf = allOfList
	} else {
		criteria.AllOf = nil
	}

	// No error
	return nil
}

// AssignProperties_To_ScheduledQueryRuleCriteria populates the provided destination ScheduledQueryRuleCriteria from our ScheduledQueryRuleCriteria
func (criteria *ScheduledQueryRuleCriteria) AssignProperties_To_ScheduledQueryRuleCriteria(destination *storage.ScheduledQueryRuleCriteria) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// AllOf
	if criteria.AllOf != nil {
		allOfList := make([]storage.Condition, len(criteria.AllOf))
		for allOfIndex, allOfItem := range criteria.AllOf {
			var allOf storage.Condition
			err := allOfItem.AssignProperties_To_Condition(&allOf)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_Condition() to populate field AllOf")
			}
			allOfList[allOfIndex] = allOf
		}
		destination.AllOf = allOfList
	} else {
		destination.AllOf = nil
	}

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// No error
	return nil
}

// Initialize_From_ScheduledQueryRuleCriteria_STATUS populates our ScheduledQueryRuleCriteria from the provided source ScheduledQueryRuleCriteria_STATUS
func (criteria *ScheduledQueryRuleCriteria) Initialize_From_ScheduledQueryRuleCriteria_STATUS(source *ScheduledQueryRuleCriteria_STATUS) error {

	// AllOf
	if source.AllOf != nil {
		allOfList := make([]Condition, len(source.AllOf))
		for allOfIndex, allOfItem := range source.AllOf {
			var allOf Condition
			err := allOf.Initialize_From_Condition_STATUS(&allOfItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_Condition_STATUS() to populate field AllOf")
			}
			allOfList[allOfIndex] = allOf
		}
		criteria.AllOf = allOfList
	} else {
		criteria.AllOf = nil
	}

	// No error
	return nil
}

// The rule criteria that defines the conditions of the scheduled query rule.
type ScheduledQueryRuleCriteria_STATUS struct {
	// AllOf: A list of conditions to evaluate against the specified scopes
	AllOf []Condition_STATUS `json:"allOf,omitempty"`
}

var _ genruntime.FromARMConverter = &ScheduledQueryRuleCriteria_STATUS{}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (criteria *ScheduledQueryRuleCriteria_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.ScheduledQueryRuleCriteria_STATUS{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (criteria *ScheduledQueryRuleCriteria_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.ScheduledQueryRuleCriteria_STATUS)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.ScheduledQueryRuleCriteria_STATUS, got %T", armInput)
	}

	// Set property "AllOf":
	for _, item := range typedInput.AllOf {
		var item1 Condition_STATUS
		err := item1.PopulateFromARM(owner, item)
		if err != nil {
			return err
		}
		criteria.AllOf = append(criteria.AllOf, item1)
	}

	// No error
	return nil
}

// AssignProperties_From_ScheduledQueryRuleCriteria_STATUS populates our ScheduledQueryRuleCriteria_STATUS from the provided source ScheduledQueryRuleCriteria_STATUS
func (criteria *ScheduledQueryRuleCriteria_STATUS) AssignProperties_From_ScheduledQueryRuleCriteria_STATUS(source *storage.ScheduledQueryRuleCriteria_STATUS) error {

	// AllOf
	if source.AllOf != nil {
		allOfList := make([]Condition_STATUS, len(source.AllOf))
		for allOfIndex, allOfItem := range source.AllOf {
			var allOf Condition_STATUS
			err := allOf.AssignProperties_From_Condition_STATUS(&allOfItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_Condition_STATUS() to populate field AllOf")
			}
			allOfList[allOfIndex] = allOf
		}
		criteria.AllOf = allOfList
	} else {
		criteria.AllOf = nil
	}

	// No error
	return nil
}

// AssignProperties_To_ScheduledQueryRuleCriteria_STATUS populates the provided destination ScheduledQueryRuleCriteria_STATUS from our ScheduledQueryRuleCriteria_STATUS
func (criteria *ScheduledQueryRuleCriteria_STATUS) AssignProperties_To_ScheduledQueryRuleCriteria_STATUS(destination *storage.ScheduledQueryRuleCriteria_STATUS) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// AllOf
	if criteria.AllOf != nil {
		allOfList := make([]storage.Condition_STATUS, len(criteria.AllOf))
		for allOfIndex, allOfItem := range criteria.AllOf {
			var allOf storage.Condition_STATUS
			err := allOfItem.AssignProperties_To_Condition_STATUS(&allOf)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_Condition_STATUS() to populate field AllOf")
			}
			allOfList[allOfIndex] = allOf
		}
		destination.AllOf = allOfList
	} else {
		destination.AllOf = nil
	}

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// No error
	return nil
}

// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure
type ScheduledQueryRuleOperatorSpec struct {
	// ConfigMapExpressions: configures where to place operator written dynamic ConfigMaps (created with CEL expressions).
	ConfigMapExpressions []*core.DestinationExpression `json:"configMapExpressions,omitempty"`

	// SecretExpressions: configures where to place operator written dynamic secrets (created with CEL expressions).
	SecretExpressions []*core.DestinationExpression `json:"secretExpressions,omitempty"`
}

// AssignProperties_From_ScheduledQueryRuleOperatorSpec populates our ScheduledQueryRuleOperatorSpec from the provided source ScheduledQueryRuleOperatorSpec
func (operator *ScheduledQueryRuleOperatorSpec) AssignProperties_From_ScheduledQueryRuleOperatorSpec(source *storage.ScheduledQueryRuleOperatorSpec) error {

	// ConfigMapExpressions
	if source.ConfigMapExpressions != nil {
		configMapExpressionList := make([]*core.DestinationExpression, len(source.ConfigMapExpressions))
		for configMapExpressionIndex, configMapExpressionItem := range source.ConfigMapExpressions {
			if configMapExpressionItem != nil {
				configMapExpression := *configMapExpressionItem.DeepCopy()
				configMapExpressionList[configMapExpressionIndex] = &configMapExpression
			} else {
				configMapExpressionList[configMapExpressionIndex] = nil
			}
		}
		operator.ConfigMapExpressions = configMapExpressionList
	} else {
		operator.ConfigMapExpressions = nil
	}

	// SecretExpressions
	if source.SecretExpressions != nil {
		secretExpressionList := make([]*core.DestinationExpression, len(source.SecretExpressions))
		for secretExpressionIndex, secretExpressionItem := range source.SecretExpressions {
			if secretExpressionItem != nil {
				secretExpression := *secretExpressionItem.DeepCopy()
				secretExpressionList[secretExpressionIndex] = &secretExpression
			} else {
				secretExpressionList[secretExpressionIndex] = nil
			}
		}
		operator.SecretExpressions = secretExpressionList
	} else {
		operator.SecretExpressions = nil
	}

	// No error
	return nil
}

// AssignProperties_To_ScheduledQueryRuleOperatorSpec populates the provided destination ScheduledQueryRuleOperatorSpec from our ScheduledQueryRuleOperatorSpec
func (operator *ScheduledQueryRuleOperatorSpec) AssignProperties_To_ScheduledQueryRuleOperatorSpec(destination *storage.ScheduledQueryRuleOperatorSpec) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// ConfigMapExpressions
	if operator.ConfigMapExpressions != nil {
		configMapExpressionList := make([]*core.DestinationExpression, len(operator.ConfigMapExpressions))
		for configMapExpressionIndex, configMapExpressionItem := range operator.ConfigMapExpressions {
			if configMapExpressionItem != nil {
				configMapExpression := *configMapExpressionItem.DeepCopy()
				configMapExpressionList[configMapExpressionIndex] = &configMapExpression
			} else {
				configMapExpressionList[configMapExpressionIndex] = nil
			}
		}
		destination.ConfigMapExpressions = configMapExpressionList
	} else {
		destination.ConfigMapExpressions = nil
	}

	// SecretExpressions
	if operator.SecretExpressions != nil {
		secretExpressionList := make([]*core.DestinationExpression, len(operator.SecretExpressions))
		for secretExpressionIndex, secretExpressionItem := range operator.SecretExpressions {
			if secretExpressionItem != nil {
				secretExpression := *secretExpressionItem.DeepCopy()
				secretExpressionList[secretExpressionIndex] = &secretExpression
			} else {
				secretExpressionList[secretExpressionIndex] = nil
			}
		}
		destination.SecretExpressions = secretExpressionList
	} else {
		destination.SecretExpressions = nil
	}

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// No error
	return nil
}

// +kubebuilder:validation:Enum={0,1,2,3,4}
type ScheduledQueryRuleProperties_Severity int

const (
	ScheduledQueryRuleProperties_Severity_0 = ScheduledQueryRuleProperties_Severity(0)
	ScheduledQueryRuleProperties_Severity_1 = ScheduledQueryRuleProperties_Severity(1)
	ScheduledQueryRuleProperties_Severity_2 = ScheduledQueryRuleProperties_Severity(2)
	ScheduledQueryRuleProperties_Severity_3 = ScheduledQueryRuleProperties_Severity(3)
	ScheduledQueryRuleProperties_Severity_4 = ScheduledQueryRuleProperties_Severity(4)
)

type ScheduledQueryRuleProperties_Severity_STATUS int

const (
	ScheduledQueryRuleProperties_Severity_STATUS_0 = ScheduledQueryRuleProperties_Severity_STATUS(0)
	ScheduledQueryRuleProperties_Severity_STATUS_1 = ScheduledQueryRuleProperties_Severity_STATUS(1)
	ScheduledQueryRuleProperties_Severity_STATUS_2 = ScheduledQueryRuleProperties_Severity_STATUS(2)
	ScheduledQueryRuleProperties_Severity_STATUS_3 = ScheduledQueryRuleProperties_Severity_STATUS(3)
	ScheduledQueryRuleProperties_Severity_STATUS_4 = ScheduledQueryRuleProperties_Severity_STATUS(4)
)

// Metadata pertaining to creation and last modification of the resource.
type SystemData_STATUS struct {
	// CreatedAt: The timestamp of resource creation (UTC).
	CreatedAt *string `json:"createdAt,omitempty"`

	// CreatedBy: The identity that created the resource.
	CreatedBy *string `json:"createdBy,omitempty"`

	// CreatedByType: The type of identity that created the resource.
	CreatedByType *SystemData_CreatedByType_STATUS `json:"createdByType,omitempty"`

	// LastModifiedAt: The timestamp of resource last modification (UTC)
	LastModifiedAt *string `json:"lastModifiedAt,omitempty"`

	// LastModifiedBy: The identity that last modified the resource.
	LastModifiedBy *string `json:"lastModifiedBy,omitempty"`

	// LastModifiedByType: The type of identity that last modified the resource.
	LastModifiedByType *SystemData_LastModifiedByType_STATUS `json:"lastModifiedByType,omitempty"`
}

var _ genruntime.FromARMConverter = &SystemData_STATUS{}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (data *SystemData_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.SystemData_STATUS{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (data *SystemData_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.SystemData_STATUS)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.SystemData_STATUS, got %T", armInput)
	}

	// Set property "CreatedAt":
	if typedInput.CreatedAt != nil {
		createdAt := *typedInput.CreatedAt
		data.CreatedAt = &createdAt
	}

	// Set property "CreatedBy":
	if typedInput.CreatedBy != nil {
		createdBy := *typedInput.CreatedBy
		data.CreatedBy = &createdBy
	}

	// Set property "CreatedByType":
	if typedInput.CreatedByType != nil {
		var temp string
		temp = string(*typedInput.CreatedByType)
		createdByType := SystemData_CreatedByType_STATUS(temp)
		data.CreatedByType = &createdByType
	}

	// Set property "LastModifiedAt":
	if typedInput.LastModifiedAt != nil {
		lastModifiedAt := *typedInput.LastModifiedAt
		data.LastModifiedAt = &lastModifiedAt
	}

	// Set property "LastModifiedBy":
	if typedInput.LastModifiedBy != nil {
		lastModifiedBy := *typedInput.LastModifiedBy
		data.LastModifiedBy = &lastModifiedBy
	}

	// Set property "LastModifiedByType":
	if typedInput.LastModifiedByType != nil {
		var temp string
		temp = string(*typedInput.LastModifiedByType)
		lastModifiedByType := SystemData_LastModifiedByType_STATUS(temp)
		data.LastModifiedByType = &lastModifiedByType
	}

	// No error
	return nil
}

// AssignProperties_From_SystemData_STATUS populates our SystemData_STATUS from the provided source SystemData_STATUS
func (data *SystemData_STATUS) AssignProperties_From_SystemData_STATUS(source *storage.SystemData_STATUS) error {

	// CreatedAt
	data.CreatedAt = genruntime.ClonePointerToString(source.CreatedAt)

	// CreatedBy
	data.CreatedBy = genruntime.ClonePointerToString(source.CreatedBy)

	// CreatedByType
	if source.CreatedByType != nil {
		createdByType := *source.CreatedByType
		createdByTypeTemp := genruntime.ToEnum(createdByType, systemData_CreatedByType_STATUS_Values)
		data.CreatedByType = &createdByTypeTemp
	} else {
		data.CreatedByType = nil
	}

	// LastModifiedAt
	data.LastModifiedAt = genruntime.ClonePointerToString(source.LastModifiedAt)

	// LastModifiedBy
	data.LastModifiedBy = genruntime.ClonePointerToString(source.LastModifiedBy)

	// LastModifiedByType
	if source.LastModifiedByType != nil {
		lastModifiedByType := *source.LastModifiedByType
		lastModifiedByTypeTemp := genruntime.ToEnum(lastModifiedByType, systemData_LastModifiedByType_STATUS_Values)
		data.LastModifiedByType = &lastModifiedByTypeTemp
	} else {
		data.LastModifiedByType = nil
	}

	// No error
	return nil
}

// AssignProperties_To_SystemData_STATUS populates the provided destination SystemData_STATUS from our SystemData_STATUS
func (data *SystemData_STATUS) AssignProperties_To_SystemData_STATUS(destination *storage.SystemData_STATUS) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// CreatedAt
	destination.CreatedAt = genruntime.ClonePointerToString(data.CreatedAt)

	// CreatedBy
	destination.CreatedBy = genruntime.ClonePointerToString(data.CreatedBy)

	// CreatedByType
	if data.CreatedByType != nil {
		createdByType := string(*data.CreatedByType)
		destination.CreatedByType = &createdByType
	} else {
		destination.CreatedByType = nil
	}

	// LastModifiedAt
	destination.LastModifiedAt = genruntime.ClonePointerToString(data.LastModifiedAt)

	// LastModifiedBy
	destination.LastModifiedBy = genruntime.ClonePointerToString(data.LastModifiedBy)

	// LastModifiedByType
	if data.LastModifiedByType != nil {
		lastModifiedByType := string(*data.LastModifiedByType)
		destination.LastModifiedByType = &lastModifiedByType
	} else {
		destination.LastModifiedByType = nil
	}

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// No error
	return nil
}

// A condition of the scheduled query rule.
type Condition struct {
	// Dimensions: List of Dimensions conditions
	Dimensions []Dimension `json:"dimensions,omitempty"`

	// FailingPeriods: The minimum number of violations required within the selected lookback time window required to raise an
	// alert. Relevant only for rules of the kind LogAlert.
	FailingPeriods *Condition_FailingPeriods `json:"failingPeriods,omitempty"`

	// MetricMeasureColumn: The column containing the metric measure number. Relevant only for rules of the kind LogAlert.
	MetricMeasureColumn *string `json:"metricMeasureColumn,omitempty"`

	// MetricName: The name of the metric to be sent. Relevant and required only for rules of the kind LogToMetric.
	MetricName *string `json:"metricName,omitempty"`

	// Operator: The criteria operator. Relevant and required only for rules of the kind LogAlert.
	Operator *Condition_Operator `json:"operator,omitempty"`

	// Query: Log query alert
	Query *string `json:"query,omitempty"`

	// ResourceIdColumnReference: The column containing the resource id. The content of the column must be a uri formatted as
	// resource id. Relevant only for rules of the kind LogAlert.
	ResourceIdColumnReference *genruntime.ResourceReference `armReference:"ResourceIdColumn" json:"resourceIdColumnReference,omitempty"`

	// Threshold: the criteria threshold value that activates the alert. Relevant and required only for rules of the kind
	// LogAlert.
	Threshold *float64 `json:"threshold,omitempty"`

	// TimeAggregation: Aggregation type. Relevant and required only for rules of the kind LogAlert.
	TimeAggregation *Condition_TimeAggregation `json:"timeAggregation,omitempty"`
}

var _ genruntime.ARMTransformer = &Condition{}

// ConvertToARM converts from a Kubernetes CRD object to an ARM object
func (condition *Condition) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {
	if condition == nil {
		return nil, nil
	}
	result := &arm.Condition{}

	// Set property "Dimensions":
	for _, item := range condition.Dimensions {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Dimensions = append(result.Dimensions, *item_ARM.(*arm.Dimension))
	}

	// Set property "FailingPeriods":
	if condition.FailingPeriods != nil {
		failingPeriods_ARM, err := condition.FailingPeriods.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		failingPeriods := *failingPeriods_ARM.(*arm.Condition_FailingPeriods)
		result.FailingPeriods = &failingPeriods
	}

	// Set property "MetricMeasureColumn":
	if condition.MetricMeasureColumn != nil {
		metricMeasureColumn := *condition.MetricMeasureColumn
		result.MetricMeasureColumn = &metricMeasureColumn
	}

	// Set property "MetricName":
	if condition.MetricName != nil {
		metricName := *condition.MetricName
		result.MetricName = &metricName
	}

	// Set property "Operator":
	if condition.Operator != nil {
		var temp string
		temp = string(*condition.Operator)
		operator := arm.Condition_Operator(temp)
		result.Operator = &operator
	}

	// Set property "Query":
	if condition.Query != nil {
		query := *condition.Query
		result.Query = &query
	}

	// Set property "ResourceIdColumn":
	if condition.ResourceIdColumnReference != nil {
		resourceIdColumnReferenceARMID, err := resolved.ResolvedReferences.Lookup(*condition.ResourceIdColumnReference)
		if err != nil {
			return nil, err
		}
		resourceIdColumnReference := resourceIdColumnReferenceARMID
		result.ResourceIdColumn = &resourceIdColumnReference
	}

	// Set property "Threshold":
	if condition.Threshold != nil {
		threshold := *condition.Threshold
		result.Threshold = &threshold
	}

	// Set property "TimeAggregation":
	if condition.TimeAggregation != nil {
		var temp string
		temp = string(*condition.TimeAggregation)
		timeAggregation := arm.Condition_TimeAggregation(temp)
		result.TimeAggregation = &timeAggregation
	}
	return result, nil
}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (condition *Condition) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.Condition{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (condition *Condition) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.Condition)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Condition, got %T", armInput)
	}

	// Set property "Dimensions":
	for _, item := range typedInput.Dimensions {
		var item1 Dimension
		err := item1.PopulateFromARM(owner, item)
		if err != nil {
			return err
		}
		condition.Dimensions = append(condition.Dimensions, item1)
	}

	// Set property "FailingPeriods":
	if typedInput.FailingPeriods != nil {
		var failingPeriods1 Condition_FailingPeriods
		err := failingPeriods1.PopulateFromARM(owner, *typedInput.FailingPeriods)
		if err != nil {
			return err
		}
		failingPeriods := failingPeriods1
		condition.FailingPeriods = &failingPeriods
	}

	// Set property "MetricMeasureColumn":
	if typedInput.MetricMeasureColumn != nil {
		metricMeasureColumn := *typedInput.MetricMeasureColumn
		condition.MetricMeasureColumn = &metricMeasureColumn
	}

	// Set property "MetricName":
	if typedInput.MetricName != nil {
		metricName := *typedInput.MetricName
		condition.MetricName = &metricName
	}

	// Set property "Operator":
	if typedInput.Operator != nil {
		var temp string
		temp = string(*typedInput.Operator)
		operator := Condition_Operator(temp)
		condition.Operator = &operator
	}

	// Set property "Query":
	if typedInput.Query != nil {
		query := *typedInput.Query
		condition.Query = &query
	}

	// no assignment for property "ResourceIdColumnReference"

	// Set property "Threshold":
	if typedInput.Threshold != nil {
		threshold := *typedInput.Threshold
		condition.Threshold = &threshold
	}

	// Set property "TimeAggregation":
	if typedInput.TimeAggregation != nil {
		var temp string
		temp = string(*typedInput.TimeAggregation)
		timeAggregation := Condition_TimeAggregation(temp)
		condition.TimeAggregation = &timeAggregation
	}

	// No error
	return nil
}

// AssignProperties_From_Condition populates our Condition from the provided source Condition
func (condition *Condition) AssignProperties_From_Condition(source *storage.Condition) error {

	// Dimensions
	if source.Dimensions != nil {
		dimensionList := make([]Dimension, len(source.Dimensions))
		for dimensionIndex, dimensionItem := range source.Dimensions {
			var dimension Dimension
			err := dimension.AssignProperties_From_Dimension(&dimensionItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_Dimension() to populate field Dimensions")
			}
			dimensionList[dimensionIndex] = dimension
		}
		condition.Dimensions = dimensionList
	} else {
		condition.Dimensions = nil
	}

	// FailingPeriods
	if source.FailingPeriods != nil {
		var failingPeriod Condition_FailingPeriods
		err := failingPeriod.AssignProperties_From_Condition_FailingPeriods(source.FailingPeriods)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Condition_FailingPeriods() to populate field FailingPeriods")
		}
		condition.FailingPeriods = &failingPeriod
	} else {
		condition.FailingPeriods = nil
	}

	// MetricMeasureColumn
	condition.MetricMeasureColumn = genruntime.ClonePointerToString(source.MetricMeasureColumn)

	// MetricName
	condition.MetricName = genruntime.ClonePointerToString(source.MetricName)

	// Operator
	if source.Operator != nil {
		operator := *source.Operator
		operatorTemp := genruntime.ToEnum(operator, condition_Operator_Values)
		condition.Operator = &operatorTemp
	} else {
		condition.Operator = nil
	}

	// Query
	condition.Query = genruntime.ClonePointerToString(source.Query)

	// ResourceIdColumnReference
	if source.ResourceIdColumnReference != nil {
		resourceIdColumnReference := source.ResourceIdColumnReference.Copy()
		condition.ResourceIdColumnReference = &resourceIdColumnReference
	} else {
		condition.ResourceIdColumnReference = nil
	}

	// Threshold
	if source.Threshold != nil {
		threshold := *source.Threshold
		condition.Threshold = &threshold
	} else {
		condition.Threshold = nil
	}

	// TimeAggregation
	if source.TimeAggregation != nil {
		timeAggregation := *source.TimeAggregation
		timeAggregationTemp := genruntime.ToEnum(timeAggregation, condition_TimeAggregation_Values)
		condition.TimeAggregation = &timeAggregationTemp
	} else {
		condition.TimeAggregation = nil
	}

	// No error
	return nil
}

// AssignProperties_To_Condition populates the provided destination Condition from our Condition
func (condition *Condition) AssignProperties_To_Condition(destination *storage.Condition) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// Dimensions
	if condition.Dimensions != nil {
		dimensionList := make([]storage.Dimension, len(condition.Dimensions))
		for dimensionIndex, dimensionItem := range condition.Dimensions {
			var dimension storage.Dimension
			err := dimensionItem.AssignProperties_To_Dimension(&dimension)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_Dimension() to populate field Dimensions")
			}
			dimensionList[dimensionIndex] = dimension
		}
		destination.Dimensions = dimensionList
	} else {
		destination.Dimensions = nil
	}

	// FailingPeriods
	if condition.FailingPeriods != nil {
		var failingPeriod storage.Condition_FailingPeriods
		err := condition.FailingPeriods.AssignProperties_To_Condition_FailingPeriods(&failingPeriod)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Condition_FailingPeriods() to populate field FailingPeriods")
		}
		destination.FailingPeriods = &failingPeriod
	} else {
		destination.FailingPeriods = nil
	}

	// MetricMeasureColumn
	destination.MetricMeasureColumn = genruntime.ClonePointerToString(condition.MetricMeasureColumn)

	// MetricName
	destination.MetricName = genruntime.ClonePointerToString(condition.MetricName)

	// Operator
	if condition.Operator != nil {
		operator := string(*condition.Operator)
		destination.Operator = &operator
	} else {
		destination.Operator = nil
	}

	// Query
	destination.Query = genruntime.ClonePointerToString(condition.Query)

	// ResourceIdColumnReference
	if condition.ResourceIdColumnReference != nil {
		resourceIdColumnReference := condition.ResourceIdColumnReference.Copy()
		destination.ResourceIdColumnReference = &resourceIdColumnReference
	} else {
		destination.ResourceIdColumnReference = nil
	}

	// Threshold
	if condition.Threshold != nil {
		threshold := *condition.Threshold
		destination.Threshold = &threshold
	} else {
		destination.Threshold = nil
	}

	// TimeAggregation
	if condition.TimeAggregation != nil {
		timeAggregation := string(*condition.TimeAggregation)
		destination.TimeAggregation = &timeAggregation
	} else {
		destination.TimeAggregation = nil
	}

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// No error
	return nil
}

// Initialize_From_Condition_STATUS populates our Condition from the provided source Condition_STATUS
func (condition *Condition) Initialize_From_Condition_STATUS(source *Condition_STATUS) error {

	// Dimensions
	if source.Dimensions != nil {
		dimensionList := make([]Dimension, len(source.Dimensions))
		for dimensionIndex, dimensionItem := range source.Dimensions {
			var dimension Dimension
			err := dimension.Initialize_From_Dimension_STATUS(&dimensionItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_Dimension_STATUS() to populate field Dimensions")
			}
			dimensionList[dimensionIndex] = dimension
		}
		condition.Dimensions = dimensionList
	} else {
		condition.Dimensions = nil
	}

	// FailingPeriods
	if source.FailingPeriods != nil {
		var failingPeriod Condition_FailingPeriods
		err := failingPeriod.Initialize_From_Condition_FailingPeriods_STATUS(source.FailingPeriods)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_Condition_FailingPeriods_STATUS() to populate field FailingPeriods")
		}
		condition.FailingPeriods = &failingPeriod
	} else {
		condition.FailingPeriods = nil
	}

	// MetricMeasureColumn
	condition.MetricMeasureColumn = genruntime.ClonePointerToString(source.MetricMeasureColumn)

	// MetricName
	condition.MetricName = genruntime.ClonePointerToString(source.MetricName)

	// Operator
	if source.Operator != nil {
		operator := genruntime.ToEnum(string(*source.Operator), condition_Operator_Values)
		condition.Operator = &operator
	} else {
		condition.Operator = nil
	}

	// Query
	condition.Query = genruntime.ClonePointerToString(source.Query)

	// Threshold
	if source.Threshold != nil {
		threshold := *source.Threshold
		condition.Threshold = &threshold
	} else {
		condition.Threshold = nil
	}

	// TimeAggregation
	if source.TimeAggregation != nil {
		timeAggregation := genruntime.ToEnum(string(*source.TimeAggregation), condition_TimeAggregation_Values)
		condition.TimeAggregation = &timeAggregation
	} else {
		condition.TimeAggregation = nil
	}

	// No error
	return nil
}

// A condition of the scheduled query rule.
type Condition_STATUS struct {
	// Dimensions: List of Dimensions conditions
	Dimensions []Dimension_STATUS `json:"dimensions,omitempty"`

	// FailingPeriods: The minimum number of violations required within the selected lookback time window required to raise an
	// alert. Relevant only for rules of the kind LogAlert.
	FailingPeriods *Condition_FailingPeriods_STATUS `json:"failingPeriods,omitempty"`

	// MetricMeasureColumn: The column containing the metric measure number. Relevant only for rules of the kind LogAlert.
	MetricMeasureColumn *string `json:"metricMeasureColumn,omitempty"`

	// MetricName: The name of the metric to be sent. Relevant and required only for rules of the kind LogToMetric.
	MetricName *string `json:"metricName,omitempty"`

	// Operator: The criteria operator. Relevant and required only for rules of the kind LogAlert.
	Operator *Condition_Operator_STATUS `json:"operator,omitempty"`

	// Query: Log query alert
	Query *string `json:"query,omitempty"`

	// ResourceIdColumn: The column containing the resource id. The content of the column must be a uri formatted as resource
	// id. Relevant only for rules of the kind LogAlert.
	ResourceIdColumn *string `json:"resourceIdColumn,omitempty"`

	// Threshold: the criteria threshold value that activates the alert. Relevant and required only for rules of the kind
	// LogAlert.
	Threshold *float64 `json:"threshold,omitempty"`

	// TimeAggregation: Aggregation type. Relevant and required only for rules of the kind LogAlert.
	TimeAggregation *Condition_TimeAggregation_STATUS `json:"timeAggregation,omitempty"`
}

var _ genruntime.FromARMConverter = &Condition_STATUS{}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (condition *Condition_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.Condition_STATUS{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (condition *Condition_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.Condition_STATUS)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Condition_STATUS, got %T", armInput)
	}

	// Set property "Dimensions":
	for _, item := range typedInput.Dimensions {
		var item1 Dimension_STATUS
		err := item1.PopulateFromARM(owner, item)
		if err != nil {
			return err
		}
		condition.Dimensions = append(condition.Dimensions, item1)
	}

	// Set property "FailingPeriods":
	if typedInput.FailingPeriods != nil {
		var failingPeriods1 Condition_FailingPeriods_STATUS
		err := failingPeriods1.PopulateFromARM(owner, *typedInput.FailingPeriods)
		if err != nil {
			return err
		}
		failingPeriods := failingPeriods1
		condition.FailingPeriods = &failingPeriods
	}

	// Set property "MetricMeasureColumn":
	if typedInput.MetricMeasureColumn != nil {
		metricMeasureColumn := *typedInput.MetricMeasureColumn
		condition.MetricMeasureColumn = &metricMeasureColumn
	}

	// Set property "MetricName":
	if typedInput.MetricName != nil {
		metricName := *typedInput.MetricName
		condition.MetricName = &metricName
	}

	// Set property "Operator":
	if typedInput.Operator != nil {
		var temp string
		temp = string(*typedInput.Operator)
		operator := Condition_Operator_STATUS(temp)
		condition.Operator = &operator
	}

	// Set property "Query":
	if typedInput.Query != nil {
		query := *typedInput.Query
		condition.Query = &query
	}

	// Set property "ResourceIdColumn":
	if typedInput.ResourceIdColumn != nil {
		resourceIdColumn := *typedInput.ResourceIdColumn
		condition.ResourceIdColumn = &resourceIdColumn
	}

	// Set property "Threshold":
	if typedInput.Threshold != nil {
		threshold := *typedInput.Threshold
		condition.Threshold = &threshold
	}

	// Set property "TimeAggregation":
	if typedInput.TimeAggregation != nil {
		var temp string
		temp = string(*typedInput.TimeAggregation)
		timeAggregation := Condition_TimeAggregation_STATUS(temp)
		condition.TimeAggregation = &timeAggregation
	}

	// No error
	return nil
}

// AssignProperties_From_Condition_STATUS populates our Condition_STATUS from the provided source Condition_STATUS
func (condition *Condition_STATUS) AssignProperties_From_Condition_STATUS(source *storage.Condition_STATUS) error {

	// Dimensions
	if source.Dimensions != nil {
		dimensionList := make([]Dimension_STATUS, len(source.Dimensions))
		for dimensionIndex, dimensionItem := range source.Dimensions {
			var dimension Dimension_STATUS
			err := dimension.AssignProperties_From_Dimension_STATUS(&dimensionItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_Dimension_STATUS() to populate field Dimensions")
			}
			dimensionList[dimensionIndex] = dimension
		}
		condition.Dimensions = dimensionList
	} else {
		condition.Dimensions = nil
	}

	// FailingPeriods
	if source.FailingPeriods != nil {
		var failingPeriod Condition_FailingPeriods_STATUS
		err := failingPeriod.AssignProperties_From_Condition_FailingPeriods_STATUS(source.FailingPeriods)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Condition_FailingPeriods_STATUS() to populate field FailingPeriods")
		}
		condition.FailingPeriods = &failingPeriod
	} else {
		condition.FailingPeriods = nil
	}

	// MetricMeasureColumn
	condition.MetricMeasureColumn = genruntime.ClonePointerToString(source.MetricMeasureColumn)

	// MetricName
	condition.MetricName = genruntime.ClonePointerToString(source.MetricName)

	// Operator
	if source.Operator != nil {
		operator := *source.Operator
		operatorTemp := genruntime.ToEnum(operator, condition_Operator_STATUS_Values)
		condition.Operator = &operatorTemp
	} else {
		condition.Operator = nil
	}

	// Query
	condition.Query = genruntime.ClonePointerToString(source.Query)

	// ResourceIdColumn
	condition.ResourceIdColumn = genruntime.ClonePointerToString(source.ResourceIdColumn)

	// Threshold
	if source.Threshold != nil {
		threshold := *source.Threshold
		condition.Threshold = &threshold
	} else {
		condition.Threshold = nil
	}

	// TimeAggregation
	if source.TimeAggregation != nil {
		timeAggregation := *source.TimeAggregation
		timeAggregationTemp := genruntime.ToEnum(timeAggregation, condition_TimeAggregation_STATUS_Values)
		condition.TimeAggregation = &timeAggregationTemp
	} else {
		condition.TimeAggregation = nil
	}

	// No error
	return nil
}

// AssignProperties_To_Condition_STATUS populates the provided destination Condition_STATUS from our Condition_STATUS
func (condition *Condition_STATUS) AssignProperties_To_Condition_STATUS(destination *storage.Condition_STATUS) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// Dimensions
	if condition.Dimensions != nil {
		dimensionList := make([]storage.Dimension_STATUS, len(condition.Dimensions))
		for dimensionIndex, dimensionItem := range condition.Dimensions {
			var dimension storage.Dimension_STATUS
			err := dimensionItem.AssignProperties_To_Dimension_STATUS(&dimension)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_Dimension_STATUS() to populate field Dimensions")
			}
			dimensionList[dimensionIndex] = dimension
		}
		destination.Dimensions = dimensionList
	} else {
		destination.Dimensions = nil
	}

	// FailingPeriods
	if condition.FailingPeriods != nil {
		var failingPeriod storage.Condition_FailingPeriods_STATUS
		err := condition.FailingPeriods.AssignProperties_To_Condition_FailingPeriods_STATUS(&failingPeriod)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Condition_FailingPeriods_STATUS() to populate field FailingPeriods")
		}
		destination.FailingPeriods = &failingPeriod
	} else {
		destination.FailingPeriods = nil
	}

	// MetricMeasureColumn
	destination.MetricMeasureColumn = genruntime.ClonePointerToString(condition.MetricMeasureColumn)

	// MetricName
	destination.MetricName = genruntime.ClonePointerToString(condition.MetricName)

	// Operator
	if condition.Operator != nil {
		operator := string(*condition.Operator)
		destination.Operator = &operator
	} else {
		destination.Operator = nil
	}

	// Query
	destination.Query = genruntime.ClonePointerToString(condition.Query)

	// ResourceIdColumn
	destination.ResourceIdColumn = genruntime.ClonePointerToString(condition.ResourceIdColumn)

	// Threshold
	if condition.Threshold != nil {
		threshold := *condition.Threshold
		destination.Threshold = &threshold
	} else {
		destination.Threshold = nil
	}

	// TimeAggregation
	if condition.TimeAggregation != nil {
		timeAggregation := string(*condition.TimeAggregation)
		destination.TimeAggregation = &timeAggregation
	} else {
		destination.TimeAggregation = nil
	}

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// No error
	return nil
}

type SystemData_CreatedByType_STATUS string

const (
	SystemData_CreatedByType_STATUS_Application     = SystemData_CreatedByType_STATUS("Application")
	SystemData_CreatedByType_STATUS_Key             = SystemData_CreatedByType_STATUS("Key")
	SystemData_CreatedByType_STATUS_ManagedIdentity = SystemData_CreatedByType_STATUS("ManagedIdentity")
	SystemData_CreatedByType_STATUS_User            = SystemData_CreatedByType_STATUS("User")
)

// Mapping from string to SystemData_CreatedByType_STATUS
var systemData_CreatedByType_STATUS_Values = map[string]SystemData_CreatedByType_STATUS{
	"application":     SystemData_CreatedByType_STATUS_Application,
	"key":             SystemData_CreatedByType_STATUS_Key,
	"managedidentity": SystemData_CreatedByType_STATUS_ManagedIdentity,
	"user":            SystemData_CreatedByType_STATUS_User,
}

type SystemData_LastModifiedByType_STATUS string

const (
	SystemData_LastModifiedByType_STATUS_Application     = SystemData_LastModifiedByType_STATUS("Application")
	SystemData_LastModifiedByType_STATUS_Key             = SystemData_LastModifiedByType_STATUS("Key")
	SystemData_LastModifiedByType_STATUS_ManagedIdentity = SystemData_LastModifiedByType_STATUS("ManagedIdentity")
	SystemData_LastModifiedByType_STATUS_User            = SystemData_LastModifiedByType_STATUS("User")
)

// Mapping from string to SystemData_LastModifiedByType_STATUS
var systemData_LastModifiedByType_STATUS_Values = map[string]SystemData_LastModifiedByType_STATUS{
	"application":     SystemData_LastModifiedByType_STATUS_Application,
	"key":             SystemData_LastModifiedByType_STATUS_Key,
	"managedidentity": SystemData_LastModifiedByType_STATUS_ManagedIdentity,
	"user":            SystemData_LastModifiedByType_STATUS_User,
}

type Condition_FailingPeriods struct {
	// MinFailingPeriodsToAlert: The number of violations to trigger an alert. Should be smaller or equal to
	// numberOfEvaluationPeriods. Default value is 1
	MinFailingPeriodsToAlert *int `json:"minFailingPeriodsToAlert,omitempty"`

	// NumberOfEvaluationPeriods: The number of aggregated lookback points. The lookback time window is calculated based on the
	// aggregation granularity (windowSize) and the selected number of aggregated points. Default value is 1
	NumberOfEvaluationPeriods *int `json:"numberOfEvaluationPeriods,omitempty"`
}

var _ genruntime.ARMTransformer = &Condition_FailingPeriods{}

// ConvertToARM converts from a Kubernetes CRD object to an ARM object
func (periods *Condition_FailingPeriods) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {
	if periods == nil {
		return nil, nil
	}
	result := &arm.Condition_FailingPeriods{}

	// Set property "MinFailingPeriodsToAlert":
	if periods.MinFailingPeriodsToAlert != nil {
		minFailingPeriodsToAlert := *periods.MinFailingPeriodsToAlert
		result.MinFailingPeriodsToAlert = &minFailingPeriodsToAlert
	}

	// Set property "NumberOfEvaluationPeriods":
	if periods.NumberOfEvaluationPeriods != nil {
		numberOfEvaluationPeriods := *periods.NumberOfEvaluationPeriods
		result.NumberOfEvaluationPeriods = &numberOfEvaluationPeriods
	}
	return result, nil
}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (periods *Condition_FailingPeriods) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.Condition_FailingPeriods{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (periods *Condition_FailingPeriods) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.Condition_FailingPeriods)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Condition_FailingPeriods, got %T", armInput)
	}

	// Set property "MinFailingPeriodsToAlert":
	if typedInput.MinFailingPeriodsToAlert != nil {
		minFailingPeriodsToAlert := *typedInput.MinFailingPeriodsToAlert
		periods.MinFailingPeriodsToAlert = &minFailingPeriodsToAlert
	}

	// Set property "NumberOfEvaluationPeriods":
	if typedInput.NumberOfEvaluationPeriods != nil {
		numberOfEvaluationPeriods := *typedInput.NumberOfEvaluationPeriods
		periods.NumberOfEvaluationPeriods = &numberOfEvaluationPeriods
	}

	// No error
	return nil
}

// AssignProperties_From_Condition_FailingPeriods populates our Condition_FailingPeriods from the provided source Condition_FailingPeriods
func (periods *Condition_FailingPeriods) AssignProperties_From_Condition_FailingPeriods(source *storage.Condition_FailingPeriods) error {

	// MinFailingPeriodsToAlert
	periods.MinFailingPeriodsToAlert = genruntime.ClonePointerToInt(source.MinFailingPeriodsToAlert)

	// NumberOfEvaluationPeriods
	periods.NumberOfEvaluationPeriods = genruntime.ClonePointerToInt(source.NumberOfEvaluationPeriods)

	// No error
	return nil
}

// AssignProperties_To_Condition_FailingPeriods populates the provided destination Condition_FailingPeriods from our Condition_FailingPeriods
func (periods *Condition_FailingPeriods) AssignProperties_To_Condition_FailingPeriods(destination *storage.Condition_FailingPeriods) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// MinFailingPeriodsToAlert
	destination.MinFailingPeriodsToAlert = genruntime.ClonePointerToInt(periods.MinFailingPeriodsToAlert)

	// NumberOfEvaluationPeriods
	destination.NumberOfEvaluationPeriods = genruntime.ClonePointerToInt(periods.NumberOfEvaluationPeriods)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// No error
	return nil
}

// Initialize_From_Condition_FailingPeriods_STATUS populates our Condition_FailingPeriods from the provided source Condition_FailingPeriods_STATUS
func (periods *Condition_FailingPeriods) Initialize_From_Condition_FailingPeriods_STATUS(source *Condition_FailingPeriods_STATUS) error {

	// MinFailingPeriodsToAlert
	periods.MinFailingPeriodsToAlert = genruntime.ClonePointerToInt(source.MinFailingPeriodsToAlert)

	// NumberOfEvaluationPeriods
	periods.NumberOfEvaluationPeriods = genruntime.ClonePointerToInt(source.NumberOfEvaluationPeriods)

	// No error
	return nil
}

type Condition_FailingPeriods_STATUS struct {
	// MinFailingPeriodsToAlert: The number of violations to trigger an alert. Should be smaller or equal to
	// numberOfEvaluationPeriods. Default value is 1
	MinFailingPeriodsToAlert *int `json:"minFailingPeriodsToAlert,omitempty"`

	// NumberOfEvaluationPeriods: The number of aggregated lookback points. The lookback time window is calculated based on the
	// aggregation granularity (windowSize) and the selected number of aggregated points. Default value is 1
	NumberOfEvaluationPeriods *int `json:"numberOfEvaluationPeriods,omitempty"`
}

var _ genruntime.FromARMConverter = &Condition_FailingPeriods_STATUS{}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (periods *Condition_FailingPeriods_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.Condition_FailingPeriods_STATUS{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (periods *Condition_FailingPeriods_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.Condition_FailingPeriods_STATUS)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Condition_FailingPeriods_STATUS, got %T", armInput)
	}

	// Set property "MinFailingPeriodsToAlert":
	if typedInput.MinFailingPeriodsToAlert != nil {
		minFailingPeriodsToAlert := *typedInput.MinFailingPeriodsToAlert
		periods.MinFailingPeriodsToAlert = &minFailingPeriodsToAlert
	}

	// Set property "NumberOfEvaluationPeriods":
	if typedInput.NumberOfEvaluationPeriods != nil {
		numberOfEvaluationPeriods := *typedInput.NumberOfEvaluationPeriods
		periods.NumberOfEvaluationPeriods = &numberOfEvaluationPeriods
	}

	// No error
	return nil
}

// AssignProperties_From_Condition_FailingPeriods_STATUS populates our Condition_FailingPeriods_STATUS from the provided source Condition_FailingPeriods_STATUS
func (periods *Condition_FailingPeriods_STATUS) AssignProperties_From_Condition_FailingPeriods_STATUS(source *storage.Condition_FailingPeriods_STATUS) error {

	// MinFailingPeriodsToAlert
	periods.MinFailingPeriodsToAlert = genruntime.ClonePointerToInt(source.MinFailingPeriodsToAlert)

	// NumberOfEvaluationPeriods
	periods.NumberOfEvaluationPeriods = genruntime.ClonePointerToInt(source.NumberOfEvaluationPeriods)

	// No error
	return nil
}

// AssignProperties_To_Condition_FailingPeriods_STATUS populates the provided destination Condition_FailingPeriods_STATUS from our Condition_FailingPeriods_STATUS
func (periods *Condition_FailingPeriods_STATUS) AssignProperties_To_Condition_FailingPeriods_STATUS(destination *storage.Condition_FailingPeriods_STATUS) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// MinFailingPeriodsToAlert
	destination.MinFailingPeriodsToAlert = genruntime.ClonePointerToInt(periods.MinFailingPeriodsToAlert)

	// NumberOfEvaluationPeriods
	destination.NumberOfEvaluationPeriods = genruntime.ClonePointerToInt(periods.NumberOfEvaluationPeriods)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"Equals","GreaterThan","GreaterThanOrEqual","LessThan","LessThanOrEqual"}
type Condition_Operator string

const (
	Condition_Operator_Equals             = Condition_Operator("Equals")
	Condition_Operator_GreaterThan        = Condition_Operator("GreaterThan")
	Condition_Operator_GreaterThanOrEqual = Condition_Operator("GreaterThanOrEqual")
	Condition_Operator_LessThan           = Condition_Operator("LessThan")
	Condition_Operator_LessThanOrEqual    = Condition_Operator("LessThanOrEqual")
)

// Mapping from string to Condition_Operator
var condition_Operator_Values = map[string]Condition_Operator{
	"equals":             Condition_Operator_Equals,
	"greaterthan":        Condition_Operator_GreaterThan,
	"greaterthanorequal": Condition_Operator_GreaterThanOrEqual,
	"lessthan":           Condition_Operator_LessThan,
	"lessthanorequal":    Condition_Operator_LessThanOrEqual,
}

type Condition_Operator_STATUS string

const (
	Condition_Operator_STATUS_Equals             = Condition_Operator_STATUS("Equals")
	Condition_Operator_STATUS_GreaterThan        = Condition_Operator_STATUS("GreaterThan")
	Condition_Operator_STATUS_GreaterThanOrEqual = Condition_Operator_STATUS("GreaterThanOrEqual")
	Condition_Operator_STATUS_LessThan           = Condition_Operator_STATUS("LessThan")
	Condition_Operator_STATUS_LessThanOrEqual    = Condition_Operator_STATUS("LessThanOrEqual")
)

// Mapping from string to Condition_Operator_STATUS
var condition_Operator_STATUS_Values = map[string]Condition_Operator_STATUS{
	"equals":             Condition_Operator_STATUS_Equals,
	"greaterthan":        Condition_Operator_STATUS_GreaterThan,
	"greaterthanorequal": Condition_Operator_STATUS_GreaterThanOrEqual,
	"lessthan":           Condition_Operator_STATUS_LessThan,
	"lessthanorequal":    Condition_Operator_STATUS_LessThanOrEqual,
}

// +kubebuilder:validation:Enum={"Average","Count","Maximum","Minimum","Total"}
type Condition_TimeAggregation string

const (
	Condition_TimeAggregation_Average = Condition_TimeAggregation("Average")
	Condition_TimeAggregation_Count   = Condition_TimeAggregation("Count")
	Condition_TimeAggregation_Maximum = Condition_TimeAggregation("Maximum")
	Condition_TimeAggregation_Minimum = Condition_TimeAggregation("Minimum")
	Condition_TimeAggregation_Total   = Condition_TimeAggregation("Total")
)

// Mapping from string to Condition_TimeAggregation
var condition_TimeAggregation_Values = map[string]Condition_TimeAggregation{
	"average": Condition_TimeAggregation_Average,
	"count":   Condition_TimeAggregation_Count,
	"maximum": Condition_TimeAggregation_Maximum,
	"minimum": Condition_TimeAggregation_Minimum,
	"total":   Condition_TimeAggregation_Total,
}

type Condition_TimeAggregation_STATUS string

const (
	Condition_TimeAggregation_STATUS_Average = Condition_TimeAggregation_STATUS("Average")
	Condition_TimeAggregation_STATUS_Count   = Condition_TimeAggregation_STATUS("Count")
	Condition_TimeAggregation_STATUS_Maximum = Condition_TimeAggregation_STATUS("Maximum")
	Condition_TimeAggregation_STATUS_Minimum = Condition_TimeAggregation_STATUS("Minimum")
	Condition_TimeAggregation_STATUS_Total   = Condition_TimeAggregation_STATUS("Total")
)

// Mapping from string to Condition_TimeAggregation_STATUS
var condition_TimeAggregation_STATUS_Values = map[string]Condition_TimeAggregation_STATUS{
	"average": Condition_TimeAggregation_STATUS_Average,
	"count":   Condition_TimeAggregation_STATUS_Count,
	"maximum": Condition_TimeAggregation_STATUS_Maximum,
	"minimum": Condition_TimeAggregation_STATUS_Minimum,
	"total":   Condition_TimeAggregation_STATUS_Total,
}

// Dimension splitting and filtering definition
type Dimension struct {
	// +kubebuilder:validation:Required
	// Name: Name of the dimension
	Name *string `json:"name,omitempty"`

	// +kubebuilder:validation:Required
	// Operator: Operator for dimension values
	Operator *Dimension_Operator `json:"operator,omitempty"`

	// +kubebuilder:validation:Required
	// Values: List of dimension values
	Values []string `json:"values,omitempty"`
}

var _ genruntime.ARMTransformer = &Dimension{}

// ConvertToARM converts from a Kubernetes CRD object to an ARM object
func (dimension *Dimension) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {
	if dimension == nil {
		return nil, nil
	}
	result := &arm.Dimension{}

	// Set property "Name":
	if dimension.Name != nil {
		name := *dimension.Name
		result.Name = &name
	}

	// Set property "Operator":
	if dimension.Operator != nil {
		var temp string
		temp = string(*dimension.Operator)
		operator := arm.Dimension_Operator(temp)
		result.Operator = &operator
	}

	// Set property "Values":
	for _, item := range dimension.Values {
		result.Values = append(result.Values, item)
	}
	return result, nil
}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (dimension *Dimension) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.Dimension{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (dimension *Dimension) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.Dimension)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Dimension, got %T", armInput)
	}

	// Set property "Name":
	if typedInput.Name != nil {
		name := *typedInput.Name
		dimension.Name = &name
	}

	// Set property "Operator":
	if typedInput.Operator != nil {
		var temp string
		temp = string(*typedInput.Operator)
		operator := Dimension_Operator(temp)
		dimension.Operator = &operator
	}

	// Set property "Values":
	for _, item := range typedInput.Values {
		dimension.Values = append(dimension.Values, item)
	}

	// No error
	return nil
}

// AssignProperties_From_Dimension populates our Dimension from the provided source Dimension
func (dimension *Dimension) AssignProperties_From_Dimension(source *storage.Dimension) error {

	// Name
	dimension.Name = genruntime.ClonePointerToString(source.Name)

	// Operator
	if source.Operator != nil {
		operator := *source.Operator
		operatorTemp := genruntime.ToEnum(operator, dimension_Operator_Values)
		dimension.Operator = &operatorTemp
	} else {
		dimension.Operator = nil
	}

	// Values
	dimension.Values = genruntime.CloneSliceOfString(source.Values)

	// No error
	return nil
}

// AssignProperties_To_Dimension populates the provided destination Dimension from our Dimension
func (dimension *Dimension) AssignProperties_To_Dimension(destination *storage.Dimension) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// Name
	destination.Name = genruntime.ClonePointerToString(dimension.Name)

	// Operator
	if dimension.Operator != nil {
		operator := string(*dimension.Operator)
		destination.Operator = &operator
	} else {
		destination.Operator = nil
	}

	// Values
	destination.Values = genruntime.CloneSliceOfString(dimension.Values)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// No error
	return nil
}

// Initialize_From_Dimension_STATUS populates our Dimension from the provided source Dimension_STATUS
func (dimension *Dimension) Initialize_From_Dimension_STATUS(source *Dimension_STATUS) error {

	// Name
	dimension.Name = genruntime.ClonePointerToString(source.Name)

	// Operator
	if source.Operator != nil {
		operator := genruntime.ToEnum(string(*source.Operator), dimension_Operator_Values)
		dimension.Operator = &operator
	} else {
		dimension.Operator = nil
	}

	// Values
	dimension.Values = genruntime.CloneSliceOfString(source.Values)

	// No error
	return nil
}

// Dimension splitting and filtering definition
type Dimension_STATUS struct {
	// Name: Name of the dimension
	Name *string `json:"name,omitempty"`

	// Operator: Operator for dimension values
	Operator *Dimension_Operator_STATUS `json:"operator,omitempty"`

	// Values: List of dimension values
	Values []string `json:"values,omitempty"`
}

var _ genruntime.FromARMConverter = &Dimension_STATUS{}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (dimension *Dimension_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.Dimension_STATUS{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (dimension *Dimension_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.Dimension_STATUS)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Dimension_STATUS, got %T", armInput)
	}

	// Set property "Name":
	if typedInput.Name != nil {
		name := *typedInput.Name
		dimension.Name = &name
	}

	// Set property "Operator":
	if typedInput.Operator != nil {
		var temp string
		temp = string(*typedInput.Operator)
		operator := Dimension_Operator_STATUS(temp)
		dimension.Operator = &operator
	}

	// Set property "Values":
	for _, item := range typedInput.Values {
		dimension.Values = append(dimension.Values, item)
	}

	// No error
	return nil
}

// AssignProperties_From_Dimension_STATUS populates our Dimension_STATUS from the provided source Dimension_STATUS
func (dimension *Dimension_STATUS) AssignProperties_From_Dimension_STATUS(source *storage.Dimension_STATUS) error {

	// Name
	dimension.Name = genruntime.ClonePointerToString(source.Name)

	// Operator
	if source.Operator != nil {
		operator := *source.Operator
		operatorTemp := genruntime.ToEnum(operator, dimension_Operator_STATUS_Values)
		dimension.Operator = &operatorTemp
	} else {
		dimension.Operator = nil
	}

	// Values
	dimension.Values = genruntime.CloneSliceOfString(source.Values)

	// No error
	return nil
}

// AssignProperties_To_Dimension_STATUS populates the provided destination Dimension_STATUS from our Dimension_STATUS
func (dimension *Dimension_STATUS) AssignProperties_To_Dimension_STATUS(destination *storage.Dimension_STATUS) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// Name
	destination.Name = genruntime.ClonePointerToString(dimension.Name)

	// Operator
	if dimension.Operator != nil {
		operator := string(*dimension.Operator)
		destination.Operator = &operator
	} else {
		destination.Operator = nil
	}

	// Values
	destination.Values = genruntime.CloneSliceOfString(dimension.Values)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"Exclude","Include"}
type Dimension_Operator string

const (
	Dimension_Operator_Exclude = Dimension_Operator("Exclude")
	Dimension_Operator_Include = Dimension_Operator("Include")
)

// Mapping from string to Dimension_Operator
var dimension_Operator_Values = map[string]Dimension_Operator{
	"exclude": Dimension_Operator_Exclude,
	"include": Dimension_Operator_Include,
}

type Dimension_Operator_STATUS string

const (
	Dimension_Operator_STATUS_Exclude = Dimension_Operator_STATUS("Exclude")
	Dimension_Operator_STATUS_Include = Dimension_Operator_STATUS("Include")
)

// Mapping from string to Dimension_Operator_STATUS
var dimension_Operator_STATUS_Values = map[string]Dimension_Operator_STATUS{
	"exclude": Dimension_Operator_STATUS_Exclude,
	"include": Dimension_Operator_STATUS_Include,
}

func init() {
	SchemeBuilder.Register(&ScheduledQueryRule{}, &ScheduledQueryRuleList{})
}
