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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/servicebus/v1api20240101/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/servicebus/v1api20240101/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/stable/2024-01-01/subscriptions.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}
type NamespacesTopicsSubscription struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              NamespacesTopicsSubscription_Spec   `json:"spec,omitempty"`
	Status            NamespacesTopicsSubscription_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &NamespacesTopicsSubscription{}

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

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

var _ conversion.Convertible = &NamespacesTopicsSubscription{}

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

	return subscription.AssignProperties_From_NamespacesTopicsSubscription(source)
}

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

	return subscription.AssignProperties_To_NamespacesTopicsSubscription(destination)
}

var _ configmaps.Exporter = &NamespacesTopicsSubscription{}

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

var _ secrets.Exporter = &NamespacesTopicsSubscription{}

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

var _ genruntime.ImportableResource = &NamespacesTopicsSubscription{}

// InitializeSpec initializes the spec for this resource from the given status
func (subscription *NamespacesTopicsSubscription) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*NamespacesTopicsSubscription_STATUS); ok {
		return subscription.Spec.Initialize_From_NamespacesTopicsSubscription_STATUS(s)
	}

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

var _ genruntime.KubernetesResource = &NamespacesTopicsSubscription{}

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

// GetAPIVersion returns the ARM API version of the resource. This is always "2024-01-01"
func (subscription NamespacesTopicsSubscription) GetAPIVersion() string {
	return "2024-01-01"
}

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

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

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

// GetSupportedOperations returns the operations supported by the resource
func (subscription *NamespacesTopicsSubscription) 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"
func (subscription *NamespacesTopicsSubscription) GetType() string {
	return "Microsoft.ServiceBus/namespaces/topics/subscriptions"
}

// NewEmptyStatus returns a new empty (blank) status
func (subscription *NamespacesTopicsSubscription) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &NamespacesTopicsSubscription_STATUS{}
}

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

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

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

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

	subscription.Status = st
	return nil
}

