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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/servicebus/v1api20211101/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/servicebus/v1api20211101/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/2021-11-01/Queue.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}
type NamespacesQueue struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              NamespacesQueue_Spec   `json:"spec,omitempty"`
	Status            NamespacesQueue_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &NamespacesQueue{}

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

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

var _ conversion.Convertible = &NamespacesQueue{}

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

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

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

	return nil
}

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

	return nil
}

var _ configmaps.Exporter = &NamespacesQueue{}

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

var _ secrets.Exporter = &NamespacesQueue{}

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

var _ genruntime.KubernetesResource = &NamespacesQueue{}

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

// GetAPIVersion returns the ARM API version of the resource. This is always "2021-11-01"
func (queue NamespacesQueue) GetAPIVersion() string {
	return "2021-11-01"
}

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

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

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

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

// NewEmptyStatus returns a new empty (blank) status
func (queue *NamespacesQueue) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &NamespacesQueue_STATUS{}
}

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

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

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

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

	queue.Status = st
	return nil
}

// AssignProperties_From_NamespacesQueue populates our NamespacesQueue from the provided source NamespacesQueue
func (queue *NamespacesQueue) AssignProperties_From_NamespacesQueue(source *storage.NamespacesQueue) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_NamespacesQueue populates the provided destination NamespacesQueue from our NamespacesQueue
func (queue *NamespacesQueue) AssignProperties_To_NamespacesQueue(destination *storage.NamespacesQueue) error {

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /servicebus/resource-manager/Microsoft.ServiceBus/ServiceBus/stable/2021-11-01/Queue.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}
type NamespacesQueueList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []NamespacesQueue `json:"items"`
}

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

	// +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"`

	// DeadLetteringOnMessageExpiration: A value that indicates whether this queue has dead letter support when a message
	// expires.
	DeadLetteringOnMessageExpiration *bool `json:"deadLetteringOnMessageExpiration,omitempty"`

	// DefaultMessageTimeToLive: ISO 8601 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"`

	// EnableExpress: A value that indicates whether Express Entities are enabled. An express queue holds a message in memory
	// temporarily before writing it to persistent storage.
	EnableExpress *bool `json:"enableExpress,omitempty"`

	// EnablePartitioning: A value that indicates whether the queue is to be partitioned across multiple message brokers.
	EnablePartitioning *bool `json:"enablePartitioning,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"`

	// LockDuration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for
	// other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute.
	LockDuration *string `json:"lockDuration,omitempty"`

	// MaxDeliveryCount: The maximum delivery count. A message is automatically deadlettered after this number of deliveries.
	// default value is 10.
	MaxDeliveryCount *int `json:"maxDeliveryCount,omitempty"`

	// MaxMessageSizeInKilobytes: Maximum size (in KB) of the message payload that can be accepted by the queue. This property
	// is only used in Premium today and default is 1024.
	MaxMessageSizeInKilobytes *int `json:"maxMessageSizeInKilobytes,omitempty"`

	// MaxSizeInMegabytes: The maximum size of the queue in megabytes, which is the size of memory allocated for the queue.
	// Default is 1024.
	MaxSizeInMegabytes *int `json:"maxSizeInMegabytes,omitempty"`

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

	// RequiresDuplicateDetection: A value indicating if this queue requires duplicate detection.
	RequiresDuplicateDetection *bool `json:"requiresDuplicateDetection,omitempty"`

	// RequiresSession: A value that indicates whether the queue supports the concept of sessions.
	RequiresSession *bool `json:"requiresSession,omitempty"`
}

