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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/servicebus/v1api20221001preview/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/servicebus/v1api20221001preview/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,servicebus}
// +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: /servicebus/resource-manager/Microsoft.ServiceBus/ServiceBus/preview/2022-10-01-preview/Rules.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}
type NamespacesTopicsSubscriptionsRule struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              NamespacesTopicsSubscriptionsRule_Spec   `json:"spec,omitempty"`
	Status            NamespacesTopicsSubscriptionsRule_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &NamespacesTopicsSubscriptionsRule{}

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

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

var _ conversion.Convertible = &NamespacesTopicsSubscriptionsRule{}

// ConvertFrom populates our NamespacesTopicsSubscriptionsRule from the provided hub NamespacesTopicsSubscriptionsRule
func (rule *NamespacesTopicsSubscriptionsRule) ConvertFrom(hub conversion.Hub) error {
	// intermediate variable for conversion
	var source storage.NamespacesTopicsSubscriptionsRule

	err := source.ConvertFrom(hub)
	if err != nil {
		return eris.Wrap(err, "converting from hub to source")
	}

	err = rule.AssignProperties_From_NamespacesTopicsSubscriptionsRule(&source)
	if err != nil {
		return eris.Wrap(err, "converting from source to rule")
	}

	return nil
}

// ConvertTo populates the provided hub NamespacesTopicsSubscriptionsRule from our NamespacesTopicsSubscriptionsRule
func (rule *NamespacesTopicsSubscriptionsRule) ConvertTo(hub conversion.Hub) error {
	// intermediate variable for conversion
	var destination storage.NamespacesTopicsSubscriptionsRule
	err := rule.AssignProperties_To_NamespacesTopicsSubscriptionsRule(&destination)
	if err != nil {
		return eris.Wrap(err, "converting to destination from rule")
	}
	err = destination.ConvertTo(hub)
	if err != nil {
		return eris.Wrap(err, "converting from destination to hub")
	}

	return nil
}

var _ configmaps.Exporter = &NamespacesTopicsSubscriptionsRule{}

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

var _ secrets.Exporter = &NamespacesTopicsSubscriptionsRule{}

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

var _ genruntime.KubernetesResource = &NamespacesTopicsSubscriptionsRule{}

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

// GetAPIVersion returns the ARM API version of the resource. This is always "2022-10-01-preview"
func (rule NamespacesTopicsSubscriptionsRule) GetAPIVersion() string {
	return "2022-10-01-preview"
}

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.ServiceBus/namespaces/topics/subscriptions/rules"
func (rule *NamespacesTopicsSubscriptionsRule) GetType() string {
	return "Microsoft.ServiceBus/namespaces/topics/subscriptions/rules"
}

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

// Owner returns the ResourceReference of the owner
func (rule *NamespacesTopicsSubscriptionsRule) 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 *NamespacesTopicsSubscriptionsRule) SetStatus(status genruntime.ConvertibleStatus) error {
	// If we have exactly the right type of status, assign it
	if st, ok := status.(*NamespacesTopicsSubscriptionsRule_STATUS); ok {
		rule.Status = *st
		return nil
	}

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

	rule.Status = st
	return nil
}

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

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

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

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

	// No error
	return nil
}

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

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

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

	// Status
	var status storage.NamespacesTopicsSubscriptionsRule_STATUS
	err = rule.Status.AssignProperties_To_NamespacesTopicsSubscriptionsRule_STATUS(&status)
	if err != nil {
		return eris.Wrap(err, "calling AssignProperties_To_NamespacesTopicsSubscriptionsRule_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 *NamespacesTopicsSubscriptionsRule) OriginalGVK() *schema.GroupVersionKind {
	return &schema.GroupVersionKind{
		Group:   GroupVersion.Group,
		Version: rule.Spec.OriginalVersion(),
		Kind:    "NamespacesTopicsSubscriptionsRule",
	}
}

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /servicebus/resource-manager/Microsoft.ServiceBus/ServiceBus/preview/2022-10-01-preview/Rules.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}
type NamespacesTopicsSubscriptionsRuleList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []NamespacesTopicsSubscriptionsRule `json:"items"`
}