// AssignProperties_From_NamespacesTopicsSubscription populates our NamespacesTopicsSubscription from the provided source NamespacesTopicsSubscription
func (subscription *NamespacesTopicsSubscription) AssignProperties_From_NamespacesTopicsSubscription(source *storage.NamespacesTopicsSubscription) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_NamespacesTopicsSubscription populates the provided destination NamespacesTopicsSubscription from our NamespacesTopicsSubscription
func (subscription *NamespacesTopicsSubscription) AssignProperties_To_NamespacesTopicsSubscription(destination *storage.NamespacesTopicsSubscription) error {

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

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

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

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

type NamespacesTopicsSubscription_Spec struct {
	// AutoDeleteOnIdle: ISO 8061 timeSpan idle interval after which the topic is automatically deleted. The minimum duration
	// is 5 minutes.
	AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,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"`

	// ClientAffineProperties: Properties specific to client affine subscriptions.
	ClientAffineProperties *SBClientAffineProperties `json:"clientAffineProperties,omitempty"`

	// DeadLetteringOnFilterEvaluationExceptions: Value that indicates whether a subscription has dead letter support on filter
	// evaluation exceptions.
	DeadLetteringOnFilterEvaluationExceptions *bool `json:"deadLetteringOnFilterEvaluationExceptions,omitempty"`

	// DeadLetteringOnMessageExpiration: Value that indicates whether a subscription has dead letter support when a message
	// expires.
	DeadLetteringOnMessageExpiration *bool `json:"deadLetteringOnMessageExpiration,omitempty"`

	// DefaultMessageTimeToLive: ISO 8061 Default message timespan to live value. This is the duration after which the message
	// expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not
	// set on a message itself.
	DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"`

	// DuplicateDetectionHistoryTimeWindow: ISO 8601 timeSpan structure that defines the duration of the duplicate detection
	// history. The default value is 10 minutes.
	DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow,omitempty"`

	// EnableBatchedOperations: Value that indicates whether server-side batched operations are enabled.
	EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"`

	// ForwardDeadLetteredMessagesTo: Queue/Topic name to forward the Dead Letter message
	ForwardDeadLetteredMessagesTo *string `json:"forwardDeadLetteredMessagesTo,omitempty"`

	// ForwardTo: Queue/Topic name to forward the messages
	ForwardTo *string `json:"forwardTo,omitempty"`

	// IsClientAffine: Value that indicates whether the subscription has an affinity to the client id.
	IsClientAffine *bool `json:"isClientAffine,omitempty"`

	// LockDuration: ISO 8061 lock duration timespan for the subscription. The default value is 1 minute.
	LockDuration *string `json:"lockDuration,omitempty"`

	// MaxDeliveryCount: Number of maximum deliveries.
	MaxDeliveryCount *int `json:"maxDeliveryCount,omitempty"`

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

	// RequiresSession: Value indicating if a subscription supports the concept of sessions.
	RequiresSession *bool `json:"requiresSession,omitempty"`
}

var _ genruntime.ARMTransformer = &NamespacesTopicsSubscription_Spec{}

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

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

	// Set property "Properties":
	if subscription.AutoDeleteOnIdle != nil ||
		subscription.ClientAffineProperties != nil ||
		subscription.DeadLetteringOnFilterEvaluationExceptions != nil ||
		subscription.DeadLetteringOnMessageExpiration != nil ||
		subscription.DefaultMessageTimeToLive != nil ||
		subscription.DuplicateDetectionHistoryTimeWindow != nil ||
		subscription.EnableBatchedOperations != nil ||
		subscription.ForwardDeadLetteredMessagesTo != nil ||
		subscription.ForwardTo != nil ||
		subscription.IsClientAffine != nil ||
		subscription.LockDuration != nil ||
		subscription.MaxDeliveryCount != nil ||
		subscription.RequiresSession != nil {
		result.Properties = &arm.SBSubscriptionProperties{}
	}
	if subscription.AutoDeleteOnIdle != nil {
		autoDeleteOnIdle := *subscription.AutoDeleteOnIdle
		result.Properties.AutoDeleteOnIdle = &autoDeleteOnIdle
	}
	if subscription.ClientAffineProperties != nil {
		clientAffineProperties_ARM, err := subscription.ClientAffineProperties.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		clientAffineProperties := *clientAffineProperties_ARM.(*arm.SBClientAffineProperties)
		result.Properties.ClientAffineProperties = &clientAffineProperties
	}
	if subscription.DeadLetteringOnFilterEvaluationExceptions != nil {
		deadLetteringOnFilterEvaluationExceptions := *subscription.DeadLetteringOnFilterEvaluationExceptions
		result.Properties.DeadLetteringOnFilterEvaluationExceptions = &deadLetteringOnFilterEvaluationExceptions
	}
	if subscription.DeadLetteringOnMessageExpiration != nil {
		deadLetteringOnMessageExpiration := *subscription.DeadLetteringOnMessageExpiration
		result.Properties.DeadLetteringOnMessageExpiration = &deadLetteringOnMessageExpiration
	}
	if subscription.DefaultMessageTimeToLive != nil {
		defaultMessageTimeToLive := *subscription.DefaultMessageTimeToLive
		result.Properties.DefaultMessageTimeToLive = &defaultMessageTimeToLive
	}
	if subscription.DuplicateDetectionHistoryTimeWindow != nil {
		duplicateDetectionHistoryTimeWindow := *subscription.DuplicateDetectionHistoryTimeWindow
		result.Properties.DuplicateDetectionHistoryTimeWindow = &duplicateDetectionHistoryTimeWindow
	}
	if subscription.EnableBatchedOperations != nil {
		enableBatchedOperations := *subscription.EnableBatchedOperations
		result.Properties.EnableBatchedOperations = &enableBatchedOperations
	}
	if subscription.ForwardDeadLetteredMessagesTo != nil {
		forwardDeadLetteredMessagesTo := *subscription.ForwardDeadLetteredMessagesTo
		result.Properties.ForwardDeadLetteredMessagesTo = &forwardDeadLetteredMessagesTo
	}
	if subscription.ForwardTo != nil {
		forwardTo := *subscription.ForwardTo
		result.Properties.ForwardTo = &forwardTo
	}
	if subscription.IsClientAffine != nil {
		isClientAffine := *subscription.IsClientAffine
		result.Properties.IsClientAffine = &isClientAffine
	}
	if subscription.LockDuration != nil {
		lockDuration := *subscription.LockDuration
		result.Properties.LockDuration = &lockDuration
	}
	if subscription.MaxDeliveryCount != nil {
		maxDeliveryCount := *subscription.MaxDeliveryCount
		result.Properties.MaxDeliveryCount = &maxDeliveryCount
	}
	if subscription.RequiresSession != nil {
		requiresSession := *subscription.RequiresSession
		result.Properties.RequiresSession = &requiresSession
	}
	return result, nil
}

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

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

	// Set property "AutoDeleteOnIdle":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AutoDeleteOnIdle != nil {
			autoDeleteOnIdle := *typedInput.Properties.AutoDeleteOnIdle
			subscription.AutoDeleteOnIdle = &autoDeleteOnIdle
		}
	}

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

	// Set property "ClientAffineProperties":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ClientAffineProperties != nil {
			var clientAffineProperties1 SBClientAffineProperties
			err := clientAffineProperties1.PopulateFromARM(owner, *typedInput.Properties.ClientAffineProperties)
			if err != nil {
				return err
			}
			clientAffineProperties := clientAffineProperties1
			subscription.ClientAffineProperties = &clientAffineProperties
		}
	}

	// Set property "DeadLetteringOnFilterEvaluationExceptions":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DeadLetteringOnFilterEvaluationExceptions != nil {
			deadLetteringOnFilterEvaluationExceptions := *typedInput.Properties.DeadLetteringOnFilterEvaluationExceptions
			subscription.DeadLetteringOnFilterEvaluationExceptions = &deadLetteringOnFilterEvaluationExceptions
		}
	}

	// Set property "DeadLetteringOnMessageExpiration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DeadLetteringOnMessageExpiration != nil {
			deadLetteringOnMessageExpiration := *typedInput.Properties.DeadLetteringOnMessageExpiration
			subscription.DeadLetteringOnMessageExpiration = &deadLetteringOnMessageExpiration
		}
	}

	// Set property "DefaultMessageTimeToLive":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DefaultMessageTimeToLive != nil {
			defaultMessageTimeToLive := *typedInput.Properties.DefaultMessageTimeToLive
			subscription.DefaultMessageTimeToLive = &defaultMessageTimeToLive
		}
	}

	// Set property "DuplicateDetectionHistoryTimeWindow":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DuplicateDetectionHistoryTimeWindow != nil {
			duplicateDetectionHistoryTimeWindow := *typedInput.Properties.DuplicateDetectionHistoryTimeWindow
			subscription.DuplicateDetectionHistoryTimeWindow = &duplicateDetectionHistoryTimeWindow
		}
	}

	// Set property "EnableBatchedOperations":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableBatchedOperations != nil {
			enableBatchedOperations := *typedInput.Properties.EnableBatchedOperations
			subscription.EnableBatchedOperations = &enableBatchedOperations
		}
	}

	// Set property "ForwardDeadLetteredMessagesTo":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ForwardDeadLetteredMessagesTo != nil {
			forwardDeadLetteredMessagesTo := *typedInput.Properties.ForwardDeadLetteredMessagesTo
			subscription.ForwardDeadLetteredMessagesTo = &forwardDeadLetteredMessagesTo
		}
	}

	// Set property "ForwardTo":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ForwardTo != nil {
			forwardTo := *typedInput.Properties.ForwardTo
			subscription.ForwardTo = &forwardTo
		}
	}

	// Set property "IsClientAffine":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IsClientAffine != nil {
			isClientAffine := *typedInput.Properties.IsClientAffine
			subscription.IsClientAffine = &isClientAffine
		}
	}

	// Set property "LockDuration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.LockDuration != nil {
			lockDuration := *typedInput.Properties.LockDuration
			subscription.LockDuration = &lockDuration
		}
	}

	// Set property "MaxDeliveryCount":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MaxDeliveryCount != nil {
			maxDeliveryCount := *typedInput.Properties.MaxDeliveryCount
			subscription.MaxDeliveryCount = &maxDeliveryCount
		}
	}

	// no assignment for property "OperatorSpec"

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

	// Set property "RequiresSession":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RequiresSession != nil {
			requiresSession := *typedInput.Properties.RequiresSession
			subscription.RequiresSession = &requiresSession
		}
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &NamespacesTopicsSubscription_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.NamespacesTopicsSubscription_Spec{}
	err := subscription.AssignProperties_To_NamespacesTopicsSubscription_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_NamespacesTopicsSubscription_Spec populates our NamespacesTopicsSubscription_Spec from the provided source NamespacesTopicsSubscription_Spec