var _ genruntime.ARMTransformer = &NamespacesQueue_Spec{}

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

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

	// Set property "Properties":
	if queue.AutoDeleteOnIdle != nil ||
		queue.DeadLetteringOnMessageExpiration != nil ||
		queue.DefaultMessageTimeToLive != nil ||
		queue.DuplicateDetectionHistoryTimeWindow != nil ||
		queue.EnableBatchedOperations != nil ||
		queue.EnableExpress != nil ||
		queue.EnablePartitioning != nil ||
		queue.ForwardDeadLetteredMessagesTo != nil ||
		queue.ForwardTo != nil ||
		queue.LockDuration != nil ||
		queue.MaxDeliveryCount != nil ||
		queue.MaxMessageSizeInKilobytes != nil ||
		queue.MaxSizeInMegabytes != nil ||
		queue.RequiresDuplicateDetection != nil ||
		queue.RequiresSession != nil {
		result.Properties = &arm.SBQueueProperties{}
	}
	if queue.AutoDeleteOnIdle != nil {
		autoDeleteOnIdle := *queue.AutoDeleteOnIdle
		result.Properties.AutoDeleteOnIdle = &autoDeleteOnIdle
	}
	if queue.DeadLetteringOnMessageExpiration != nil {
		deadLetteringOnMessageExpiration := *queue.DeadLetteringOnMessageExpiration
		result.Properties.DeadLetteringOnMessageExpiration = &deadLetteringOnMessageExpiration
	}
	if queue.DefaultMessageTimeToLive != nil {
		defaultMessageTimeToLive := *queue.DefaultMessageTimeToLive
		result.Properties.DefaultMessageTimeToLive = &defaultMessageTimeToLive
	}
	if queue.DuplicateDetectionHistoryTimeWindow != nil {
		duplicateDetectionHistoryTimeWindow := *queue.DuplicateDetectionHistoryTimeWindow
		result.Properties.DuplicateDetectionHistoryTimeWindow = &duplicateDetectionHistoryTimeWindow
	}
	if queue.EnableBatchedOperations != nil {
		enableBatchedOperations := *queue.EnableBatchedOperations
		result.Properties.EnableBatchedOperations = &enableBatchedOperations
	}
	if queue.EnableExpress != nil {
		enableExpress := *queue.EnableExpress
		result.Properties.EnableExpress = &enableExpress
	}
	if queue.EnablePartitioning != nil {
		enablePartitioning := *queue.EnablePartitioning
		result.Properties.EnablePartitioning = &enablePartitioning
	}
	if queue.ForwardDeadLetteredMessagesTo != nil {
		forwardDeadLetteredMessagesTo := *queue.ForwardDeadLetteredMessagesTo
		result.Properties.ForwardDeadLetteredMessagesTo = &forwardDeadLetteredMessagesTo
	}
	if queue.ForwardTo != nil {
		forwardTo := *queue.ForwardTo
		result.Properties.ForwardTo = &forwardTo
	}
	if queue.LockDuration != nil {
		lockDuration := *queue.LockDuration
		result.Properties.LockDuration = &lockDuration
	}
	if queue.MaxDeliveryCount != nil {
		maxDeliveryCount := *queue.MaxDeliveryCount
		result.Properties.MaxDeliveryCount = &maxDeliveryCount
	}
	if queue.MaxMessageSizeInKilobytes != nil {
		maxMessageSizeInKilobytes := *queue.MaxMessageSizeInKilobytes
		result.Properties.MaxMessageSizeInKilobytes = &maxMessageSizeInKilobytes
	}
	if queue.MaxSizeInMegabytes != nil {
		maxSizeInMegabytes := *queue.MaxSizeInMegabytes
		result.Properties.MaxSizeInMegabytes = &maxSizeInMegabytes
	}
	if queue.RequiresDuplicateDetection != nil {
		requiresDuplicateDetection := *queue.RequiresDuplicateDetection
		result.Properties.RequiresDuplicateDetection = &requiresDuplicateDetection
	}
	if queue.RequiresSession != nil {
		requiresSession := *queue.RequiresSession
		result.Properties.RequiresSession = &requiresSession
	}
	return result, nil
}

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

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

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

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

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

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

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

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

	// Set property "EnableExpress":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableExpress != nil {
			enableExpress := *typedInput.Properties.EnableExpress
			queue.EnableExpress = &enableExpress
		}
	}

	// Set property "EnablePartitioning":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnablePartitioning != nil {
			enablePartitioning := *typedInput.Properties.EnablePartitioning
			queue.EnablePartitioning = &enablePartitioning
		}
	}

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

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

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

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

	// Set property "MaxMessageSizeInKilobytes":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MaxMessageSizeInKilobytes != nil {
			maxMessageSizeInKilobytes := *typedInput.Properties.MaxMessageSizeInKilobytes
			queue.MaxMessageSizeInKilobytes = &maxMessageSizeInKilobytes
		}
	}

	// Set property "MaxSizeInMegabytes":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MaxSizeInMegabytes != nil {
			maxSizeInMegabytes := *typedInput.Properties.MaxSizeInMegabytes
			queue.MaxSizeInMegabytes = &maxSizeInMegabytes
		}
	}

	// no assignment for property "OperatorSpec"

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

	// Set property "RequiresDuplicateDetection":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RequiresDuplicateDetection != nil {
			requiresDuplicateDetection := *typedInput.Properties.RequiresDuplicateDetection
			queue.RequiresDuplicateDetection = &requiresDuplicateDetection
		}
	}

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

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &NamespacesQueue_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.NamespacesQueue_Spec{}
	err := queue.AssignProperties_To_NamespacesQueue_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_NamespacesQueue_Spec populates our NamespacesQueue_Spec from the provided source NamespacesQueue_Spec