type NamespacesTopicsSubscriptionsRule_Spec struct {
	// Action: Represents the filter actions which are allowed for the transformation of a message that have been matched by a
	// filter expression.
	Action *Action `json:"action,omitempty"`

	// +kubebuilder:validation:MaxLength=50
	// +kubebuilder:validation:MinLength=1
	// 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"`

	// CorrelationFilter: Properties of correlationFilter
	CorrelationFilter *CorrelationFilter `json:"correlationFilter,omitempty"`

	// FilterType: Filter type that is evaluated against a BrokeredMessage.
	FilterType *FilterType `json:"filterType,omitempty"`

	// OperatorSpec: The specification for configuring operator behavior. This field is interpreted by the operator and not
	// passed directly to Azure
	OperatorSpec *NamespacesTopicsSubscriptionsRuleOperatorSpec `json:"operatorSpec,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 servicebus.azure.com/NamespacesTopicsSubscription resource
	Owner *genruntime.KnownResourceReference `group:"servicebus.azure.com" json:"owner,omitempty" kind:"NamespacesTopicsSubscription"`

	// SqlFilter: Properties of sqlFilter
	SqlFilter *SqlFilter `json:"sqlFilter,omitempty"`
}

var _ genruntime.ARMTransformer = &NamespacesTopicsSubscriptionsRule_Spec{}

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

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

	// Set property "Properties":
	if rule.Action != nil ||
		rule.CorrelationFilter != nil ||
		rule.FilterType != nil ||
		rule.SqlFilter != nil {
		result.Properties = &arm.Ruleproperties{}
	}
	if rule.Action != nil {
		action_ARM, err := rule.Action.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		action := *action_ARM.(*arm.Action)
		result.Properties.Action = &action
	}
	if rule.CorrelationFilter != nil {
		correlationFilter_ARM, err := rule.CorrelationFilter.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		correlationFilter := *correlationFilter_ARM.(*arm.CorrelationFilter)
		result.Properties.CorrelationFilter = &correlationFilter
	}
	if rule.FilterType != nil {
		var temp string
		temp = string(*rule.FilterType)
		filterType := arm.FilterType(temp)
		result.Properties.FilterType = &filterType
	}
	if rule.SqlFilter != nil {
		sqlFilter_ARM, err := rule.SqlFilter.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		sqlFilter := *sqlFilter_ARM.(*arm.SqlFilter)
		result.Properties.SqlFilter = &sqlFilter
	}
	return result, nil
}

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

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

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

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

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

	// Set property "FilterType":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.FilterType != nil {
			var temp string
			temp = string(*typedInput.Properties.FilterType)
			filterType := FilterType(temp)
			rule.FilterType = &filterType
		}
	}

	// no assignment for property "OperatorSpec"

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

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

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &NamespacesTopicsSubscriptionsRule_Spec{}

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

	// Convert to an intermediate form
	src = &storage.NamespacesTopicsSubscriptionsRule_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_NamespacesTopicsSubscriptionsRule_Spec(src)
	if err != nil {
		return eris.Wrap(err, "final step of conversion in ConvertSpecFrom()")
	}

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.NamespacesTopicsSubscriptionsRule_Spec{}
	err := rule.AssignProperties_To_NamespacesTopicsSubscriptionsRule_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_NamespacesTopicsSubscriptionsRule_Spec populates our NamespacesTopicsSubscriptionsRule_Spec from the provided source NamespacesTopicsSubscriptionsRule_Spec
func (rule *NamespacesTopicsSubscriptionsRule_Spec) AssignProperties_From_NamespacesTopicsSubscriptionsRule_Spec(source *storage.NamespacesTopicsSubscriptionsRule_Spec) error {

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

	// AzureName
	rule.AzureName = source.AzureName

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

	// FilterType
	if source.FilterType != nil {
		filterType := *source.FilterType
		filterTypeTemp := genruntime.ToEnum(filterType, filterType_Values)
		rule.FilterType = &filterTypeTemp
	} else {
		rule.FilterType = nil
	}

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

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

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

	// No error
	return nil
}

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

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

	// AzureName
	destination.AzureName = rule.AzureName

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

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

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

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

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

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

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

	// No error
	return nil
}

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

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

type NamespacesTopicsSubscriptionsRule_STATUS struct {
	// Action: Represents the filter actions which are allowed for the transformation of a message that have been matched by a
	// filter expression.
	Action *Action_STATUS `json:"action,omitempty"`

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

	// CorrelationFilter: Properties of correlationFilter
	CorrelationFilter *CorrelationFilter_STATUS `json:"correlationFilter,omitempty"`

	// FilterType: Filter type that is evaluated against a BrokeredMessage.
	FilterType *FilterType_STATUS `json:"filterType,omitempty"`

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

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

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

	// SqlFilter: Properties of sqlFilter
	SqlFilter *SqlFilter_STATUS `json:"sqlFilter,omitempty"`

	// SystemData: The system meta data relating to this resource.
	SystemData *SystemData_STATUS `json:"systemData,omitempty"`

	// Type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or "Microsoft.EventHub/Namespaces/EventHubs"
	Type *string `json:"type,omitempty"`
}

var _ genruntime.ConvertibleStatus = &NamespacesTopicsSubscriptionsRule_STATUS{}

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

	// Convert to an intermediate form
	src = &storage.NamespacesTopicsSubscriptionsRule_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_NamespacesTopicsSubscriptionsRule_STATUS(src)
	if err != nil {
		return eris.Wrap(err, "final step of conversion in ConvertStatusFrom()")
	}

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.NamespacesTopicsSubscriptionsRule_STATUS{}
	err := rule.AssignProperties_To_NamespacesTopicsSubscriptionsRule_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 = &NamespacesTopicsSubscriptionsRule_STATUS{}

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

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

	// Set property "Action":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Action != nil {
			var action1 Action_STATUS
			err := action1.PopulateFromARM(owner, *typedInput.Properties.Action)
			if err != nil {
				return err
			}
			action := action1
			rule.Action = &action
		}
	}

	// no assignment for property "Conditions"

	// Set property "CorrelationFilter":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CorrelationFilter != nil {
			var correlationFilter1 CorrelationFilter_STATUS
			err := correlationFilter1.PopulateFromARM(owner, *typedInput.Properties.CorrelationFilter)
			if err != nil {
				return err
			}
			correlationFilter := correlationFilter1
			rule.CorrelationFilter = &correlationFilter
		}
	}

	// Set property "FilterType":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.FilterType != nil {
			var temp string
			temp = string(*typedInput.Properties.FilterType)
			filterType := FilterType_STATUS(temp)
			rule.FilterType = &filterType
		}
	}

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

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

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

	// Set property "SqlFilter":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SqlFilter != nil {
			var sqlFilter1 SqlFilter_STATUS
			err := sqlFilter1.PopulateFromARM(owner, *typedInput.Properties.SqlFilter)
			if err != nil {
				return err
			}
			sqlFilter := sqlFilter1
			rule.SqlFilter = &sqlFilter
		}
	}

	// 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 "Type":
	if typedInput.Type != nil {
		typeVar := *typedInput.Type
		rule.Type = &typeVar
	}

	// No error
	return nil
}

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

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

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

	// CorrelationFilter
	if source.CorrelationFilter != nil {
		var correlationFilter CorrelationFilter_STATUS
		err := correlationFilter.AssignProperties_From_CorrelationFilter_STATUS(source.CorrelationFilter)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_CorrelationFilter_STATUS() to populate field CorrelationFilter")
		}
		rule.CorrelationFilter = &correlationFilter
	} else {
		rule.CorrelationFilter = nil
	}

	// FilterType
	if source.FilterType != nil {
		filterType := *source.FilterType
		filterTypeTemp := genruntime.ToEnum(filterType, filterType_STATUS_Values)
		rule.FilterType = &filterTypeTemp
	} else {
		rule.FilterType = nil
	}

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

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

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

	// SqlFilter
	if source.SqlFilter != nil {
		var sqlFilter SqlFilter_STATUS
		err := sqlFilter.AssignProperties_From_SqlFilter_STATUS(source.SqlFilter)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SqlFilter_STATUS() to populate field SqlFilter")
		}
		rule.SqlFilter = &sqlFilter
	} else {
		rule.SqlFilter = 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
	}

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

	// No error
	return nil
}

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

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

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

	// CorrelationFilter
	if rule.CorrelationFilter != nil {
		var correlationFilter storage.CorrelationFilter_STATUS
		err := rule.CorrelationFilter.AssignProperties_To_CorrelationFilter_STATUS(&correlationFilter)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_CorrelationFilter_STATUS() to populate field CorrelationFilter")
		}
		destination.CorrelationFilter = &correlationFilter
	} else {
		destination.CorrelationFilter = nil
	}

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

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

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

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

	// SqlFilter
	if rule.SqlFilter != nil {
		var sqlFilter storage.SqlFilter_STATUS
		err := rule.SqlFilter.AssignProperties_To_SqlFilter_STATUS(&sqlFilter)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SqlFilter_STATUS() to populate field SqlFilter")
		}
		destination.SqlFilter = &sqlFilter
	} else {
		destination.SqlFilter = 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
	}

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

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

	// No error
	return nil
}

// Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter
// expression.
type Action struct {
	// CompatibilityLevel: This property is reserved for future use. An integer value showing the compatibility level,
	// currently hard-coded to 20.
	CompatibilityLevel *int `json:"compatibilityLevel,omitempty"`

	// RequiresPreprocessing: Value that indicates whether the rule action requires preprocessing.
	RequiresPreprocessing *bool `json:"requiresPreprocessing,omitempty"`

	// SqlExpression: SQL expression. e.g. MyProperty='ABC'
	SqlExpression *string `json:"sqlExpression,omitempty"`
}

var _ genruntime.ARMTransformer = &Action{}

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

	// Set property "CompatibilityLevel":
	if action.CompatibilityLevel != nil {
		compatibilityLevel := *action.CompatibilityLevel
		result.CompatibilityLevel = &compatibilityLevel
	}

	// Set property "RequiresPreprocessing":
	if action.RequiresPreprocessing != nil {
		requiresPreprocessing := *action.RequiresPreprocessing
		result.RequiresPreprocessing = &requiresPreprocessing
	}

	// Set property "SqlExpression":
	if action.SqlExpression != nil {
		sqlExpression := *action.SqlExpression
		result.SqlExpression = &sqlExpression
	}
	return result, nil
}

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

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

	// Set property "CompatibilityLevel":
	if typedInput.CompatibilityLevel != nil {
		compatibilityLevel := *typedInput.CompatibilityLevel
		action.CompatibilityLevel = &compatibilityLevel
	}

	// Set property "RequiresPreprocessing":
	if typedInput.RequiresPreprocessing != nil {
		requiresPreprocessing := *typedInput.RequiresPreprocessing
		action.RequiresPreprocessing = &requiresPreprocessing
	}

	// Set property "SqlExpression":
	if typedInput.SqlExpression != nil {
		sqlExpression := *typedInput.SqlExpression
		action.SqlExpression = &sqlExpression
	}

	// No error
	return nil
}

// AssignProperties_From_Action populates our Action from the provided source Action
func (action *Action) AssignProperties_From_Action(source *storage.Action) error {

	// CompatibilityLevel
	action.CompatibilityLevel = genruntime.ClonePointerToInt(source.CompatibilityLevel)

	// RequiresPreprocessing
	if source.RequiresPreprocessing != nil {
		requiresPreprocessing := *source.RequiresPreprocessing
		action.RequiresPreprocessing = &requiresPreprocessing
	} else {
		action.RequiresPreprocessing = nil
	}

	// SqlExpression
	action.SqlExpression = genruntime.ClonePointerToString(source.SqlExpression)

	// No error
	return nil
}

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

	// CompatibilityLevel
	destination.CompatibilityLevel = genruntime.ClonePointerToInt(action.CompatibilityLevel)

	// RequiresPreprocessing
	if action.RequiresPreprocessing != nil {
		requiresPreprocessing := *action.RequiresPreprocessing
		destination.RequiresPreprocessing = &requiresPreprocessing
	} else {
		destination.RequiresPreprocessing = nil
	}

	// SqlExpression
	destination.SqlExpression = genruntime.ClonePointerToString(action.SqlExpression)

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

	// No error
	return nil
}

// Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter
// expression.
type Action_STATUS struct {
	// CompatibilityLevel: This property is reserved for future use. An integer value showing the compatibility level,
	// currently hard-coded to 20.
	CompatibilityLevel *int `json:"compatibilityLevel,omitempty"`

	// RequiresPreprocessing: Value that indicates whether the rule action requires preprocessing.
	RequiresPreprocessing *bool `json:"requiresPreprocessing,omitempty"`

	// SqlExpression: SQL expression. e.g. MyProperty='ABC'
	SqlExpression *string `json:"sqlExpression,omitempty"`
}

var _ genruntime.FromARMConverter = &Action_STATUS{}

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

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

	// Set property "CompatibilityLevel":
	if typedInput.CompatibilityLevel != nil {
		compatibilityLevel := *typedInput.CompatibilityLevel
		action.CompatibilityLevel = &compatibilityLevel
	}

	// Set property "RequiresPreprocessing":
	if typedInput.RequiresPreprocessing != nil {
		requiresPreprocessing := *typedInput.RequiresPreprocessing
		action.RequiresPreprocessing = &requiresPreprocessing
	}

	// Set property "SqlExpression":
	if typedInput.SqlExpression != nil {
		sqlExpression := *typedInput.SqlExpression
		action.SqlExpression = &sqlExpression
	}

	// No error
	return nil
}

// AssignProperties_From_Action_STATUS populates our Action_STATUS from the provided source Action_STATUS
func (action *Action_STATUS) AssignProperties_From_Action_STATUS(source *storage.Action_STATUS) error {

	// CompatibilityLevel
	action.CompatibilityLevel = genruntime.ClonePointerToInt(source.CompatibilityLevel)

	// RequiresPreprocessing
	if source.RequiresPreprocessing != nil {
		requiresPreprocessing := *source.RequiresPreprocessing
		action.RequiresPreprocessing = &requiresPreprocessing
	} else {
		action.RequiresPreprocessing = nil
	}

	// SqlExpression
	action.SqlExpression = genruntime.ClonePointerToString(source.SqlExpression)

	// No error
	return nil
}

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

	// CompatibilityLevel
	destination.CompatibilityLevel = genruntime.ClonePointerToInt(action.CompatibilityLevel)

	// RequiresPreprocessing
	if action.RequiresPreprocessing != nil {
		requiresPreprocessing := *action.RequiresPreprocessing
		destination.RequiresPreprocessing = &requiresPreprocessing
	} else {
		destination.RequiresPreprocessing = nil
	}

	// SqlExpression
	destination.SqlExpression = genruntime.ClonePointerToString(action.SqlExpression)

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

	// No error
	return nil
}

// Represents the correlation filter expression.
type CorrelationFilter struct {
	// ContentType: Content type of the message.
	ContentType *string `json:"contentType,omitempty"`

	// CorrelationId: Identifier of the correlation.
	CorrelationId *string `json:"correlationId,omitempty"`

	// Label: Application specific label.
	Label *string `json:"label,omitempty"`

	// MessageId: Identifier of the message.
	MessageId *string `json:"messageId,omitempty"`

	// Properties: dictionary object for custom filters
	Properties map[string]string `json:"properties,omitempty"`

	// ReplyTo: Address of the queue to reply to.
	ReplyTo *string `json:"replyTo,omitempty"`

	// ReplyToSessionId: Session identifier to reply to.
	ReplyToSessionId *string `json:"replyToSessionId,omitempty"`

	// RequiresPreprocessing: Value that indicates whether the rule action requires preprocessing.
	RequiresPreprocessing *bool `json:"requiresPreprocessing,omitempty"`

	// SessionId: Session identifier.
	SessionId *string `json:"sessionId,omitempty"`

	// To: Address to send to.
	To *string `json:"to,omitempty"`
}

var _ genruntime.ARMTransformer = &CorrelationFilter{}

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

	// Set property "ContentType":
	if filter.ContentType != nil {
		contentType := *filter.ContentType
		result.ContentType = &contentType
	}

	// Set property "CorrelationId":
	if filter.CorrelationId != nil {
		correlationId := *filter.CorrelationId
		result.CorrelationId = &correlationId
	}

	// Set property "Label":
	if filter.Label != nil {
		label := *filter.Label
		result.Label = &label
	}

	// Set property "MessageId":
	if filter.MessageId != nil {
		messageId := *filter.MessageId
		result.MessageId = &messageId
	}

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

	// Set property "ReplyTo":
	if filter.ReplyTo != nil {
		replyTo := *filter.ReplyTo
		result.ReplyTo = &replyTo
	}

	// Set property "ReplyToSessionId":
	if filter.ReplyToSessionId != nil {
		replyToSessionId := *filter.ReplyToSessionId
		result.ReplyToSessionId = &replyToSessionId
	}

	// Set property "RequiresPreprocessing":
	if filter.RequiresPreprocessing != nil {
		requiresPreprocessing := *filter.RequiresPreprocessing
		result.RequiresPreprocessing = &requiresPreprocessing
	}

	// Set property "SessionId":
	if filter.SessionId != nil {
		sessionId := *filter.SessionId
		result.SessionId = &sessionId
	}

	// Set property "To":
	if filter.To != nil {
		to := *filter.To
		result.To = &to
	}
	return result, nil
}

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

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

	// Set property "ContentType":
	if typedInput.ContentType != nil {
		contentType := *typedInput.ContentType
		filter.ContentType = &contentType
	}

	// Set property "CorrelationId":
	if typedInput.CorrelationId != nil {
		correlationId := *typedInput.CorrelationId
		filter.CorrelationId = &correlationId
	}

	// Set property "Label":
	if typedInput.Label != nil {
		label := *typedInput.Label
		filter.Label = &label
	}

	// Set property "MessageId":
	if typedInput.MessageId != nil {
		messageId := *typedInput.MessageId
		filter.MessageId = &messageId
	}

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

	// Set property "ReplyTo":
	if typedInput.ReplyTo != nil {
		replyTo := *typedInput.ReplyTo
		filter.ReplyTo = &replyTo
	}

	// Set property "ReplyToSessionId":
	if typedInput.ReplyToSessionId != nil {
		replyToSessionId := *typedInput.ReplyToSessionId
		filter.ReplyToSessionId = &replyToSessionId
	}

	// Set property "RequiresPreprocessing":
	if typedInput.RequiresPreprocessing != nil {
		requiresPreprocessing := *typedInput.RequiresPreprocessing
		filter.RequiresPreprocessing = &requiresPreprocessing
	}

	// Set property "SessionId":
	if typedInput.SessionId != nil {
		sessionId := *typedInput.SessionId
		filter.SessionId = &sessionId
	}

	// Set property "To":
	if typedInput.To != nil {
		to := *typedInput.To
		filter.To = &to
	}

	// No error
	return nil
}

// AssignProperties_From_CorrelationFilter populates our CorrelationFilter from the provided source CorrelationFilter
func (filter *CorrelationFilter) AssignProperties_From_CorrelationFilter(source *storage.CorrelationFilter) error {

	// ContentType
	filter.ContentType = genruntime.ClonePointerToString(source.ContentType)

	// CorrelationId
	filter.CorrelationId = genruntime.ClonePointerToString(source.CorrelationId)

	// Label
	filter.Label = genruntime.ClonePointerToString(source.Label)

	// MessageId
	filter.MessageId = genruntime.ClonePointerToString(source.MessageId)

	// Properties
	filter.Properties = genruntime.CloneMapOfStringToString(source.Properties)

	// ReplyTo
	filter.ReplyTo = genruntime.ClonePointerToString(source.ReplyTo)

	// ReplyToSessionId
	filter.ReplyToSessionId = genruntime.ClonePointerToString(source.ReplyToSessionId)

	// RequiresPreprocessing
	if source.RequiresPreprocessing != nil {
		requiresPreprocessing := *source.RequiresPreprocessing
		filter.RequiresPreprocessing = &requiresPreprocessing
	} else {
		filter.RequiresPreprocessing = nil
	}

	// SessionId
	filter.SessionId = genruntime.ClonePointerToString(source.SessionId)

	// To
	filter.To = genruntime.ClonePointerToString(source.To)

	// No error
	return nil
}

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

	// ContentType
	destination.ContentType = genruntime.ClonePointerToString(filter.ContentType)

	// CorrelationId
	destination.CorrelationId = genruntime.ClonePointerToString(filter.CorrelationId)

	// Label
	destination.Label = genruntime.ClonePointerToString(filter.Label)

	// MessageId
	destination.MessageId = genruntime.ClonePointerToString(filter.MessageId)

	// Properties
	destination.Properties = genruntime.CloneMapOfStringToString(filter.Properties)

	// ReplyTo
	destination.ReplyTo = genruntime.ClonePointerToString(filter.ReplyTo)

	// ReplyToSessionId
	destination.ReplyToSessionId = genruntime.ClonePointerToString(filter.ReplyToSessionId)

	// RequiresPreprocessing
	if filter.RequiresPreprocessing != nil {
		requiresPreprocessing := *filter.RequiresPreprocessing
		destination.RequiresPreprocessing = &requiresPreprocessing
	} else {
		destination.RequiresPreprocessing = nil
	}

	// SessionId
	destination.SessionId = genruntime.ClonePointerToString(filter.SessionId)

	// To
	destination.To = genruntime.ClonePointerToString(filter.To)

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

	// No error
	return nil
}

// Represents the correlation filter expression.
type CorrelationFilter_STATUS struct {
	// ContentType: Content type of the message.
	ContentType *string `json:"contentType,omitempty"`

	// CorrelationId: Identifier of the correlation.
	CorrelationId *string `json:"correlationId,omitempty"`

	// Label: Application specific label.
	Label *string `json:"label,omitempty"`

	// MessageId: Identifier of the message.
	MessageId *string `json:"messageId,omitempty"`

	// Properties: dictionary object for custom filters
	Properties map[string]string `json:"properties,omitempty"`

	// ReplyTo: Address of the queue to reply to.
	ReplyTo *string `json:"replyTo,omitempty"`

	// ReplyToSessionId: Session identifier to reply to.
	ReplyToSessionId *string `json:"replyToSessionId,omitempty"`

	// RequiresPreprocessing: Value that indicates whether the rule action requires preprocessing.
	RequiresPreprocessing *bool `json:"requiresPreprocessing,omitempty"`

	// SessionId: Session identifier.
	SessionId *string `json:"sessionId,omitempty"`

	// To: Address to send to.
	To *string `json:"to,omitempty"`
}

var _ genruntime.FromARMConverter = &CorrelationFilter_STATUS{}

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

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

	// Set property "ContentType":
	if typedInput.ContentType != nil {
		contentType := *typedInput.ContentType
		filter.ContentType = &contentType
	}

	// Set property "CorrelationId":
	if typedInput.CorrelationId != nil {
		correlationId := *typedInput.CorrelationId
		filter.CorrelationId = &correlationId
	}

	// Set property "Label":
	if typedInput.Label != nil {
		label := *typedInput.Label
		filter.Label = &label
	}

	// Set property "MessageId":
	if typedInput.MessageId != nil {
		messageId := *typedInput.MessageId
		filter.MessageId = &messageId
	}

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

	// Set property "ReplyTo":
	if typedInput.ReplyTo != nil {
		replyTo := *typedInput.ReplyTo
		filter.ReplyTo = &replyTo
	}

	// Set property "ReplyToSessionId":
	if typedInput.ReplyToSessionId != nil {
		replyToSessionId := *typedInput.ReplyToSessionId
		filter.ReplyToSessionId = &replyToSessionId
	}

	// Set property "RequiresPreprocessing":
	if typedInput.RequiresPreprocessing != nil {
		requiresPreprocessing := *typedInput.RequiresPreprocessing
		filter.RequiresPreprocessing = &requiresPreprocessing
	}

	// Set property "SessionId":
	if typedInput.SessionId != nil {
		sessionId := *typedInput.SessionId
		filter.SessionId = &sessionId
	}

	// Set property "To":
	if typedInput.To != nil {
		to := *typedInput.To
		filter.To = &to
	}

	// No error
	return nil
}

// AssignProperties_From_CorrelationFilter_STATUS populates our CorrelationFilter_STATUS from the provided source CorrelationFilter_STATUS
func (filter *CorrelationFilter_STATUS) AssignProperties_From_CorrelationFilter_STATUS(source *storage.CorrelationFilter_STATUS) error {

	// ContentType
	filter.ContentType = genruntime.ClonePointerToString(source.ContentType)

	// CorrelationId
	filter.CorrelationId = genruntime.ClonePointerToString(source.CorrelationId)

	// Label
	filter.Label = genruntime.ClonePointerToString(source.Label)

	// MessageId
	filter.MessageId = genruntime.ClonePointerToString(source.MessageId)

	// Properties
	filter.Properties = genruntime.CloneMapOfStringToString(source.Properties)

	// ReplyTo
	filter.ReplyTo = genruntime.ClonePointerToString(source.ReplyTo)

	// ReplyToSessionId
	filter.ReplyToSessionId = genruntime.ClonePointerToString(source.ReplyToSessionId)

	// RequiresPreprocessing
	if source.RequiresPreprocessing != nil {
		requiresPreprocessing := *source.RequiresPreprocessing
		filter.RequiresPreprocessing = &requiresPreprocessing
	} else {
		filter.RequiresPreprocessing = nil
	}

	// SessionId
	filter.SessionId = genruntime.ClonePointerToString(source.SessionId)

	// To
	filter.To = genruntime.ClonePointerToString(source.To)

	// No error
	return nil
}

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

	// ContentType
	destination.ContentType = genruntime.ClonePointerToString(filter.ContentType)

	// CorrelationId
	destination.CorrelationId = genruntime.ClonePointerToString(filter.CorrelationId)

	// Label
	destination.Label = genruntime.ClonePointerToString(filter.Label)

	// MessageId
	destination.MessageId = genruntime.ClonePointerToString(filter.MessageId)

	// Properties
	destination.Properties = genruntime.CloneMapOfStringToString(filter.Properties)

	// ReplyTo
	destination.ReplyTo = genruntime.ClonePointerToString(filter.ReplyTo)

	// ReplyToSessionId
	destination.ReplyToSessionId = genruntime.ClonePointerToString(filter.ReplyToSessionId)

	// RequiresPreprocessing
	if filter.RequiresPreprocessing != nil {
		requiresPreprocessing := *filter.RequiresPreprocessing
		destination.RequiresPreprocessing = &requiresPreprocessing
	} else {
		destination.RequiresPreprocessing = nil
	}

	// SessionId
	destination.SessionId = genruntime.ClonePointerToString(filter.SessionId)

	// To
	destination.To = genruntime.ClonePointerToString(filter.To)

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

	// No error
	return nil
}

// Rule filter types
// +kubebuilder:validation:Enum={"CorrelationFilter","SqlFilter"}
type FilterType string

const (
	FilterType_CorrelationFilter = FilterType("CorrelationFilter")
	FilterType_SqlFilter         = FilterType("SqlFilter")
)

// Mapping from string to FilterType
var filterType_Values = map[string]FilterType{
	"correlationfilter": FilterType_CorrelationFilter,
	"sqlfilter":         FilterType_SqlFilter,
}

// Rule filter types
type FilterType_STATUS string

const (
	FilterType_STATUS_CorrelationFilter = FilterType_STATUS("CorrelationFilter")
	FilterType_STATUS_SqlFilter         = FilterType_STATUS("SqlFilter")
)

// Mapping from string to FilterType_STATUS
var filterType_STATUS_Values = map[string]FilterType_STATUS{
	"correlationfilter": FilterType_STATUS_CorrelationFilter,
	"sqlfilter":         FilterType_STATUS_SqlFilter,
}

// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure
type NamespacesTopicsSubscriptionsRuleOperatorSpec 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_NamespacesTopicsSubscriptionsRuleOperatorSpec populates our NamespacesTopicsSubscriptionsRuleOperatorSpec from the provided source NamespacesTopicsSubscriptionsRuleOperatorSpec
func (operator *NamespacesTopicsSubscriptionsRuleOperatorSpec) AssignProperties_From_NamespacesTopicsSubscriptionsRuleOperatorSpec(source *storage.NamespacesTopicsSubscriptionsRuleOperatorSpec) 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_NamespacesTopicsSubscriptionsRuleOperatorSpec populates the provided destination NamespacesTopicsSubscriptionsRuleOperatorSpec from our NamespacesTopicsSubscriptionsRuleOperatorSpec
func (operator *NamespacesTopicsSubscriptionsRuleOperatorSpec) AssignProperties_To_NamespacesTopicsSubscriptionsRuleOperatorSpec(destination *storage.NamespacesTopicsSubscriptionsRuleOperatorSpec) 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
}

// Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline.
type SqlFilter struct {
	// CompatibilityLevel: This property is reserved for future use. An integer value showing the compatibility level,
	// currently hard-coded to 20.
	CompatibilityLevel *int `json:"compatibilityLevel,omitempty"`

	// RequiresPreprocessing: Value that indicates whether the rule action requires preprocessing.
	RequiresPreprocessing *bool `json:"requiresPreprocessing,omitempty"`

	// SqlExpression: The SQL expression. e.g. MyProperty='ABC'
	SqlExpression *string `json:"sqlExpression,omitempty"`
}

var _ genruntime.ARMTransformer = &SqlFilter{}

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

	// Set property "CompatibilityLevel":
	if filter.CompatibilityLevel != nil {
		compatibilityLevel := *filter.CompatibilityLevel
		result.CompatibilityLevel = &compatibilityLevel
	}

	// Set property "RequiresPreprocessing":
	if filter.RequiresPreprocessing != nil {
		requiresPreprocessing := *filter.RequiresPreprocessing
		result.RequiresPreprocessing = &requiresPreprocessing
	}

	// Set property "SqlExpression":
	if filter.SqlExpression != nil {
		sqlExpression := *filter.SqlExpression
		result.SqlExpression = &sqlExpression
	}
	return result, nil
}

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

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

	// Set property "CompatibilityLevel":
	if typedInput.CompatibilityLevel != nil {
		compatibilityLevel := *typedInput.CompatibilityLevel
		filter.CompatibilityLevel = &compatibilityLevel
	}

	// Set property "RequiresPreprocessing":
	if typedInput.RequiresPreprocessing != nil {
		requiresPreprocessing := *typedInput.RequiresPreprocessing
		filter.RequiresPreprocessing = &requiresPreprocessing
	}

	// Set property "SqlExpression":
	if typedInput.SqlExpression != nil {
		sqlExpression := *typedInput.SqlExpression
		filter.SqlExpression = &sqlExpression
	}

	// No error
	return nil
}

// AssignProperties_From_SqlFilter populates our SqlFilter from the provided source SqlFilter
func (filter *SqlFilter) AssignProperties_From_SqlFilter(source *storage.SqlFilter) error {

	// CompatibilityLevel
	filter.CompatibilityLevel = genruntime.ClonePointerToInt(source.CompatibilityLevel)

	// RequiresPreprocessing
	if source.RequiresPreprocessing != nil {
		requiresPreprocessing := *source.RequiresPreprocessing
		filter.RequiresPreprocessing = &requiresPreprocessing
	} else {
		filter.RequiresPreprocessing = nil
	}

	// SqlExpression
	filter.SqlExpression = genruntime.ClonePointerToString(source.SqlExpression)

	// No error
	return nil
}

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

	// CompatibilityLevel
	destination.CompatibilityLevel = genruntime.ClonePointerToInt(filter.CompatibilityLevel)

	// RequiresPreprocessing
	if filter.RequiresPreprocessing != nil {
		requiresPreprocessing := *filter.RequiresPreprocessing
		destination.RequiresPreprocessing = &requiresPreprocessing
	} else {
		destination.RequiresPreprocessing = nil
	}

	// SqlExpression
	destination.SqlExpression = genruntime.ClonePointerToString(filter.SqlExpression)

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

	// No error
	return nil
}

// Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline.
type SqlFilter_STATUS struct {
	// CompatibilityLevel: This property is reserved for future use. An integer value showing the compatibility level,
	// currently hard-coded to 20.
	CompatibilityLevel *int `json:"compatibilityLevel,omitempty"`

	// RequiresPreprocessing: Value that indicates whether the rule action requires preprocessing.
	RequiresPreprocessing *bool `json:"requiresPreprocessing,omitempty"`

	// SqlExpression: The SQL expression. e.g. MyProperty='ABC'
	SqlExpression *string `json:"sqlExpression,omitempty"`
}

var _ genruntime.FromARMConverter = &SqlFilter_STATUS{}

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

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

	// Set property "CompatibilityLevel":
	if typedInput.CompatibilityLevel != nil {
		compatibilityLevel := *typedInput.CompatibilityLevel
		filter.CompatibilityLevel = &compatibilityLevel
	}

	// Set property "RequiresPreprocessing":
	if typedInput.RequiresPreprocessing != nil {
		requiresPreprocessing := *typedInput.RequiresPreprocessing
		filter.RequiresPreprocessing = &requiresPreprocessing
	}

	// Set property "SqlExpression":
	if typedInput.SqlExpression != nil {
		sqlExpression := *typedInput.SqlExpression
		filter.SqlExpression = &sqlExpression
	}

	// No error
	return nil
}

// AssignProperties_From_SqlFilter_STATUS populates our SqlFilter_STATUS from the provided source SqlFilter_STATUS
func (filter *SqlFilter_STATUS) AssignProperties_From_SqlFilter_STATUS(source *storage.SqlFilter_STATUS) error {

	// CompatibilityLevel
	filter.CompatibilityLevel = genruntime.ClonePointerToInt(source.CompatibilityLevel)

	// RequiresPreprocessing
	if source.RequiresPreprocessing != nil {
		requiresPreprocessing := *source.RequiresPreprocessing
		filter.RequiresPreprocessing = &requiresPreprocessing
	} else {
		filter.RequiresPreprocessing = nil
	}

	// SqlExpression
	filter.SqlExpression = genruntime.ClonePointerToString(source.SqlExpression)

	// No error
	return nil
}

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

	// CompatibilityLevel
	destination.CompatibilityLevel = genruntime.ClonePointerToInt(filter.CompatibilityLevel)

	// RequiresPreprocessing
	if filter.RequiresPreprocessing != nil {
		requiresPreprocessing := *filter.RequiresPreprocessing
		destination.RequiresPreprocessing = &requiresPreprocessing
	} else {
		destination.RequiresPreprocessing = nil
	}

	// SqlExpression
	destination.SqlExpression = genruntime.ClonePointerToString(filter.SqlExpression)

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

	// No error
	return nil
}

func init() {
	SchemeBuilder.Register(&NamespacesTopicsSubscriptionsRule{}, &NamespacesTopicsSubscriptionsRuleList{})
}