func (subscription *NamespacesTopicsSubscription_Spec) AssignProperties_From_NamespacesTopicsSubscription_Spec(source *storage.NamespacesTopicsSubscription_Spec) error {

	// AutoDeleteOnIdle
	subscription.AutoDeleteOnIdle = genruntime.ClonePointerToString(source.AutoDeleteOnIdle)

	// AzureName
	subscription.AzureName = source.AzureName

	// ClientAffineProperties
	if source.ClientAffineProperties != nil {
		var clientAffineProperty SBClientAffineProperties
		err := clientAffineProperty.AssignProperties_From_SBClientAffineProperties(source.ClientAffineProperties)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SBClientAffineProperties() to populate field ClientAffineProperties")
		}
		subscription.ClientAffineProperties = &clientAffineProperty
	} else {
		subscription.ClientAffineProperties = nil
	}

	// DeadLetteringOnFilterEvaluationExceptions
	if source.DeadLetteringOnFilterEvaluationExceptions != nil {
		deadLetteringOnFilterEvaluationException := *source.DeadLetteringOnFilterEvaluationExceptions
		subscription.DeadLetteringOnFilterEvaluationExceptions = &deadLetteringOnFilterEvaluationException
	} else {
		subscription.DeadLetteringOnFilterEvaluationExceptions = nil
	}

	// DeadLetteringOnMessageExpiration
	if source.DeadLetteringOnMessageExpiration != nil {
		deadLetteringOnMessageExpiration := *source.DeadLetteringOnMessageExpiration
		subscription.DeadLetteringOnMessageExpiration = &deadLetteringOnMessageExpiration
	} else {
		subscription.DeadLetteringOnMessageExpiration = nil
	}

	// DefaultMessageTimeToLive
	subscription.DefaultMessageTimeToLive = genruntime.ClonePointerToString(source.DefaultMessageTimeToLive)

	// DuplicateDetectionHistoryTimeWindow
	subscription.DuplicateDetectionHistoryTimeWindow = genruntime.ClonePointerToString(source.DuplicateDetectionHistoryTimeWindow)

	// EnableBatchedOperations
	if source.EnableBatchedOperations != nil {
		enableBatchedOperation := *source.EnableBatchedOperations
		subscription.EnableBatchedOperations = &enableBatchedOperation
	} else {
		subscription.EnableBatchedOperations = nil
	}

	// ForwardDeadLetteredMessagesTo
	subscription.ForwardDeadLetteredMessagesTo = genruntime.ClonePointerToString(source.ForwardDeadLetteredMessagesTo)

	// ForwardTo
	subscription.ForwardTo = genruntime.ClonePointerToString(source.ForwardTo)

	// IsClientAffine
	if source.IsClientAffine != nil {
		isClientAffine := *source.IsClientAffine
		subscription.IsClientAffine = &isClientAffine
	} else {
		subscription.IsClientAffine = nil
	}

	// LockDuration
	subscription.LockDuration = genruntime.ClonePointerToString(source.LockDuration)

	// MaxDeliveryCount
	subscription.MaxDeliveryCount = genruntime.ClonePointerToInt(source.MaxDeliveryCount)

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

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

	// RequiresSession
	if source.RequiresSession != nil {
		requiresSession := *source.RequiresSession
		subscription.RequiresSession = &requiresSession
	} else {
		subscription.RequiresSession = nil
	}

	// No error
	return nil
}

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

	// AutoDeleteOnIdle
	destination.AutoDeleteOnIdle = genruntime.ClonePointerToString(subscription.AutoDeleteOnIdle)

	// AzureName
	destination.AzureName = subscription.AzureName

	// ClientAffineProperties
	if subscription.ClientAffineProperties != nil {
		var clientAffineProperty storage.SBClientAffineProperties
		err := subscription.ClientAffineProperties.AssignProperties_To_SBClientAffineProperties(&clientAffineProperty)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SBClientAffineProperties() to populate field ClientAffineProperties")
		}
		destination.ClientAffineProperties = &clientAffineProperty
	} else {
		destination.ClientAffineProperties = nil
	}

	// DeadLetteringOnFilterEvaluationExceptions
	if subscription.DeadLetteringOnFilterEvaluationExceptions != nil {
		deadLetteringOnFilterEvaluationException := *subscription.DeadLetteringOnFilterEvaluationExceptions
		destination.DeadLetteringOnFilterEvaluationExceptions = &deadLetteringOnFilterEvaluationException
	} else {
		destination.DeadLetteringOnFilterEvaluationExceptions = nil
	}

	// DeadLetteringOnMessageExpiration
	if subscription.DeadLetteringOnMessageExpiration != nil {
		deadLetteringOnMessageExpiration := *subscription.DeadLetteringOnMessageExpiration
		destination.DeadLetteringOnMessageExpiration = &deadLetteringOnMessageExpiration
	} else {
		destination.DeadLetteringOnMessageExpiration = nil
	}

	// DefaultMessageTimeToLive
	destination.DefaultMessageTimeToLive = genruntime.ClonePointerToString(subscription.DefaultMessageTimeToLive)

	// DuplicateDetectionHistoryTimeWindow
	destination.DuplicateDetectionHistoryTimeWindow = genruntime.ClonePointerToString(subscription.DuplicateDetectionHistoryTimeWindow)

	// EnableBatchedOperations
	if subscription.EnableBatchedOperations != nil {
		enableBatchedOperation := *subscription.EnableBatchedOperations
		destination.EnableBatchedOperations = &enableBatchedOperation
	} else {
		destination.EnableBatchedOperations = nil
	}

	// ForwardDeadLetteredMessagesTo
	destination.ForwardDeadLetteredMessagesTo = genruntime.ClonePointerToString(subscription.ForwardDeadLetteredMessagesTo)

	// ForwardTo
	destination.ForwardTo = genruntime.ClonePointerToString(subscription.ForwardTo)

	// IsClientAffine
	if subscription.IsClientAffine != nil {
		isClientAffine := *subscription.IsClientAffine
		destination.IsClientAffine = &isClientAffine
	} else {
		destination.IsClientAffine = nil
	}

	// LockDuration
	destination.LockDuration = genruntime.ClonePointerToString(subscription.LockDuration)

	// MaxDeliveryCount
	destination.MaxDeliveryCount = genruntime.ClonePointerToInt(subscription.MaxDeliveryCount)

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

	// OriginalVersion
	destination.OriginalVersion = subscription.OriginalVersion()

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

	// RequiresSession
	if subscription.RequiresSession != nil {
		requiresSession := *subscription.RequiresSession
		destination.RequiresSession = &requiresSession
	} else {
		destination.RequiresSession = nil
	}

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

	// No error
	return nil
}

