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

import (
	"fmt"
	storage "github.com/Azure/azure-service-operator/v2/api/eventhub/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,eventhub}
// +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"
// Storage version of v1api20211101.NamespacesEventhub
// Generator information:
// - Generated from: /eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/eventhubs.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}
type NamespacesEventhub struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              NamespacesEventhub_Spec   `json:"spec,omitempty"`
	Status            NamespacesEventhub_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &NamespacesEventhub{}

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

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

var _ conversion.Convertible = &NamespacesEventhub{}

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

	return eventhub.AssignProperties_From_NamespacesEventhub(source)
}

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

	return eventhub.AssignProperties_To_NamespacesEventhub(destination)
}

var _ configmaps.Exporter = &NamespacesEventhub{}

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

var _ secrets.Exporter = &NamespacesEventhub{}

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

var _ genruntime.KubernetesResource = &NamespacesEventhub{}

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

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

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.EventHub/namespaces/eventhubs"
func (eventhub *NamespacesEventhub) GetType() string {
	return "Microsoft.EventHub/namespaces/eventhubs"
}

// NewEmptyStatus returns a new empty (blank) status
func (eventhub *NamespacesEventhub) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &NamespacesEventhub_STATUS{}
}

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

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

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

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

	eventhub.Status = st
	return nil
}