func (queue *NamespacesQueue_Spec) AssignProperties_From_NamespacesQueue_Spec(source *storage.NamespacesQueue_Spec) error {

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

	// AzureName
	queue.AzureName = source.AzureName

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

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

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

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

	// EnableExpress
	if source.EnableExpress != nil {
		enableExpress := *source.EnableExpress
		queue.EnableExpress = &enableExpress
	} else {
		queue.EnableExpress = nil
	}

	// EnablePartitioning
	if source.EnablePartitioning != nil {
		enablePartitioning := *source.EnablePartitioning
		queue.EnablePartitioning = &enablePartitioning
	} else {
		queue.EnablePartitioning = nil
	}

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

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

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

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

	// MaxMessageSizeInKilobytes
	queue.MaxMessageSizeInKilobytes = genruntime.ClonePointerToInt(source.MaxMessageSizeInKilobytes)

	// MaxSizeInMegabytes
	queue.MaxSizeInMegabytes = genruntime.ClonePointerToInt(source.MaxSizeInMegabytes)

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

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

	// RequiresDuplicateDetection
	if source.RequiresDuplicateDetection != nil {
		requiresDuplicateDetection := *source.RequiresDuplicateDetection
		queue.RequiresDuplicateDetection = &requiresDuplicateDetection
	} else {
		queue.RequiresDuplicateDetection = nil
	}

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

	// No error
	return nil
}

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

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

	// AzureName
	destination.AzureName = queue.AzureName

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

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

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

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

	// EnableExpress
	if queue.EnableExpress != nil {
		enableExpress := *queue.EnableExpress
		destination.EnableExpress = &enableExpress
	} else {
		destination.EnableExpress = nil
	}

	// EnablePartitioning
	if queue.EnablePartitioning != nil {
		enablePartitioning := *queue.EnablePartitioning
		destination.EnablePartitioning = &enablePartitioning
	} else {
		destination.EnablePartitioning = nil
	}

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

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

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

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

	// MaxMessageSizeInKilobytes
	destination.MaxMessageSizeInKilobytes = genruntime.ClonePointerToInt(queue.MaxMessageSizeInKilobytes)

	// MaxSizeInMegabytes
	destination.MaxSizeInMegabytes = genruntime.ClonePointerToInt(queue.MaxSizeInMegabytes)

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

	// OriginalVersion
	destination.OriginalVersion = queue.OriginalVersion()

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

	// RequiresDuplicateDetection
	if queue.RequiresDuplicateDetection != nil {
		requiresDuplicateDetection := *queue.RequiresDuplicateDetection
		destination.RequiresDuplicateDetection = &requiresDuplicateDetection
	} else {
		destination.RequiresDuplicateDetection = nil
	}

	// RequiresSession
	if queue.RequiresSession != nil {
		requiresSession := *queue.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
}

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

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