// Initialize_From_NamespacesTopicsSubscription_STATUS populates our NamespacesTopicsSubscription_Spec from the provided source NamespacesTopicsSubscription_STATUS
func (subscription *NamespacesTopicsSubscription_Spec) Initialize_From_NamespacesTopicsSubscription_STATUS(source *NamespacesTopicsSubscription_STATUS) error {

	// AutoDeleteOnIdle
	subscription.AutoDeleteOnIdle = genruntime.ClonePointerToString(source.AutoDeleteOnIdle)

	// ClientAffineProperties
	if source.ClientAffineProperties != nil {
		var clientAffineProperty SBClientAffineProperties
		err := clientAffineProperty.Initialize_From_SBClientAffineProperties_STATUS(source.ClientAffineProperties)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_SBClientAffineProperties_STATUS() to populate field ClientAffineProperties")
		}
		subscription.ClientAffineProperties = &clientAffineProperty
	} else {
		subscription.ClientAffineProperties = nil
	}

	// DeadLetteringOnFilterEvaluationExceptions
	if source.DeadLetteringOnFilterEvaluationExceptions != nil {
		deadLetteringOnFilterEvaluationException := *source.DeadLetteringOnFilterEvaluationExceptions
		subscription.DeadLetteringOnFilterEvaluationExceptions = &deadLetteringOnFilterEvaluationException
	} else {
		subscription.DeadLetteringOnFilterEvaluationExceptions = nil
	}

	// DeadLetteringOnMessageExpiration
	if source.DeadLetteringOnMessageExpiration != nil {
		deadLetteringOnMessageExpiration := *source.DeadLetteringOnMessageExpiration
		subscription.DeadLetteringOnMessageExpiration = &deadLetteringOnMessageExpiration
	} else {
		subscription.DeadLetteringOnMessageExpiration = nil
	}

	// DefaultMessageTimeToLive
	subscription.DefaultMessageTimeToLive = genruntime.ClonePointerToString(source.DefaultMessageTimeToLive)

	// DuplicateDetectionHistoryTimeWindow
	subscription.DuplicateDetectionHistoryTimeWindow = genruntime.ClonePointerToString(source.DuplicateDetectionHistoryTimeWindow)

	// EnableBatchedOperations
	if source.EnableBatchedOperations != nil {
		enableBatchedOperation := *source.EnableBatchedOperations
		subscription.EnableBatchedOperations = &enableBatchedOperation
	} else {
		subscription.EnableBatchedOperations = nil
	}

	// ForwardDeadLetteredMessagesTo
	subscription.ForwardDeadLetteredMessagesTo = genruntime.ClonePointerToString(source.ForwardDeadLetteredMessagesTo)

	// ForwardTo
	subscription.ForwardTo = genruntime.ClonePointerToString(source.ForwardTo)

	// IsClientAffine
	if source.IsClientAffine != nil {
		isClientAffine := *source.IsClientAffine
		subscription.IsClientAffine = &isClientAffine
	} else {
		subscription.IsClientAffine = nil
	}

	// LockDuration
	subscription.LockDuration = genruntime.ClonePointerToString(source.LockDuration)

	// MaxDeliveryCount
	subscription.MaxDeliveryCount = genruntime.ClonePointerToInt(source.MaxDeliveryCount)

	// RequiresSession
	if source.RequiresSession != nil {
		requiresSession := *source.RequiresSession
		subscription.RequiresSession = &requiresSession
	} else {
		subscription.RequiresSession = nil
	}

	// No error
	return nil
}

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

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