// AssignProperties_From_NamespacesEventhub populates our NamespacesEventhub from the provided source NamespacesEventhub
func (eventhub *NamespacesEventhub) AssignProperties_From_NamespacesEventhub(source *storage.NamespacesEventhub) error {

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

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

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

	// Invoke the augmentConversionForNamespacesEventhub interface (if implemented) to customize the conversion
	var eventhubAsAny any = eventhub
	if augmentedEventhub, ok := eventhubAsAny.(augmentConversionForNamespacesEventhub); ok {
		err := augmentedEventhub.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_NamespacesEventhub populates the provided destination NamespacesEventhub from our NamespacesEventhub
func (eventhub *NamespacesEventhub) AssignProperties_To_NamespacesEventhub(destination *storage.NamespacesEventhub) error {

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

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

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

	// Invoke the augmentConversionForNamespacesEventhub interface (if implemented) to customize the conversion
	var eventhubAsAny any = eventhub
	if augmentedEventhub, ok := eventhubAsAny.(augmentConversionForNamespacesEventhub); ok {
		err := augmentedEventhub.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

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

// +kubebuilder:object:root=true
// Storage version of v1api20211101.NamespacesEventhub
// Generator information:
// - Generated from: /eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/eventhubs.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}
type NamespacesEventhubList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []NamespacesEventhub `json:"items"`
}

type augmentConversionForNamespacesEventhub interface {
	AssignPropertiesFrom(src *storage.NamespacesEventhub) error
	AssignPropertiesTo(dst *storage.NamespacesEventhub) error
}

// Storage version of v1api20211101.NamespacesEventhub_Spec
type NamespacesEventhub_Spec struct {
	// 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"`
	CaptureDescription     *CaptureDescription             `json:"captureDescription,omitempty"`
	MessageRetentionInDays *int                            `json:"messageRetentionInDays,omitempty"`
	OperatorSpec           *NamespacesEventhubOperatorSpec `json:"operatorSpec,omitempty"`
	OriginalVersion        string                          `json:"originalVersion,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 eventhub.azure.com/Namespace resource
	Owner          *genruntime.KnownResourceReference `group:"eventhub.azure.com" json:"owner,omitempty" kind:"Namespace"`
	PartitionCount *int                               `json:"partitionCount,omitempty"`
	PropertyBag    genruntime.PropertyBag             `json:"$propertyBag,omitempty"`
}

var _ genruntime.ConvertibleSpec = &NamespacesEventhub_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.NamespacesEventhub_Spec{}
	err := eventhub.AssignProperties_To_NamespacesEventhub_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_NamespacesEventhub_Spec populates our NamespacesEventhub_Spec from the provided source NamespacesEventhub_Spec
func (eventhub *NamespacesEventhub_Spec) AssignProperties_From_NamespacesEventhub_Spec(source *storage.NamespacesEventhub_Spec) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// AzureName
	eventhub.AzureName = source.AzureName

	// CaptureDescription
	if source.CaptureDescription != nil {
		var captureDescription CaptureDescription
		err := captureDescription.AssignProperties_From_CaptureDescription(source.CaptureDescription)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_CaptureDescription() to populate field CaptureDescription")
		}
		eventhub.CaptureDescription = &captureDescription
	} else {
		eventhub.CaptureDescription = nil
	}

	// MessageRetentionInDays
	eventhub.MessageRetentionInDays = genruntime.ClonePointerToInt(source.MessageRetentionInDays)

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

	// OriginalVersion
	eventhub.OriginalVersion = source.OriginalVersion

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

	// PartitionCount
	eventhub.PartitionCount = genruntime.ClonePointerToInt(source.PartitionCount)

	// RetentionDescription
	if source.RetentionDescription != nil {
		propertyBag.Add("RetentionDescription", *source.RetentionDescription)
	} else {
		propertyBag.Remove("RetentionDescription")
	}

	// UserMetadata
	if source.UserMetadata != nil {
		propertyBag.Add("UserMetadata", *source.UserMetadata)
	} else {
		propertyBag.Remove("UserMetadata")
	}

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

	// Invoke the augmentConversionForNamespacesEventhub_Spec interface (if implemented) to customize the conversion
	var eventhubAsAny any = eventhub
	if augmentedEventhub, ok := eventhubAsAny.(augmentConversionForNamespacesEventhub_Spec); ok {
		err := augmentedEventhub.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_NamespacesEventhub_Spec populates the provided destination NamespacesEventhub_Spec from our NamespacesEventhub_Spec
func (eventhub *NamespacesEventhub_Spec) AssignProperties_To_NamespacesEventhub_Spec(destination *storage.NamespacesEventhub_Spec) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(eventhub.PropertyBag)

	// AzureName
	destination.AzureName = eventhub.AzureName

	// CaptureDescription
	if eventhub.CaptureDescription != nil {
		var captureDescription storage.CaptureDescription
		err := eventhub.CaptureDescription.AssignProperties_To_CaptureDescription(&captureDescription)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_CaptureDescription() to populate field CaptureDescription")
		}
		destination.CaptureDescription = &captureDescription
	} else {
		destination.CaptureDescription = nil
	}

	// MessageRetentionInDays
	destination.MessageRetentionInDays = genruntime.ClonePointerToInt(eventhub.MessageRetentionInDays)

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

	// OriginalVersion
	destination.OriginalVersion = eventhub.OriginalVersion

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

	// PartitionCount
	destination.PartitionCount = genruntime.ClonePointerToInt(eventhub.PartitionCount)

	// RetentionDescription
	if propertyBag.Contains("RetentionDescription") {
		var retentionDescription storage.RetentionDescription
		err := propertyBag.Pull("RetentionDescription", &retentionDescription)
		if err != nil {
			return eris.Wrap(err, "pulling 'RetentionDescription' from propertyBag")
		}

		destination.RetentionDescription = &retentionDescription
	} else {
		destination.RetentionDescription = nil
	}

	// UserMetadata
	if propertyBag.Contains("UserMetadata") {
		var userMetadatum string
		err := propertyBag.Pull("UserMetadata", &userMetadatum)
		if err != nil {
			return eris.Wrap(err, "pulling 'UserMetadata' from propertyBag")
		}

		destination.UserMetadata = &userMetadatum
	} else {
		destination.UserMetadata = nil
	}

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

	// Invoke the augmentConversionForNamespacesEventhub_Spec interface (if implemented) to customize the conversion
	var eventhubAsAny any = eventhub
	if augmentedEventhub, ok := eventhubAsAny.(augmentConversionForNamespacesEventhub_Spec); ok {
		err := augmentedEventhub.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20211101.NamespacesEventhub_STATUS
type NamespacesEventhub_STATUS struct {
	CaptureDescription     *CaptureDescription_STATUS `json:"captureDescription,omitempty"`
	Conditions             []conditions.Condition     `json:"conditions,omitempty"`
	CreatedAt              *string                    `json:"createdAt,omitempty"`
	Id                     *string                    `json:"id,omitempty"`
	Location               *string                    `json:"location,omitempty"`
	MessageRetentionInDays *int                       `json:"messageRetentionInDays,omitempty"`
	Name                   *string                    `json:"name,omitempty"`
	PartitionCount         *int                       `json:"partitionCount,omitempty"`
	PartitionIds           []string                   `json:"partitionIds,omitempty"`
	PropertyBag            genruntime.PropertyBag     `json:"$propertyBag,omitempty"`
	Status                 *string                    `json:"status,omitempty"`
	SystemData             *SystemData_STATUS         `json:"systemData,omitempty"`
	Type                   *string                    `json:"type,omitempty"`
	UpdatedAt              *string                    `json:"updatedAt,omitempty"`
}

var _ genruntime.ConvertibleStatus = &NamespacesEventhub_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.NamespacesEventhub_STATUS{}
	err := eventhub.AssignProperties_To_NamespacesEventhub_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
}

// AssignProperties_From_NamespacesEventhub_STATUS populates our NamespacesEventhub_STATUS from the provided source NamespacesEventhub_STATUS
func (eventhub *NamespacesEventhub_STATUS) AssignProperties_From_NamespacesEventhub_STATUS(source *storage.NamespacesEventhub_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// CaptureDescription
	if source.CaptureDescription != nil {
		var captureDescription CaptureDescription_STATUS
		err := captureDescription.AssignProperties_From_CaptureDescription_STATUS(source.CaptureDescription)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_CaptureDescription_STATUS() to populate field CaptureDescription")
		}
		eventhub.CaptureDescription = &captureDescription
	} else {
		eventhub.CaptureDescription = nil
	}

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

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

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

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

	// MessageRetentionInDays
	eventhub.MessageRetentionInDays = genruntime.ClonePointerToInt(source.MessageRetentionInDays)

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

	// PartitionCount
	eventhub.PartitionCount = genruntime.ClonePointerToInt(source.PartitionCount)

	// PartitionIds
	eventhub.PartitionIds = genruntime.CloneSliceOfString(source.PartitionIds)

	// RetentionDescription
	if source.RetentionDescription != nil {
		propertyBag.Add("RetentionDescription", *source.RetentionDescription)
	} else {
		propertyBag.Remove("RetentionDescription")
	}

	// Status
	eventhub.Status = genruntime.ClonePointerToString(source.Status)

	// 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")
		}
		eventhub.SystemData = &systemDatum
	} else {
		eventhub.SystemData = nil
	}

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

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

	// UserMetadata
	if source.UserMetadata != nil {
		propertyBag.Add("UserMetadata", *source.UserMetadata)
	} else {
		propertyBag.Remove("UserMetadata")
	}

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

	// Invoke the augmentConversionForNamespacesEventhub_STATUS interface (if implemented) to customize the conversion
	var eventhubAsAny any = eventhub
	if augmentedEventhub, ok := eventhubAsAny.(augmentConversionForNamespacesEventhub_STATUS); ok {
		err := augmentedEventhub.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_NamespacesEventhub_STATUS populates the provided destination NamespacesEventhub_STATUS from our NamespacesEventhub_STATUS
func (eventhub *NamespacesEventhub_STATUS) AssignProperties_To_NamespacesEventhub_STATUS(destination *storage.NamespacesEventhub_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(eventhub.PropertyBag)

	// CaptureDescription
	if eventhub.CaptureDescription != nil {
		var captureDescription storage.CaptureDescription_STATUS
		err := eventhub.CaptureDescription.AssignProperties_To_CaptureDescription_STATUS(&captureDescription)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_CaptureDescription_STATUS() to populate field CaptureDescription")
		}
		destination.CaptureDescription = &captureDescription
	} else {
		destination.CaptureDescription = nil
	}

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

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

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

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

	// MessageRetentionInDays
	destination.MessageRetentionInDays = genruntime.ClonePointerToInt(eventhub.MessageRetentionInDays)

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

	// PartitionCount
	destination.PartitionCount = genruntime.ClonePointerToInt(eventhub.PartitionCount)

	// PartitionIds
	destination.PartitionIds = genruntime.CloneSliceOfString(eventhub.PartitionIds)

	// RetentionDescription
	if propertyBag.Contains("RetentionDescription") {
		var retentionDescription storage.RetentionDescription_STATUS
		err := propertyBag.Pull("RetentionDescription", &retentionDescription)
		if err != nil {
			return eris.Wrap(err, "pulling 'RetentionDescription' from propertyBag")
		}

		destination.RetentionDescription = &retentionDescription
	} else {
		destination.RetentionDescription = nil
	}

	// Status
	destination.Status = genruntime.ClonePointerToString(eventhub.Status)

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

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

	// UserMetadata
	if propertyBag.Contains("UserMetadata") {
		var userMetadatum string
		err := propertyBag.Pull("UserMetadata", &userMetadatum)
		if err != nil {
			return eris.Wrap(err, "pulling 'UserMetadata' from propertyBag")
		}

		destination.UserMetadata = &userMetadatum
	} else {
		destination.UserMetadata = nil
	}

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

	// Invoke the augmentConversionForNamespacesEventhub_STATUS interface (if implemented) to customize the conversion
	var eventhubAsAny any = eventhub
	if augmentedEventhub, ok := eventhubAsAny.(augmentConversionForNamespacesEventhub_STATUS); ok {
		err := augmentedEventhub.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

type augmentConversionForNamespacesEventhub_Spec interface {
	AssignPropertiesFrom(src *storage.NamespacesEventhub_Spec) error
	AssignPropertiesTo(dst *storage.NamespacesEventhub_Spec) error
}

type augmentConversionForNamespacesEventhub_STATUS interface {
	AssignPropertiesFrom(src *storage.NamespacesEventhub_STATUS) error
	AssignPropertiesTo(dst *storage.NamespacesEventhub_STATUS) error
}

// Storage version of v1api20211101.CaptureDescription
// Properties to configure capture description for eventhub
type CaptureDescription struct {
	Destination       *Destination           `json:"destination,omitempty"`
	Enabled           *bool                  `json:"enabled,omitempty"`
	Encoding          *string                `json:"encoding,omitempty"`
	IntervalInSeconds *int                   `json:"intervalInSeconds,omitempty"`
	PropertyBag       genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	SizeLimitInBytes  *int                   `json:"sizeLimitInBytes,omitempty"`
	SkipEmptyArchives *bool                  `json:"skipEmptyArchives,omitempty"`
}

// AssignProperties_From_CaptureDescription populates our CaptureDescription from the provided source CaptureDescription
func (description *CaptureDescription) AssignProperties_From_CaptureDescription(source *storage.CaptureDescription) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// Destination
	if source.Destination != nil {
		var destination Destination
		err := destination.AssignProperties_From_Destination(source.Destination)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Destination() to populate field Destination")
		}
		description.Destination = &destination
	} else {
		description.Destination = nil
	}

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

	// Encoding
	description.Encoding = genruntime.ClonePointerToString(source.Encoding)

	// IntervalInSeconds
	description.IntervalInSeconds = genruntime.ClonePointerToInt(source.IntervalInSeconds)

	// SizeLimitInBytes
	description.SizeLimitInBytes = genruntime.ClonePointerToInt(source.SizeLimitInBytes)

	// SkipEmptyArchives
	if source.SkipEmptyArchives != nil {
		skipEmptyArchive := *source.SkipEmptyArchives
		description.SkipEmptyArchives = &skipEmptyArchive
	} else {
		description.SkipEmptyArchives = nil
	}

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

	// Invoke the augmentConversionForCaptureDescription interface (if implemented) to customize the conversion
	var descriptionAsAny any = description
	if augmentedDescription, ok := descriptionAsAny.(augmentConversionForCaptureDescription); ok {
		err := augmentedDescription.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_CaptureDescription populates the provided destination CaptureDescription from our CaptureDescription
func (description *CaptureDescription) AssignProperties_To_CaptureDescription(destination *storage.CaptureDescription) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(description.PropertyBag)

	// Destination
	if description.Destination != nil {
		var destinationLocal storage.Destination
		err := description.Destination.AssignProperties_To_Destination(&destinationLocal)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Destination() to populate field Destination")
		}
		destination.Destination = &destinationLocal
	} else {
		destination.Destination = nil
	}

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

	// Encoding
	destination.Encoding = genruntime.ClonePointerToString(description.Encoding)

	// IntervalInSeconds
	destination.IntervalInSeconds = genruntime.ClonePointerToInt(description.IntervalInSeconds)

	// SizeLimitInBytes
	destination.SizeLimitInBytes = genruntime.ClonePointerToInt(description.SizeLimitInBytes)

	// SkipEmptyArchives
	if description.SkipEmptyArchives != nil {
		skipEmptyArchive := *description.SkipEmptyArchives
		destination.SkipEmptyArchives = &skipEmptyArchive
	} else {
		destination.SkipEmptyArchives = nil
	}

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

	// Invoke the augmentConversionForCaptureDescription interface (if implemented) to customize the conversion
	var descriptionAsAny any = description
	if augmentedDescription, ok := descriptionAsAny.(augmentConversionForCaptureDescription); ok {
		err := augmentedDescription.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20211101.CaptureDescription_STATUS
// Properties to configure capture description for eventhub
type CaptureDescription_STATUS struct {
	Destination       *Destination_STATUS    `json:"destination,omitempty"`
	Enabled           *bool                  `json:"enabled,omitempty"`
	Encoding          *string                `json:"encoding,omitempty"`
	IntervalInSeconds *int                   `json:"intervalInSeconds,omitempty"`
	PropertyBag       genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	SizeLimitInBytes  *int                   `json:"sizeLimitInBytes,omitempty"`
	SkipEmptyArchives *bool                  `json:"skipEmptyArchives,omitempty"`
}

// AssignProperties_From_CaptureDescription_STATUS populates our CaptureDescription_STATUS from the provided source CaptureDescription_STATUS
func (description *CaptureDescription_STATUS) AssignProperties_From_CaptureDescription_STATUS(source *storage.CaptureDescription_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// Destination
	if source.Destination != nil {
		var destination Destination_STATUS
		err := destination.AssignProperties_From_Destination_STATUS(source.Destination)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Destination_STATUS() to populate field Destination")
		}
		description.Destination = &destination
	} else {
		description.Destination = nil
	}

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

	// Encoding
	description.Encoding = genruntime.ClonePointerToString(source.Encoding)

	// IntervalInSeconds
	description.IntervalInSeconds = genruntime.ClonePointerToInt(source.IntervalInSeconds)

	// SizeLimitInBytes
	description.SizeLimitInBytes = genruntime.ClonePointerToInt(source.SizeLimitInBytes)

	// SkipEmptyArchives
	if source.SkipEmptyArchives != nil {
		skipEmptyArchive := *source.SkipEmptyArchives
		description.SkipEmptyArchives = &skipEmptyArchive
	} else {
		description.SkipEmptyArchives = nil
	}

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

	// Invoke the augmentConversionForCaptureDescription_STATUS interface (if implemented) to customize the conversion
	var descriptionAsAny any = description
	if augmentedDescription, ok := descriptionAsAny.(augmentConversionForCaptureDescription_STATUS); ok {
		err := augmentedDescription.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_CaptureDescription_STATUS populates the provided destination CaptureDescription_STATUS from our CaptureDescription_STATUS
func (description *CaptureDescription_STATUS) AssignProperties_To_CaptureDescription_STATUS(destination *storage.CaptureDescription_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(description.PropertyBag)

	// Destination
	if description.Destination != nil {
		var destinationLocal storage.Destination_STATUS
		err := description.Destination.AssignProperties_To_Destination_STATUS(&destinationLocal)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Destination_STATUS() to populate field Destination")
		}
		destination.Destination = &destinationLocal
	} else {
		destination.Destination = nil
	}

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

	// Encoding
	destination.Encoding = genruntime.ClonePointerToString(description.Encoding)

	// IntervalInSeconds
	destination.IntervalInSeconds = genruntime.ClonePointerToInt(description.IntervalInSeconds)

	// SizeLimitInBytes
	destination.SizeLimitInBytes = genruntime.ClonePointerToInt(description.SizeLimitInBytes)

	// SkipEmptyArchives
	if description.SkipEmptyArchives != nil {
		skipEmptyArchive := *description.SkipEmptyArchives
		destination.SkipEmptyArchives = &skipEmptyArchive
	} else {
		destination.SkipEmptyArchives = nil
	}

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

	// Invoke the augmentConversionForCaptureDescription_STATUS interface (if implemented) to customize the conversion
	var descriptionAsAny any = description
	if augmentedDescription, ok := descriptionAsAny.(augmentConversionForCaptureDescription_STATUS); ok {
		err := augmentedDescription.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20211101.NamespacesEventhubOperatorSpec
// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure
type NamespacesEventhubOperatorSpec struct {
	ConfigMapExpressions []*core.DestinationExpression `json:"configMapExpressions,omitempty"`
	PropertyBag          genruntime.PropertyBag        `json:"$propertyBag,omitempty"`
	SecretExpressions    []*core.DestinationExpression `json:"secretExpressions,omitempty"`
}

// AssignProperties_From_NamespacesEventhubOperatorSpec populates our NamespacesEventhubOperatorSpec from the provided source NamespacesEventhubOperatorSpec
func (operator *NamespacesEventhubOperatorSpec) AssignProperties_From_NamespacesEventhubOperatorSpec(source *storage.NamespacesEventhubOperatorSpec) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

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

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

	// Invoke the augmentConversionForNamespacesEventhubOperatorSpec interface (if implemented) to customize the conversion
	var operatorAsAny any = operator
	if augmentedOperator, ok := operatorAsAny.(augmentConversionForNamespacesEventhubOperatorSpec); ok {
		err := augmentedOperator.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_NamespacesEventhubOperatorSpec populates the provided destination NamespacesEventhubOperatorSpec from our NamespacesEventhubOperatorSpec
func (operator *NamespacesEventhubOperatorSpec) AssignProperties_To_NamespacesEventhubOperatorSpec(destination *storage.NamespacesEventhubOperatorSpec) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(operator.PropertyBag)

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

	// Invoke the augmentConversionForNamespacesEventhubOperatorSpec interface (if implemented) to customize the conversion
	var operatorAsAny any = operator
	if augmentedOperator, ok := operatorAsAny.(augmentConversionForNamespacesEventhubOperatorSpec); ok {
		err := augmentedOperator.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

type augmentConversionForCaptureDescription interface {
	AssignPropertiesFrom(src *storage.CaptureDescription) error
	AssignPropertiesTo(dst *storage.CaptureDescription) error
}

type augmentConversionForCaptureDescription_STATUS interface {
	AssignPropertiesFrom(src *storage.CaptureDescription_STATUS) error
	AssignPropertiesTo(dst *storage.CaptureDescription_STATUS) error
}

type augmentConversionForNamespacesEventhubOperatorSpec interface {
	AssignPropertiesFrom(src *storage.NamespacesEventhubOperatorSpec) error
	AssignPropertiesTo(dst *storage.NamespacesEventhubOperatorSpec) error
}

// Storage version of v1api20211101.Destination
// Capture storage details for capture description
type Destination struct {
	ArchiveNameFormat      *string                `json:"archiveNameFormat,omitempty"`
	BlobContainer          *string                `json:"blobContainer,omitempty"`
	DataLakeAccountName    *string                `json:"dataLakeAccountName,omitempty"`
	DataLakeFolderPath     *string                `json:"dataLakeFolderPath,omitempty"`
	DataLakeSubscriptionId *string                `json:"dataLakeSubscriptionId,omitempty"`
	Name                   *string                `json:"name,omitempty"`
	PropertyBag            genruntime.PropertyBag `json:"$propertyBag,omitempty"`

	// StorageAccountResourceReference: Resource id of the storage account to be used to create the blobs
	StorageAccountResourceReference *genruntime.ResourceReference `armReference:"StorageAccountResourceId" json:"storageAccountResourceReference,omitempty"`
}

// AssignProperties_From_Destination populates our Destination from the provided source Destination
func (destination *Destination) AssignProperties_From_Destination(source *storage.Destination) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// ArchiveNameFormat
	destination.ArchiveNameFormat = genruntime.ClonePointerToString(source.ArchiveNameFormat)

	// BlobContainer
	destination.BlobContainer = genruntime.ClonePointerToString(source.BlobContainer)

	// DataLakeAccountName
	destination.DataLakeAccountName = genruntime.ClonePointerToString(source.DataLakeAccountName)

	// DataLakeFolderPath
	destination.DataLakeFolderPath = genruntime.ClonePointerToString(source.DataLakeFolderPath)

	// DataLakeSubscriptionId
	destination.DataLakeSubscriptionId = genruntime.ClonePointerToString(source.DataLakeSubscriptionId)

	// Identity
	if source.Identity != nil {
		propertyBag.Add("Identity", *source.Identity)
	} else {
		propertyBag.Remove("Identity")
	}

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

	// StorageAccountResourceReference
	if source.StorageAccountResourceReference != nil {
		storageAccountResourceReference := source.StorageAccountResourceReference.Copy()
		destination.StorageAccountResourceReference = &storageAccountResourceReference
	} else {
		destination.StorageAccountResourceReference = nil
	}

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

	// Invoke the augmentConversionForDestination interface (if implemented) to customize the conversion
	var destinationAsAny any = destination
	if augmentedDestination, ok := destinationAsAny.(augmentConversionForDestination); ok {
		err := augmentedDestination.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_Destination populates the provided destination Destination from our Destination
func (destination *Destination) AssignProperties_To_Destination(target *storage.Destination) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(destination.PropertyBag)

	// ArchiveNameFormat
	target.ArchiveNameFormat = genruntime.ClonePointerToString(destination.ArchiveNameFormat)

	// BlobContainer
	target.BlobContainer = genruntime.ClonePointerToString(destination.BlobContainer)

	// DataLakeAccountName
	target.DataLakeAccountName = genruntime.ClonePointerToString(destination.DataLakeAccountName)

	// DataLakeFolderPath
	target.DataLakeFolderPath = genruntime.ClonePointerToString(destination.DataLakeFolderPath)

	// DataLakeSubscriptionId
	target.DataLakeSubscriptionId = genruntime.ClonePointerToString(destination.DataLakeSubscriptionId)

	// Identity
	if propertyBag.Contains("Identity") {
		var identity storage.CaptureIdentity
		err := propertyBag.Pull("Identity", &identity)
		if err != nil {
			return eris.Wrap(err, "pulling 'Identity' from propertyBag")
		}

		target.Identity = &identity
	} else {
		target.Identity = nil
	}

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

	// StorageAccountResourceReference
	if destination.StorageAccountResourceReference != nil {
		storageAccountResourceReference := destination.StorageAccountResourceReference.Copy()
		target.StorageAccountResourceReference = &storageAccountResourceReference
	} else {
		target.StorageAccountResourceReference = nil
	}

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

	// Invoke the augmentConversionForDestination interface (if implemented) to customize the conversion
	var destinationAsAny any = destination
	if augmentedDestination, ok := destinationAsAny.(augmentConversionForDestination); ok {
		err := augmentedDestination.AssignPropertiesTo(target)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20211101.Destination_STATUS
// Capture storage details for capture description
type Destination_STATUS struct {
	ArchiveNameFormat        *string                `json:"archiveNameFormat,omitempty"`
	BlobContainer            *string                `json:"blobContainer,omitempty"`
	DataLakeAccountName      *string                `json:"dataLakeAccountName,omitempty"`
	DataLakeFolderPath       *string                `json:"dataLakeFolderPath,omitempty"`
	DataLakeSubscriptionId   *string                `json:"dataLakeSubscriptionId,omitempty"`
	Name                     *string                `json:"name,omitempty"`
	PropertyBag              genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	StorageAccountResourceId *string                `json:"storageAccountResourceId,omitempty"`
}

// AssignProperties_From_Destination_STATUS populates our Destination_STATUS from the provided source Destination_STATUS
func (destination *Destination_STATUS) AssignProperties_From_Destination_STATUS(source *storage.Destination_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// ArchiveNameFormat
	destination.ArchiveNameFormat = genruntime.ClonePointerToString(source.ArchiveNameFormat)

	// BlobContainer
	destination.BlobContainer = genruntime.ClonePointerToString(source.BlobContainer)

	// DataLakeAccountName
	destination.DataLakeAccountName = genruntime.ClonePointerToString(source.DataLakeAccountName)

	// DataLakeFolderPath
	destination.DataLakeFolderPath = genruntime.ClonePointerToString(source.DataLakeFolderPath)

	// DataLakeSubscriptionId
	destination.DataLakeSubscriptionId = genruntime.ClonePointerToString(source.DataLakeSubscriptionId)

	// Identity
	if source.Identity != nil {
		propertyBag.Add("Identity", *source.Identity)
	} else {
		propertyBag.Remove("Identity")
	}

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

	// StorageAccountResourceId
	destination.StorageAccountResourceId = genruntime.ClonePointerToString(source.StorageAccountResourceId)

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

	// Invoke the augmentConversionForDestination_STATUS interface (if implemented) to customize the conversion
	var destinationAsAny any = destination
	if augmentedDestination, ok := destinationAsAny.(augmentConversionForDestination_STATUS); ok {
		err := augmentedDestination.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_Destination_STATUS populates the provided destination Destination_STATUS from our Destination_STATUS
func (destination *Destination_STATUS) AssignProperties_To_Destination_STATUS(target *storage.Destination_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(destination.PropertyBag)

	// ArchiveNameFormat
	target.ArchiveNameFormat = genruntime.ClonePointerToString(destination.ArchiveNameFormat)

	// BlobContainer
	target.BlobContainer = genruntime.ClonePointerToString(destination.BlobContainer)

	// DataLakeAccountName
	target.DataLakeAccountName = genruntime.ClonePointerToString(destination.DataLakeAccountName)

	// DataLakeFolderPath
	target.DataLakeFolderPath = genruntime.ClonePointerToString(destination.DataLakeFolderPath)

	// DataLakeSubscriptionId
	target.DataLakeSubscriptionId = genruntime.ClonePointerToString(destination.DataLakeSubscriptionId)

	// Identity
	if propertyBag.Contains("Identity") {
		var identity storage.CaptureIdentity_STATUS
		err := propertyBag.Pull("Identity", &identity)
		if err != nil {
			return eris.Wrap(err, "pulling 'Identity' from propertyBag")
		}

		target.Identity = &identity
	} else {
		target.Identity = nil
	}

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

	// StorageAccountResourceId
	target.StorageAccountResourceId = genruntime.ClonePointerToString(destination.StorageAccountResourceId)

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

	// Invoke the augmentConversionForDestination_STATUS interface (if implemented) to customize the conversion
	var destinationAsAny any = destination
	if augmentedDestination, ok := destinationAsAny.(augmentConversionForDestination_STATUS); ok {
		err := augmentedDestination.AssignPropertiesTo(target)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

type augmentConversionForDestination interface {
	AssignPropertiesFrom(src *storage.Destination) error
	AssignPropertiesTo(dst *storage.Destination) error
}

type augmentConversionForDestination_STATUS interface {
	AssignPropertiesFrom(src *storage.Destination_STATUS) error
	AssignPropertiesTo(dst *storage.Destination_STATUS) error
}

func init() {
	SchemeBuilder.Register(&NamespacesEventhub{}, &NamespacesEventhubList{})
}