type NamespacesQueue_STATUS struct {
	// AccessedAt: Last time a message was sent, or the last time there was a receive request to this queue.
	AccessedAt *string `json:"accessedAt,omitempty"`

	// AutoDeleteOnIdle: ISO 8061 timeSpan idle interval after which the queue is automatically deleted. The minimum duration
	// is 5 minutes.
	AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,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: The exact time the message was created.
	CreatedAt *string `json:"createdAt,omitempty"`

	// DeadLetteringOnMessageExpiration: A value that indicates whether this queue has dead letter support when a message
	// expires.
	DeadLetteringOnMessageExpiration *bool `json:"deadLetteringOnMessageExpiration,omitempty"`

	// DefaultMessageTimeToLive: ISO 8601 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"`

	// EnableExpress: A value that indicates whether Express Entities are enabled. An express queue holds a message in memory
	// temporarily before writing it to persistent storage.
	EnableExpress *bool `json:"enableExpress,omitempty"`

	// EnablePartitioning: A value that indicates whether the queue is to be partitioned across multiple message brokers.
	EnablePartitioning *bool `json:"enablePartitioning,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"`

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

	// LockDuration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for
	// other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute.
	LockDuration *string `json:"lockDuration,omitempty"`

	// MaxDeliveryCount: The maximum delivery count. A message is automatically deadlettered after this number of deliveries.
	// default value is 10.
	MaxDeliveryCount *int `json:"maxDeliveryCount,omitempty"`

	// MaxMessageSizeInKilobytes: Maximum size (in KB) of the message payload that can be accepted by the queue. This property
	// is only used in Premium today and default is 1024.
	MaxMessageSizeInKilobytes *int `json:"maxMessageSizeInKilobytes,omitempty"`

	// MaxSizeInMegabytes: The maximum size of the queue in megabytes, which is the size of memory allocated for the queue.
	// Default is 1024.
	MaxSizeInMegabytes *int `json:"maxSizeInMegabytes,omitempty"`

	// MessageCount: The number of messages in the queue.
	MessageCount *int `json:"messageCount,omitempty"`

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

	// RequiresDuplicateDetection: A value indicating if this queue requires duplicate detection.
	RequiresDuplicateDetection *bool `json:"requiresDuplicateDetection,omitempty"`

	// RequiresSession: A value that indicates whether the queue supports the concept of sessions.
	RequiresSession *bool `json:"requiresSession,omitempty"`

	// SizeInBytes: The size of the queue, in bytes.
	SizeInBytes *int `json:"sizeInBytes,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 = &NamespacesQueue_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.NamespacesQueue_STATUS{}
	err := queue.AssignProperties_To_NamespacesQueue_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 = &NamespacesQueue_STATUS{}

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

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

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

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

	// 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
			queue.CountDetails = &countDetails
		}
	}

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

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

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

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

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

	// Set property "EnableExpress":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableExpress != nil {
			enableExpress := *typedInput.Properties.EnableExpress
			queue.EnableExpress = &enableExpress
		}
	}

	// Set property "EnablePartitioning":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnablePartitioning != nil {
			enablePartitioning := *typedInput.Properties.EnablePartitioning
			queue.EnablePartitioning = &enablePartitioning
		}
	}

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

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

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

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

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

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

	// Set property "MaxMessageSizeInKilobytes":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MaxMessageSizeInKilobytes != nil {
			maxMessageSizeInKilobytes := *typedInput.Properties.MaxMessageSizeInKilobytes
			queue.MaxMessageSizeInKilobytes = &maxMessageSizeInKilobytes
		}
	}

	// Set property "MaxSizeInMegabytes":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MaxSizeInMegabytes != nil {
			maxSizeInMegabytes := *typedInput.Properties.MaxSizeInMegabytes
			queue.MaxSizeInMegabytes = &maxSizeInMegabytes
		}
	}

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

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

	// Set property "RequiresDuplicateDetection":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RequiresDuplicateDetection != nil {
			requiresDuplicateDetection := *typedInput.Properties.RequiresDuplicateDetection
			queue.RequiresDuplicateDetection = &requiresDuplicateDetection
		}
	}

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

	// Set property "SizeInBytes":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SizeInBytes != nil {
			sizeInBytes := *typedInput.Properties.SizeInBytes
			queue.SizeInBytes = &sizeInBytes
		}
	}

	// 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)
			queue.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
		queue.SystemData = &systemData
	}

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

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

	// No error
	return nil
}

// AssignProperties_From_NamespacesQueue_STATUS populates our NamespacesQueue_STATUS from the provided source NamespacesQueue_STATUS
func (queue *NamespacesQueue_STATUS) AssignProperties_From_NamespacesQueue_STATUS(source *storage.NamespacesQueue_STATUS) error {

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

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

	// Conditions
	queue.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")
		}
		queue.CountDetails = &countDetail
	} else {
		queue.CountDetails = nil
	}

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

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

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

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

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

	// EnableExpress
	if source.EnableExpress != nil {
		enableExpress := *source.EnableExpress
		queue.EnableExpress = &enableExpress
	} else {
		queue.EnableExpress = nil
	}

	// EnablePartitioning
	if source.EnablePartitioning != nil {
		enablePartitioning := *source.EnablePartitioning
		queue.EnablePartitioning = &enablePartitioning
	} else {
		queue.EnablePartitioning = nil
	}

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

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

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

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

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

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

	// MaxMessageSizeInKilobytes
	queue.MaxMessageSizeInKilobytes = genruntime.ClonePointerToInt(source.MaxMessageSizeInKilobytes)

	// MaxSizeInMegabytes
	queue.MaxSizeInMegabytes = genruntime.ClonePointerToInt(source.MaxSizeInMegabytes)

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

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

	// RequiresDuplicateDetection
	if source.RequiresDuplicateDetection != nil {
		requiresDuplicateDetection := *source.RequiresDuplicateDetection
		queue.RequiresDuplicateDetection = &requiresDuplicateDetection
	} else {
		queue.RequiresDuplicateDetection = nil
	}

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

	// SizeInBytes
	queue.SizeInBytes = genruntime.ClonePointerToInt(source.SizeInBytes)

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

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

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

	// No error
	return nil
}

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

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

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

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

	// CountDetails
	if queue.CountDetails != nil {
		var countDetail storage.MessageCountDetails_STATUS
		err := queue.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(queue.CreatedAt)

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

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

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

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

	// EnableExpress
	if queue.EnableExpress != nil {
		enableExpress := *queue.EnableExpress
		destination.EnableExpress = &enableExpress
	} else {
		destination.EnableExpress = nil
	}

	// EnablePartitioning
	if queue.EnablePartitioning != nil {
		enablePartitioning := *queue.EnablePartitioning
		destination.EnablePartitioning = &enablePartitioning
	} else {
		destination.EnablePartitioning = nil
	}

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

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

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

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

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

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

	// MaxMessageSizeInKilobytes
	destination.MaxMessageSizeInKilobytes = genruntime.ClonePointerToInt(queue.MaxMessageSizeInKilobytes)

	// MaxSizeInMegabytes
	destination.MaxSizeInMegabytes = genruntime.ClonePointerToInt(queue.MaxSizeInMegabytes)

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

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

	// RequiresDuplicateDetection
	if queue.RequiresDuplicateDetection != nil {
		requiresDuplicateDetection := *queue.RequiresDuplicateDetection
		destination.RequiresDuplicateDetection = &requiresDuplicateDetection
	} else {
		destination.RequiresDuplicateDetection = nil
	}

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

	// SizeInBytes
	destination.SizeInBytes = genruntime.ClonePointerToInt(queue.SizeInBytes)

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

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

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

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

	// No error
	return nil
}

// Entity status.
type EntityStatus_STATUS string

const (
	EntityStatus_STATUS_Active          = EntityStatus_STATUS("Active")
	EntityStatus_STATUS_Creating        = EntityStatus_STATUS("Creating")
	EntityStatus_STATUS_Deleting        = EntityStatus_STATUS("Deleting")
	EntityStatus_STATUS_Disabled        = EntityStatus_STATUS("Disabled")
	EntityStatus_STATUS_ReceiveDisabled = EntityStatus_STATUS("ReceiveDisabled")
	EntityStatus_STATUS_Renaming        = EntityStatus_STATUS("Renaming")
	EntityStatus_STATUS_Restoring       = EntityStatus_STATUS("Restoring")
	EntityStatus_STATUS_SendDisabled    = EntityStatus_STATUS("SendDisabled")
	EntityStatus_STATUS_Unknown         = EntityStatus_STATUS("Unknown")
)

// Mapping from string to EntityStatus_STATUS
var entityStatus_STATUS_Values = map[string]EntityStatus_STATUS{
	"active":          EntityStatus_STATUS_Active,
	"creating":        EntityStatus_STATUS_Creating,
	"deleting":        EntityStatus_STATUS_Deleting,
	"disabled":        EntityStatus_STATUS_Disabled,
	"receivedisabled": EntityStatus_STATUS_ReceiveDisabled,
	"renaming":        EntityStatus_STATUS_Renaming,
	"restoring":       EntityStatus_STATUS_Restoring,
	"senddisabled":    EntityStatus_STATUS_SendDisabled,
	"unknown":         EntityStatus_STATUS_Unknown,
}

// Message Count Details.
type MessageCountDetails_STATUS struct {
	// ActiveMessageCount: Number of active messages in the queue, topic, or subscription.
	ActiveMessageCount *int `json:"activeMessageCount,omitempty"`

	// DeadLetterMessageCount: Number of messages that are dead lettered.
	DeadLetterMessageCount *int `json:"deadLetterMessageCount,omitempty"`

	// ScheduledMessageCount: Number of scheduled messages.
	ScheduledMessageCount *int `json:"scheduledMessageCount,omitempty"`

	// TransferDeadLetterMessageCount: Number of messages transferred into dead letters.
	TransferDeadLetterMessageCount *int `json:"transferDeadLetterMessageCount,omitempty"`

	// TransferMessageCount: Number of messages transferred to another queue, topic, or subscription.
	TransferMessageCount *int `json:"transferMessageCount,omitempty"`
}

var _ genruntime.FromARMConverter = &MessageCountDetails_STATUS{}

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

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

	// Set property "ActiveMessageCount":
	if typedInput.ActiveMessageCount != nil {
		activeMessageCount := *typedInput.ActiveMessageCount
		details.ActiveMessageCount = &activeMessageCount
	}

	// Set property "DeadLetterMessageCount":
	if typedInput.DeadLetterMessageCount != nil {
		deadLetterMessageCount := *typedInput.DeadLetterMessageCount
		details.DeadLetterMessageCount = &deadLetterMessageCount
	}

	// Set property "ScheduledMessageCount":
	if typedInput.ScheduledMessageCount != nil {
		scheduledMessageCount := *typedInput.ScheduledMessageCount
		details.ScheduledMessageCount = &scheduledMessageCount
	}

	// Set property "TransferDeadLetterMessageCount":
	if typedInput.TransferDeadLetterMessageCount != nil {
		transferDeadLetterMessageCount := *typedInput.TransferDeadLetterMessageCount
		details.TransferDeadLetterMessageCount = &transferDeadLetterMessageCount
	}

	// Set property "TransferMessageCount":
	if typedInput.TransferMessageCount != nil {
		transferMessageCount := *typedInput.TransferMessageCount
		details.TransferMessageCount = &transferMessageCount
	}

	// No error
	return nil
}

// AssignProperties_From_MessageCountDetails_STATUS populates our MessageCountDetails_STATUS from the provided source MessageCountDetails_STATUS
func (details *MessageCountDetails_STATUS) AssignProperties_From_MessageCountDetails_STATUS(source *storage.MessageCountDetails_STATUS) error {

	// ActiveMessageCount
	details.ActiveMessageCount = genruntime.ClonePointerToInt(source.ActiveMessageCount)

	// DeadLetterMessageCount
	details.DeadLetterMessageCount = genruntime.ClonePointerToInt(source.DeadLetterMessageCount)

	// ScheduledMessageCount
	details.ScheduledMessageCount = genruntime.ClonePointerToInt(source.ScheduledMessageCount)

	// TransferDeadLetterMessageCount
	details.TransferDeadLetterMessageCount = genruntime.ClonePointerToInt(source.TransferDeadLetterMessageCount)

	// TransferMessageCount
	details.TransferMessageCount = genruntime.ClonePointerToInt(source.TransferMessageCount)

	// No error
	return nil
}

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

	// ActiveMessageCount
	destination.ActiveMessageCount = genruntime.ClonePointerToInt(details.ActiveMessageCount)

	// DeadLetterMessageCount
	destination.DeadLetterMessageCount = genruntime.ClonePointerToInt(details.DeadLetterMessageCount)

	// ScheduledMessageCount
	destination.ScheduledMessageCount = genruntime.ClonePointerToInt(details.ScheduledMessageCount)

	// TransferDeadLetterMessageCount
	destination.TransferDeadLetterMessageCount = genruntime.ClonePointerToInt(details.TransferDeadLetterMessageCount)

	// TransferMessageCount
	destination.TransferMessageCount = genruntime.ClonePointerToInt(details.TransferMessageCount)

	// 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 NamespacesQueueOperatorSpec 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_NamespacesQueueOperatorSpec populates our NamespacesQueueOperatorSpec from the provided source NamespacesQueueOperatorSpec
func (operator *NamespacesQueueOperatorSpec) AssignProperties_From_NamespacesQueueOperatorSpec(source *storage.NamespacesQueueOperatorSpec) 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_NamespacesQueueOperatorSpec populates the provided destination NamespacesQueueOperatorSpec from our NamespacesQueueOperatorSpec
func (operator *NamespacesQueueOperatorSpec) AssignProperties_To_NamespacesQueueOperatorSpec(destination *storage.NamespacesQueueOperatorSpec) 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
}

func init() {
	SchemeBuilder.Register(&NamespacesQueue{}, &NamespacesQueueList{})
}