type NamespacesTopicsSubscription_STATUS struct {
	// AccessedAt: Last time there was a receive request to this subscription.
	AccessedAt *string `json:"accessedAt,omitempty"`

	// AutoDeleteOnIdle: ISO 8061 timeSpan idle interval after which the topic is automatically deleted. The minimum duration
	// is 5 minutes.
	AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,omitempty"`

	// ClientAffineProperties: Properties specific to client affine subscriptions.
	ClientAffineProperties *SBClientAffineProperties_STATUS `json:"clientAffineProperties,omitempty"`

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

	// CountDetails: Message count details
	CountDetails *MessageCountDetails_STATUS `json:"countDetails,omitempty"`

	// CreatedAt: Exact time the message was created.
	CreatedAt *string `json:"createdAt,omitempty"`

	// DeadLetteringOnFilterEvaluationExceptions: Value that indicates whether a subscription has dead letter support on filter
	// evaluation exceptions.
	DeadLetteringOnFilterEvaluationExceptions *bool `json:"deadLetteringOnFilterEvaluationExceptions,omitempty"`

	// DeadLetteringOnMessageExpiration: Value that indicates whether a subscription has dead letter support when a message
	// expires.
	DeadLetteringOnMessageExpiration *bool `json:"deadLetteringOnMessageExpiration,omitempty"`

	// DefaultMessageTimeToLive: ISO 8061 Default message timespan to live value. This is the duration after which the message
	// expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not
	// set on a message itself.
	DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"`

	// DuplicateDetectionHistoryTimeWindow: ISO 8601 timeSpan structure that defines the duration of the duplicate detection
	// history. The default value is 10 minutes.
	DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow,omitempty"`

	// EnableBatchedOperations: Value that indicates whether server-side batched operations are enabled.
	EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"`

	// ForwardDeadLetteredMessagesTo: Queue/Topic name to forward the Dead Letter message
	ForwardDeadLetteredMessagesTo *string `json:"forwardDeadLetteredMessagesTo,omitempty"`

	// ForwardTo: Queue/Topic name to forward the messages
	ForwardTo *string `json:"forwardTo,omitempty"`

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

	// IsClientAffine: Value that indicates whether the subscription has an affinity to the client id.
	IsClientAffine *bool `json:"isClientAffine,omitempty"`

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

	// LockDuration: ISO 8061 lock duration timespan for the subscription. The default value is 1 minute.
	LockDuration *string `json:"lockDuration,omitempty"`

	// MaxDeliveryCount: Number of maximum deliveries.
	MaxDeliveryCount *int `json:"maxDeliveryCount,omitempty"`

	// MessageCount: Number of messages.
	MessageCount *int `json:"messageCount,omitempty"`

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

	// RequiresSession: Value indicating if a subscription supports the concept of sessions.
	RequiresSession *bool `json:"requiresSession,omitempty"`

	// Status: Enumerates the possible values for the status of a messaging entity.
	Status *EntityStatus_STATUS `json:"status,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"`

	// UpdatedAt: The exact time the message was updated.
	UpdatedAt *string `json:"updatedAt,omitempty"`
}

var _ genruntime.ConvertibleStatus = &NamespacesTopicsSubscription_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.NamespacesTopicsSubscription_STATUS{}
	err := subscription.AssignProperties_To_NamespacesTopicsSubscription_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 = &NamespacesTopicsSubscription_STATUS{}

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

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

	// Set property "AccessedAt":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AccessedAt != nil {
			accessedAt := *typedInput.Properties.AccessedAt
			subscription.AccessedAt = &accessedAt
		}
	}

	// Set property "AutoDeleteOnIdle":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AutoDeleteOnIdle != nil {
			autoDeleteOnIdle := *typedInput.Properties.AutoDeleteOnIdle
			subscription.AutoDeleteOnIdle = &autoDeleteOnIdle
		}
	}

	// Set property "ClientAffineProperties":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ClientAffineProperties != nil {
			var clientAffineProperties1 SBClientAffineProperties_STATUS
			err := clientAffineProperties1.PopulateFromARM(owner, *typedInput.Properties.ClientAffineProperties)
			if err != nil {
				return err
			}
			clientAffineProperties := clientAffineProperties1
			subscription.ClientAffineProperties = &clientAffineProperties
		}
	}

	// no assignment for property "Conditions"

	// Set property "CountDetails":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CountDetails != nil {
			var countDetails1 MessageCountDetails_STATUS
			err := countDetails1.PopulateFromARM(owner, *typedInput.Properties.CountDetails)
			if err != nil {
				return err
			}
			countDetails := countDetails1
			subscription.CountDetails = &countDetails
		}
	}

	// Set property "CreatedAt":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CreatedAt != nil {
			createdAt := *typedInput.Properties.CreatedAt
			subscription.CreatedAt = &createdAt
		}
	}

	// Set property "DeadLetteringOnFilterEvaluationExceptions":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DeadLetteringOnFilterEvaluationExceptions != nil {
			deadLetteringOnFilterEvaluationExceptions := *typedInput.Properties.DeadLetteringOnFilterEvaluationExceptions
			subscription.DeadLetteringOnFilterEvaluationExceptions = &deadLetteringOnFilterEvaluationExceptions
		}
	}

	// Set property "DeadLetteringOnMessageExpiration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DeadLetteringOnMessageExpiration != nil {
			deadLetteringOnMessageExpiration := *typedInput.Properties.DeadLetteringOnMessageExpiration
			subscription.DeadLetteringOnMessageExpiration = &deadLetteringOnMessageExpiration
		}
	}

	// Set property "DefaultMessageTimeToLive":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DefaultMessageTimeToLive != nil {
			defaultMessageTimeToLive := *typedInput.Properties.DefaultMessageTimeToLive
			subscription.DefaultMessageTimeToLive = &defaultMessageTimeToLive
		}
	}

	// Set property "DuplicateDetectionHistoryTimeWindow":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DuplicateDetectionHistoryTimeWindow != nil {
			duplicateDetectionHistoryTimeWindow := *typedInput.Properties.DuplicateDetectionHistoryTimeWindow
			subscription.DuplicateDetectionHistoryTimeWindow = &duplicateDetectionHistoryTimeWindow
		}
	}

	// Set property "EnableBatchedOperations":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableBatchedOperations != nil {
			enableBatchedOperations := *typedInput.Properties.EnableBatchedOperations
			subscription.EnableBatchedOperations = &enableBatchedOperations
		}
	}

	// Set property "ForwardDeadLetteredMessagesTo":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ForwardDeadLetteredMessagesTo != nil {
			forwardDeadLetteredMessagesTo := *typedInput.Properties.ForwardDeadLetteredMessagesTo
			subscription.ForwardDeadLetteredMessagesTo = &forwardDeadLetteredMessagesTo
		}
	}

	// Set property "ForwardTo":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ForwardTo != nil {
			forwardTo := *typedInput.Properties.ForwardTo
			subscription.ForwardTo = &forwardTo
		}
	}

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

	// Set property "IsClientAffine":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IsClientAffine != nil {
			isClientAffine := *typedInput.Properties.IsClientAffine
			subscription.IsClientAffine = &isClientAffine
		}
	}

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

	// Set property "LockDuration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.LockDuration != nil {
			lockDuration := *typedInput.Properties.LockDuration
			subscription.LockDuration = &lockDuration
		}
	}

	// Set property "MaxDeliveryCount":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MaxDeliveryCount != nil {
			maxDeliveryCount := *typedInput.Properties.MaxDeliveryCount
			subscription.MaxDeliveryCount = &maxDeliveryCount
		}
	}

	// Set property "MessageCount":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MessageCount != nil {
			messageCount := *typedInput.Properties.MessageCount
			subscription.MessageCount = &messageCount
		}
	}

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

	// Set property "RequiresSession":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RequiresSession != nil {
			requiresSession := *typedInput.Properties.RequiresSession
			subscription.RequiresSession = &requiresSession
		}
	}

	// Set property "Status":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Status != nil {
			var temp string
			temp = string(*typedInput.Properties.Status)
			status := EntityStatus_STATUS(temp)
			subscription.Status = &status
		}
	}

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

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

	// Set property "UpdatedAt":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.UpdatedAt != nil {
			updatedAt := *typedInput.Properties.UpdatedAt
			subscription.UpdatedAt = &updatedAt
		}
	}

	// No error
	return nil
}

// AssignProperties_From_NamespacesTopicsSubscription_STATUS populates our NamespacesTopicsSubscription_STATUS from the provided source NamespacesTopicsSubscription_STATUS
func (subscription *NamespacesTopicsSubscription_STATUS) AssignProperties_From_NamespacesTopicsSubscription_STATUS(source *storage.NamespacesTopicsSubscription_STATUS) error {

	// AccessedAt
	subscription.AccessedAt = genruntime.ClonePointerToString(source.AccessedAt)

	// AutoDeleteOnIdle
	subscription.AutoDeleteOnIdle = genruntime.ClonePointerToString(source.AutoDeleteOnIdle)

	// ClientAffineProperties
	if source.ClientAffineProperties != nil {
		var clientAffineProperty SBClientAffineProperties_STATUS
		err := clientAffineProperty.AssignProperties_From_SBClientAffineProperties_STATUS(source.ClientAffineProperties)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SBClientAffineProperties_STATUS() to populate field ClientAffineProperties")
		}
		subscription.ClientAffineProperties = &clientAffineProperty
	} else {
		subscription.ClientAffineProperties = nil
	}

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

	// CountDetails
	if source.CountDetails != nil {
		var countDetail MessageCountDetails_STATUS
		err := countDetail.AssignProperties_From_MessageCountDetails_STATUS(source.CountDetails)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_MessageCountDetails_STATUS() to populate field CountDetails")
		}
		subscription.CountDetails = &countDetail
	} else {
		subscription.CountDetails = nil
	}

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

	// DeadLetteringOnFilterEvaluationExceptions
	if source.DeadLetteringOnFilterEvaluationExceptions != nil {
		deadLetteringOnFilterEvaluationException := *source.DeadLetteringOnFilterEvaluationExceptions
		subscription.DeadLetteringOnFilterEvaluationExceptions = &deadLetteringOnFilterEvaluationException
	} else {
		subscription.DeadLetteringOnFilterEvaluationExceptions = nil
	}

	// DeadLetteringOnMessageExpiration
	if source.DeadLetteringOnMessageExpiration != nil {
		deadLetteringOnMessageExpiration := *source.DeadLetteringOnMessageExpiration
		subscription.DeadLetteringOnMessageExpiration = &deadLetteringOnMessageExpiration
	} else {
		subscription.DeadLetteringOnMessageExpiration = nil
	}

	// DefaultMessageTimeToLive
	subscription.DefaultMessageTimeToLive = genruntime.ClonePointerToString(source.DefaultMessageTimeToLive)

	// DuplicateDetectionHistoryTimeWindow
	subscription.DuplicateDetectionHistoryTimeWindow = genruntime.ClonePointerToString(source.DuplicateDetectionHistoryTimeWindow)

	// EnableBatchedOperations
	if source.EnableBatchedOperations != nil {
		enableBatchedOperation := *source.EnableBatchedOperations
		subscription.EnableBatchedOperations = &enableBatchedOperation
	} else {
		subscription.EnableBatchedOperations = nil
	}

	// ForwardDeadLetteredMessagesTo
	subscription.ForwardDeadLetteredMessagesTo = genruntime.ClonePointerToString(source.ForwardDeadLetteredMessagesTo)

	// ForwardTo
	subscription.ForwardTo = genruntime.ClonePointerToString(source.ForwardTo)

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

	// IsClientAffine
	if source.IsClientAffine != nil {
		isClientAffine := *source.IsClientAffine
		subscription.IsClientAffine = &isClientAffine
	} else {
		subscription.IsClientAffine = nil
	}

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

	// LockDuration
	subscription.LockDuration = genruntime.ClonePointerToString(source.LockDuration)

	// MaxDeliveryCount
	subscription.MaxDeliveryCount = genruntime.ClonePointerToInt(source.MaxDeliveryCount)

	// MessageCount
	subscription.MessageCount = genruntime.ClonePointerToInt(source.MessageCount)

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

	// RequiresSession
	if source.RequiresSession != nil {
		requiresSession := *source.RequiresSession
		subscription.RequiresSession = &requiresSession
	} else {
		subscription.RequiresSession = nil
	}

	// Status
	if source.Status != nil {
		status := *source.Status
		statusTemp := genruntime.ToEnum(status, entityStatus_STATUS_Values)
		subscription.Status = &statusTemp
	} else {
		subscription.Status = 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")
		}
		subscription.SystemData = &systemDatum
	} else {
		subscription.SystemData = nil
	}

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

	// UpdatedAt
	subscription.UpdatedAt = genruntime.ClonePointerToString(source.UpdatedAt)

	// No error
	return nil
}

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

	// AccessedAt
	destination.AccessedAt = genruntime.ClonePointerToString(subscription.AccessedAt)

	// AutoDeleteOnIdle
	destination.AutoDeleteOnIdle = genruntime.ClonePointerToString(subscription.AutoDeleteOnIdle)

	// ClientAffineProperties
	if subscription.ClientAffineProperties != nil {
		var clientAffineProperty storage.SBClientAffineProperties_STATUS
		err := subscription.ClientAffineProperties.AssignProperties_To_SBClientAffineProperties_STATUS(&clientAffineProperty)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SBClientAffineProperties_STATUS() to populate field ClientAffineProperties")
		}
		destination.ClientAffineProperties = &clientAffineProperty
	} else {
		destination.ClientAffineProperties = nil
	}

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

	// CountDetails
	if subscription.CountDetails != nil {
		var countDetail storage.MessageCountDetails_STATUS
		err := subscription.CountDetails.AssignProperties_To_MessageCountDetails_STATUS(&countDetail)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_MessageCountDetails_STATUS() to populate field CountDetails")
		}
		destination.CountDetails = &countDetail
	} else {
		destination.CountDetails = nil
	}

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

	// DeadLetteringOnFilterEvaluationExceptions
	if subscription.DeadLetteringOnFilterEvaluationExceptions != nil {
		deadLetteringOnFilterEvaluationException := *subscription.DeadLetteringOnFilterEvaluationExceptions
		destination.DeadLetteringOnFilterEvaluationExceptions = &deadLetteringOnFilterEvaluationException
	} else {
		destination.DeadLetteringOnFilterEvaluationExceptions = nil
	}

	// DeadLetteringOnMessageExpiration
	if subscription.DeadLetteringOnMessageExpiration != nil {
		deadLetteringOnMessageExpiration := *subscription.DeadLetteringOnMessageExpiration
		destination.DeadLetteringOnMessageExpiration = &deadLetteringOnMessageExpiration
	} else {
		destination.DeadLetteringOnMessageExpiration = nil
	}

	// DefaultMessageTimeToLive
	destination.DefaultMessageTimeToLive = genruntime.ClonePointerToString(subscription.DefaultMessageTimeToLive)

	// DuplicateDetectionHistoryTimeWindow
	destination.DuplicateDetectionHistoryTimeWindow = genruntime.ClonePointerToString(subscription.DuplicateDetectionHistoryTimeWindow)

	// EnableBatchedOperations
	if subscription.EnableBatchedOperations != nil {
		enableBatchedOperation := *subscription.EnableBatchedOperations
		destination.EnableBatchedOperations = &enableBatchedOperation
	} else {
		destination.EnableBatchedOperations = nil
	}

	// ForwardDeadLetteredMessagesTo
	destination.ForwardDeadLetteredMessagesTo = genruntime.ClonePointerToString(subscription.ForwardDeadLetteredMessagesTo)

	// ForwardTo
	destination.ForwardTo = genruntime.ClonePointerToString(subscription.ForwardTo)

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

	// IsClientAffine
	if subscription.IsClientAffine != nil {
		isClientAffine := *subscription.IsClientAffine
		destination.IsClientAffine = &isClientAffine
	} else {
		destination.IsClientAffine = nil
	}

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

	// LockDuration
	destination.LockDuration = genruntime.ClonePointerToString(subscription.LockDuration)

	// MaxDeliveryCount
	destination.MaxDeliveryCount = genruntime.ClonePointerToInt(subscription.MaxDeliveryCount)

	// MessageCount
	destination.MessageCount = genruntime.ClonePointerToInt(subscription.MessageCount)

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

	// RequiresSession
	if subscription.RequiresSession != nil {
		requiresSession := *subscription.RequiresSession
		destination.RequiresSession = &requiresSession
	} else {
		destination.RequiresSession = nil
	}

	// Status
	if subscription.Status != nil {
		status := string(*subscription.Status)
		destination.Status = &status
	} else {
		destination.Status = nil
	}

	// SystemData
	if subscription.SystemData != nil {
		var systemDatum storage.SystemData_STATUS
		err := subscription.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(subscription.Type)

	// UpdatedAt
	destination.UpdatedAt = genruntime.ClonePointerToString(subscription.UpdatedAt)

	// 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 NamespacesTopicsSubscriptionOperatorSpec 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_NamespacesTopicsSubscriptionOperatorSpec populates our NamespacesTopicsSubscriptionOperatorSpec from the provided source NamespacesTopicsSubscriptionOperatorSpec
func (operator *NamespacesTopicsSubscriptionOperatorSpec) AssignProperties_From_NamespacesTopicsSubscriptionOperatorSpec(source *storage.NamespacesTopicsSubscriptionOperatorSpec) 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_NamespacesTopicsSubscriptionOperatorSpec populates the provided destination NamespacesTopicsSubscriptionOperatorSpec from our NamespacesTopicsSubscriptionOperatorSpec
func (operator *NamespacesTopicsSubscriptionOperatorSpec) AssignProperties_To_NamespacesTopicsSubscriptionOperatorSpec(destination *storage.NamespacesTopicsSubscriptionOperatorSpec) 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
}

// Properties specific to client affine subscriptions.
type SBClientAffineProperties struct {
	// ClientId: Indicates the Client ID of the application that created the client-affine subscription.
	ClientId *string `json:"clientId,omitempty"`

	// IsDurable: For client-affine subscriptions, this value indicates whether the subscription is durable or not.
	IsDurable *bool `json:"isDurable,omitempty"`

	// IsShared: For client-affine subscriptions, this value indicates whether the subscription is shared or not.
	IsShared *bool `json:"isShared,omitempty"`
}

var _ genruntime.ARMTransformer = &SBClientAffineProperties{}

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

	// Set property "ClientId":
	if properties.ClientId != nil {
		clientId := *properties.ClientId
		result.ClientId = &clientId
	}

	// Set property "IsDurable":
	if properties.IsDurable != nil {
		isDurable := *properties.IsDurable
		result.IsDurable = &isDurable
	}

	// Set property "IsShared":
	if properties.IsShared != nil {
		isShared := *properties.IsShared
		result.IsShared = &isShared
	}
	return result, nil
}

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

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

	// Set property "ClientId":
	if typedInput.ClientId != nil {
		clientId := *typedInput.ClientId
		properties.ClientId = &clientId
	}

	// Set property "IsDurable":
	if typedInput.IsDurable != nil {
		isDurable := *typedInput.IsDurable
		properties.IsDurable = &isDurable
	}

	// Set property "IsShared":
	if typedInput.IsShared != nil {
		isShared := *typedInput.IsShared
		properties.IsShared = &isShared
	}

	// No error
	return nil
}

// AssignProperties_From_SBClientAffineProperties populates our SBClientAffineProperties from the provided source SBClientAffineProperties
func (properties *SBClientAffineProperties) AssignProperties_From_SBClientAffineProperties(source *storage.SBClientAffineProperties) error {

	// ClientId
	properties.ClientId = genruntime.ClonePointerToString(source.ClientId)

	// IsDurable
	if source.IsDurable != nil {
		isDurable := *source.IsDurable
		properties.IsDurable = &isDurable
	} else {
		properties.IsDurable = nil
	}

	// IsShared
	if source.IsShared != nil {
		isShared := *source.IsShared
		properties.IsShared = &isShared
	} else {
		properties.IsShared = nil
	}

	// No error
	return nil
}

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

	// ClientId
	destination.ClientId = genruntime.ClonePointerToString(properties.ClientId)

	// IsDurable
	if properties.IsDurable != nil {
		isDurable := *properties.IsDurable
		destination.IsDurable = &isDurable
	} else {
		destination.IsDurable = nil
	}

	// IsShared
	if properties.IsShared != nil {
		isShared := *properties.IsShared
		destination.IsShared = &isShared
	} else {
		destination.IsShared = nil
	}

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

	// No error
	return nil
}

// Initialize_From_SBClientAffineProperties_STATUS populates our SBClientAffineProperties from the provided source SBClientAffineProperties_STATUS
func (properties *SBClientAffineProperties) Initialize_From_SBClientAffineProperties_STATUS(source *SBClientAffineProperties_STATUS) error {

	// ClientId
	properties.ClientId = genruntime.ClonePointerToString(source.ClientId)

	// IsDurable
	if source.IsDurable != nil {
		isDurable := *source.IsDurable
		properties.IsDurable = &isDurable
	} else {
		properties.IsDurable = nil
	}

	// IsShared
	if source.IsShared != nil {
		isShared := *source.IsShared
		properties.IsShared = &isShared
	} else {
		properties.IsShared = nil
	}

	// No error
	return nil
}

// Properties specific to client affine subscriptions.
type SBClientAffineProperties_STATUS struct {
	// ClientId: Indicates the Client ID of the application that created the client-affine subscription.
	ClientId *string `json:"clientId,omitempty"`

	// IsDurable: For client-affine subscriptions, this value indicates whether the subscription is durable or not.
	IsDurable *bool `json:"isDurable,omitempty"`

	// IsShared: For client-affine subscriptions, this value indicates whether the subscription is shared or not.
	IsShared *bool `json:"isShared,omitempty"`
}

var _ genruntime.FromARMConverter = &SBClientAffineProperties_STATUS{}

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

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

	// Set property "ClientId":
	if typedInput.ClientId != nil {
		clientId := *typedInput.ClientId
		properties.ClientId = &clientId
	}

	// Set property "IsDurable":
	if typedInput.IsDurable != nil {
		isDurable := *typedInput.IsDurable
		properties.IsDurable = &isDurable
	}

	// Set property "IsShared":
	if typedInput.IsShared != nil {
		isShared := *typedInput.IsShared
		properties.IsShared = &isShared
	}

	// No error
	return nil
}

// AssignProperties_From_SBClientAffineProperties_STATUS populates our SBClientAffineProperties_STATUS from the provided source SBClientAffineProperties_STATUS
func (properties *SBClientAffineProperties_STATUS) AssignProperties_From_SBClientAffineProperties_STATUS(source *storage.SBClientAffineProperties_STATUS) error {

	// ClientId
	properties.ClientId = genruntime.ClonePointerToString(source.ClientId)

	// IsDurable
	if source.IsDurable != nil {
		isDurable := *source.IsDurable
		properties.IsDurable = &isDurable
	} else {
		properties.IsDurable = nil
	}

	// IsShared
	if source.IsShared != nil {
		isShared := *source.IsShared
		properties.IsShared = &isShared
	} else {
		properties.IsShared = nil
	}

	// No error
	return nil
}

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

	// ClientId
	destination.ClientId = genruntime.ClonePointerToString(properties.ClientId)

	// IsDurable
	if properties.IsDurable != nil {
		isDurable := *properties.IsDurable
		destination.IsDurable = &isDurable
	} else {
		destination.IsDurable = nil
	}

	// IsShared
	if properties.IsShared != nil {
		isShared := *properties.IsShared
		destination.IsShared = &isShared
	} else {
		destination.IsShared = nil
	}

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

	// No error
	return nil
}

func init() {
	SchemeBuilder.Register(&NamespacesTopicsSubscription{}, &NamespacesTopicsSubscriptionList{})
}
