// 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.Namespace
// Generator information:
// - Generated from: /eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/namespaces-preview.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}
type Namespace struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              Namespace_Spec   `json:"spec,omitempty"`
	Status            Namespace_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &Namespace{}

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

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

var _ conversion.Convertible = &Namespace{}

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

	return namespace.AssignProperties_From_Namespace(source)
}

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

	return namespace.AssignProperties_To_Namespace(destination)
}

var _ configmaps.Exporter = &Namespace{}

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

var _ secrets.Exporter = &Namespace{}

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

var _ genruntime.KubernetesResource = &Namespace{}

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

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

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

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

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

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

// NewEmptyStatus returns a new empty (blank) status
func (namespace *Namespace) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &Namespace_STATUS{}
}

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

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

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

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

	namespace.Status = st
	return nil
}

// AssignProperties_From_Namespace populates our Namespace from the provided source Namespace
func (namespace *Namespace) AssignProperties_From_Namespace(source *storage.Namespace) error {

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

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

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

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

	// No error
	return nil
}

// AssignProperties_To_Namespace populates the provided destination Namespace from our Namespace
func (namespace *Namespace) AssignProperties_To_Namespace(destination *storage.Namespace) error {

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

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

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

	// Invoke the augmentConversionForNamespace interface (if implemented) to customize the conversion
	var namespaceAsAny any = namespace
	if augmentedNamespace, ok := namespaceAsAny.(augmentConversionForNamespace); ok {
		err := augmentedNamespace.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 (namespace *Namespace) OriginalGVK() *schema.GroupVersionKind {
	return &schema.GroupVersionKind{
		Group:   GroupVersion.Group,
		Version: namespace.Spec.OriginalVersion,
		Kind:    "Namespace",
	}
}

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

// Storage version of v1api20211101.APIVersion
// +kubebuilder:validation:Enum={"2021-11-01"}
type APIVersion string

const APIVersion_Value = APIVersion("2021-11-01")

type augmentConversionForNamespace interface {
	AssignPropertiesFrom(src *storage.Namespace) error
	AssignPropertiesTo(dst *storage.Namespace) error
}

// Storage version of v1api20211101.Namespace_Spec
type Namespace_Spec struct {
	AlternateName *string `json:"alternateName,omitempty"`

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

	// ClusterArmReference: Cluster ARM ID of the Namespace.
	ClusterArmReference    *genruntime.ResourceReference `armReference:"ClusterArmId" json:"clusterArmReference,omitempty"`
	DisableLocalAuth       *bool                         `json:"disableLocalAuth,omitempty"`
	Encryption             *Encryption                   `json:"encryption,omitempty"`
	Identity               *Identity                     `json:"identity,omitempty"`
	IsAutoInflateEnabled   *bool                         `json:"isAutoInflateEnabled,omitempty"`
	KafkaEnabled           *bool                         `json:"kafkaEnabled,omitempty"`
	Location               *string                       `json:"location,omitempty"`
	MaximumThroughputUnits *int                          `json:"maximumThroughputUnits,omitempty"`
	OperatorSpec           *NamespaceOperatorSpec        `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 resources.azure.com/ResourceGroup resource
	Owner         *genruntime.KnownResourceReference `group:"resources.azure.com" json:"owner,omitempty" kind:"ResourceGroup"`
	PropertyBag   genruntime.PropertyBag             `json:"$propertyBag,omitempty"`
	Sku           *Sku                               `json:"sku,omitempty"`
	Tags          map[string]string                  `json:"tags,omitempty"`
	ZoneRedundant *bool                              `json:"zoneRedundant,omitempty"`
}

var _ genruntime.ConvertibleSpec = &Namespace_Spec{}

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

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

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

	return nil
}

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

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

	// AlternateName
	namespace.AlternateName = genruntime.ClonePointerToString(source.AlternateName)

	// AzureName
	namespace.AzureName = source.AzureName

	// ClusterArmReference
	if source.ClusterArmReference != nil {
		clusterArmReference := source.ClusterArmReference.Copy()
		namespace.ClusterArmReference = &clusterArmReference
	} else {
		namespace.ClusterArmReference = nil
	}

	// DisableLocalAuth
	if source.DisableLocalAuth != nil {
		disableLocalAuth := *source.DisableLocalAuth
		namespace.DisableLocalAuth = &disableLocalAuth
	} else {
		namespace.DisableLocalAuth = nil
	}

	// Encryption
	if source.Encryption != nil {
		var encryption Encryption
		err := encryption.AssignProperties_From_Encryption(source.Encryption)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Encryption() to populate field Encryption")
		}
		namespace.Encryption = &encryption
	} else {
		namespace.Encryption = nil
	}

	// Identity
	if source.Identity != nil {
		var identity Identity
		err := identity.AssignProperties_From_Identity(source.Identity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Identity() to populate field Identity")
		}
		namespace.Identity = &identity
	} else {
		namespace.Identity = nil
	}

	// IsAutoInflateEnabled
	if source.IsAutoInflateEnabled != nil {
		isAutoInflateEnabled := *source.IsAutoInflateEnabled
		namespace.IsAutoInflateEnabled = &isAutoInflateEnabled
	} else {
		namespace.IsAutoInflateEnabled = nil
	}

	// KafkaEnabled
	if source.KafkaEnabled != nil {
		kafkaEnabled := *source.KafkaEnabled
		namespace.KafkaEnabled = &kafkaEnabled
	} else {
		namespace.KafkaEnabled = nil
	}

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

	// MaximumThroughputUnits
	namespace.MaximumThroughputUnits = genruntime.ClonePointerToInt(source.MaximumThroughputUnits)

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

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

	// OriginalVersion
	namespace.OriginalVersion = source.OriginalVersion

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

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

	// Sku
	if source.Sku != nil {
		var sku Sku
		err := sku.AssignProperties_From_Sku(source.Sku)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Sku() to populate field Sku")
		}
		namespace.Sku = &sku
	} else {
		namespace.Sku = nil
	}

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

	// ZoneRedundant
	if source.ZoneRedundant != nil {
		zoneRedundant := *source.ZoneRedundant
		namespace.ZoneRedundant = &zoneRedundant
	} else {
		namespace.ZoneRedundant = nil
	}

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

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

	// No error
	return nil
}

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

	// AlternateName
	destination.AlternateName = genruntime.ClonePointerToString(namespace.AlternateName)

	// AzureName
	destination.AzureName = namespace.AzureName

	// ClusterArmReference
	if namespace.ClusterArmReference != nil {
		clusterArmReference := namespace.ClusterArmReference.Copy()
		destination.ClusterArmReference = &clusterArmReference
	} else {
		destination.ClusterArmReference = nil
	}

	// DisableLocalAuth
	if namespace.DisableLocalAuth != nil {
		disableLocalAuth := *namespace.DisableLocalAuth
		destination.DisableLocalAuth = &disableLocalAuth
	} else {
		destination.DisableLocalAuth = nil
	}

	// Encryption
	if namespace.Encryption != nil {
		var encryption storage.Encryption
		err := namespace.Encryption.AssignProperties_To_Encryption(&encryption)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Encryption() to populate field Encryption")
		}
		destination.Encryption = &encryption
	} else {
		destination.Encryption = nil
	}

	// Identity
	if namespace.Identity != nil {
		var identity storage.Identity
		err := namespace.Identity.AssignProperties_To_Identity(&identity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Identity() to populate field Identity")
		}
		destination.Identity = &identity
	} else {
		destination.Identity = nil
	}

	// IsAutoInflateEnabled
	if namespace.IsAutoInflateEnabled != nil {
		isAutoInflateEnabled := *namespace.IsAutoInflateEnabled
		destination.IsAutoInflateEnabled = &isAutoInflateEnabled
	} else {
		destination.IsAutoInflateEnabled = nil
	}

	// KafkaEnabled
	if namespace.KafkaEnabled != nil {
		kafkaEnabled := *namespace.KafkaEnabled
		destination.KafkaEnabled = &kafkaEnabled
	} else {
		destination.KafkaEnabled = nil
	}

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

	// MaximumThroughputUnits
	destination.MaximumThroughputUnits = genruntime.ClonePointerToInt(namespace.MaximumThroughputUnits)

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

		destination.MinimumTlsVersion = &minimumTlsVersion
	} else {
		destination.MinimumTlsVersion = nil
	}

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

	// OriginalVersion
	destination.OriginalVersion = namespace.OriginalVersion

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

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

		destination.PublicNetworkAccess = &publicNetworkAccess
	} else {
		destination.PublicNetworkAccess = nil
	}

	// Sku
	if namespace.Sku != nil {
		var sku storage.Sku
		err := namespace.Sku.AssignProperties_To_Sku(&sku)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Sku() to populate field Sku")
		}
		destination.Sku = &sku
	} else {
		destination.Sku = nil
	}

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

	// ZoneRedundant
	if namespace.ZoneRedundant != nil {
		zoneRedundant := *namespace.ZoneRedundant
		destination.ZoneRedundant = &zoneRedundant
	} else {
		destination.ZoneRedundant = nil
	}

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

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

	// No error
	return nil
}

// Storage version of v1api20211101.Namespace_STATUS
type Namespace_STATUS struct {
	AlternateName              *string                            `json:"alternateName,omitempty"`
	ClusterArmId               *string                            `json:"clusterArmId,omitempty"`
	Conditions                 []conditions.Condition             `json:"conditions,omitempty"`
	CreatedAt                  *string                            `json:"createdAt,omitempty"`
	DisableLocalAuth           *bool                              `json:"disableLocalAuth,omitempty"`
	Encryption                 *Encryption_STATUS                 `json:"encryption,omitempty"`
	Id                         *string                            `json:"id,omitempty"`
	Identity                   *Identity_STATUS                   `json:"identity,omitempty"`
	IsAutoInflateEnabled       *bool                              `json:"isAutoInflateEnabled,omitempty"`
	KafkaEnabled               *bool                              `json:"kafkaEnabled,omitempty"`
	Location                   *string                            `json:"location,omitempty"`
	MaximumThroughputUnits     *int                               `json:"maximumThroughputUnits,omitempty"`
	MetricId                   *string                            `json:"metricId,omitempty"`
	Name                       *string                            `json:"name,omitempty"`
	PrivateEndpointConnections []PrivateEndpointConnection_STATUS `json:"privateEndpointConnections,omitempty"`
	PropertyBag                genruntime.PropertyBag             `json:"$propertyBag,omitempty"`
	ProvisioningState          *string                            `json:"provisioningState,omitempty"`
	ServiceBusEndpoint         *string                            `json:"serviceBusEndpoint,omitempty"`
	Sku                        *Sku_STATUS                        `json:"sku,omitempty"`
	Status                     *string                            `json:"status,omitempty"`
	SystemData                 *SystemData_STATUS                 `json:"systemData,omitempty"`
	Tags                       map[string]string                  `json:"tags,omitempty"`
	Type                       *string                            `json:"type,omitempty"`
	UpdatedAt                  *string                            `json:"updatedAt,omitempty"`
	ZoneRedundant              *bool                              `json:"zoneRedundant,omitempty"`
}

var _ genruntime.ConvertibleStatus = &Namespace_STATUS{}

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

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

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

	return nil
}

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

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

	// AlternateName
	namespace.AlternateName = genruntime.ClonePointerToString(source.AlternateName)

	// ClusterArmId
	namespace.ClusterArmId = genruntime.ClonePointerToString(source.ClusterArmId)

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

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

	// DisableLocalAuth
	if source.DisableLocalAuth != nil {
		disableLocalAuth := *source.DisableLocalAuth
		namespace.DisableLocalAuth = &disableLocalAuth
	} else {
		namespace.DisableLocalAuth = nil
	}

	// Encryption
	if source.Encryption != nil {
		var encryption Encryption_STATUS
		err := encryption.AssignProperties_From_Encryption_STATUS(source.Encryption)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Encryption_STATUS() to populate field Encryption")
		}
		namespace.Encryption = &encryption
	} else {
		namespace.Encryption = nil
	}

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

	// Identity
	if source.Identity != nil {
		var identity Identity_STATUS
		err := identity.AssignProperties_From_Identity_STATUS(source.Identity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Identity_STATUS() to populate field Identity")
		}
		namespace.Identity = &identity
	} else {
		namespace.Identity = nil
	}

	// IsAutoInflateEnabled
	if source.IsAutoInflateEnabled != nil {
		isAutoInflateEnabled := *source.IsAutoInflateEnabled
		namespace.IsAutoInflateEnabled = &isAutoInflateEnabled
	} else {
		namespace.IsAutoInflateEnabled = nil
	}

	// KafkaEnabled
	if source.KafkaEnabled != nil {
		kafkaEnabled := *source.KafkaEnabled
		namespace.KafkaEnabled = &kafkaEnabled
	} else {
		namespace.KafkaEnabled = nil
	}

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

	// MaximumThroughputUnits
	namespace.MaximumThroughputUnits = genruntime.ClonePointerToInt(source.MaximumThroughputUnits)

	// MetricId
	namespace.MetricId = genruntime.ClonePointerToString(source.MetricId)

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

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

	// PrivateEndpointConnections
	if source.PrivateEndpointConnections != nil {
		privateEndpointConnectionList := make([]PrivateEndpointConnection_STATUS, len(source.PrivateEndpointConnections))
		for privateEndpointConnectionIndex, privateEndpointConnectionItem := range source.PrivateEndpointConnections {
			var privateEndpointConnection PrivateEndpointConnection_STATUS
			err := privateEndpointConnection.AssignProperties_From_PrivateEndpointConnection_STATUS(&privateEndpointConnectionItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_PrivateEndpointConnection_STATUS() to populate field PrivateEndpointConnections")
			}
			privateEndpointConnectionList[privateEndpointConnectionIndex] = privateEndpointConnection
		}
		namespace.PrivateEndpointConnections = privateEndpointConnectionList
	} else {
		namespace.PrivateEndpointConnections = nil
	}

	// ProvisioningState
	namespace.ProvisioningState = genruntime.ClonePointerToString(source.ProvisioningState)

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

	// ServiceBusEndpoint
	namespace.ServiceBusEndpoint = genruntime.ClonePointerToString(source.ServiceBusEndpoint)

	// Sku
	if source.Sku != nil {
		var sku Sku_STATUS
		err := sku.AssignProperties_From_Sku_STATUS(source.Sku)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Sku_STATUS() to populate field Sku")
		}
		namespace.Sku = &sku
	} else {
		namespace.Sku = nil
	}

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

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

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

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

	// ZoneRedundant
	if source.ZoneRedundant != nil {
		zoneRedundant := *source.ZoneRedundant
		namespace.ZoneRedundant = &zoneRedundant
	} else {
		namespace.ZoneRedundant = nil
	}

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

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

	// No error
	return nil
}

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

	// AlternateName
	destination.AlternateName = genruntime.ClonePointerToString(namespace.AlternateName)

	// ClusterArmId
	destination.ClusterArmId = genruntime.ClonePointerToString(namespace.ClusterArmId)

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

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

	// DisableLocalAuth
	if namespace.DisableLocalAuth != nil {
		disableLocalAuth := *namespace.DisableLocalAuth
		destination.DisableLocalAuth = &disableLocalAuth
	} else {
		destination.DisableLocalAuth = nil
	}

	// Encryption
	if namespace.Encryption != nil {
		var encryption storage.Encryption_STATUS
		err := namespace.Encryption.AssignProperties_To_Encryption_STATUS(&encryption)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Encryption_STATUS() to populate field Encryption")
		}
		destination.Encryption = &encryption
	} else {
		destination.Encryption = nil
	}

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

	// Identity
	if namespace.Identity != nil {
		var identity storage.Identity_STATUS
		err := namespace.Identity.AssignProperties_To_Identity_STATUS(&identity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Identity_STATUS() to populate field Identity")
		}
		destination.Identity = &identity
	} else {
		destination.Identity = nil
	}

	// IsAutoInflateEnabled
	if namespace.IsAutoInflateEnabled != nil {
		isAutoInflateEnabled := *namespace.IsAutoInflateEnabled
		destination.IsAutoInflateEnabled = &isAutoInflateEnabled
	} else {
		destination.IsAutoInflateEnabled = nil
	}

	// KafkaEnabled
	if namespace.KafkaEnabled != nil {
		kafkaEnabled := *namespace.KafkaEnabled
		destination.KafkaEnabled = &kafkaEnabled
	} else {
		destination.KafkaEnabled = nil
	}

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

	// MaximumThroughputUnits
	destination.MaximumThroughputUnits = genruntime.ClonePointerToInt(namespace.MaximumThroughputUnits)

	// MetricId
	destination.MetricId = genruntime.ClonePointerToString(namespace.MetricId)

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

		destination.MinimumTlsVersion = &minimumTlsVersion
	} else {
		destination.MinimumTlsVersion = nil
	}

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

	// PrivateEndpointConnections
	if namespace.PrivateEndpointConnections != nil {
		privateEndpointConnectionList := make([]storage.PrivateEndpointConnection_STATUS, len(namespace.PrivateEndpointConnections))
		for privateEndpointConnectionIndex, privateEndpointConnectionItem := range namespace.PrivateEndpointConnections {
			var privateEndpointConnection storage.PrivateEndpointConnection_STATUS
			err := privateEndpointConnectionItem.AssignProperties_To_PrivateEndpointConnection_STATUS(&privateEndpointConnection)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_PrivateEndpointConnection_STATUS() to populate field PrivateEndpointConnections")
			}
			privateEndpointConnectionList[privateEndpointConnectionIndex] = privateEndpointConnection
		}
		destination.PrivateEndpointConnections = privateEndpointConnectionList
	} else {
		destination.PrivateEndpointConnections = nil
	}

	// ProvisioningState
	destination.ProvisioningState = genruntime.ClonePointerToString(namespace.ProvisioningState)

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

		destination.PublicNetworkAccess = &publicNetworkAccess
	} else {
		destination.PublicNetworkAccess = nil
	}

	// ServiceBusEndpoint
	destination.ServiceBusEndpoint = genruntime.ClonePointerToString(namespace.ServiceBusEndpoint)

	// Sku
	if namespace.Sku != nil {
		var sku storage.Sku_STATUS
		err := namespace.Sku.AssignProperties_To_Sku_STATUS(&sku)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Sku_STATUS() to populate field Sku")
		}
		destination.Sku = &sku
	} else {
		destination.Sku = nil
	}

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

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

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

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

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

	// ZoneRedundant
	if namespace.ZoneRedundant != nil {
		zoneRedundant := *namespace.ZoneRedundant
		destination.ZoneRedundant = &zoneRedundant
	} else {
		destination.ZoneRedundant = nil
	}

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

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

	// No error
	return nil
}

type augmentConversionForNamespace_Spec interface {
	AssignPropertiesFrom(src *storage.Namespace_Spec) error
	AssignPropertiesTo(dst *storage.Namespace_Spec) error
}

type augmentConversionForNamespace_STATUS interface {
	AssignPropertiesFrom(src *storage.Namespace_STATUS) error
	AssignPropertiesTo(dst *storage.Namespace_STATUS) error
}

// Storage version of v1api20211101.Encryption
// Properties to configure Encryption
type Encryption struct {
	KeySource                       *string                `json:"keySource,omitempty"`
	KeyVaultProperties              []KeyVaultProperties   `json:"keyVaultProperties,omitempty"`
	PropertyBag                     genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	RequireInfrastructureEncryption *bool                  `json:"requireInfrastructureEncryption,omitempty"`
}

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

	// KeySource
	encryption.KeySource = genruntime.ClonePointerToString(source.KeySource)

	// KeyVaultProperties
	if source.KeyVaultProperties != nil {
		keyVaultPropertyList := make([]KeyVaultProperties, len(source.KeyVaultProperties))
		for keyVaultPropertyIndex, keyVaultPropertyItem := range source.KeyVaultProperties {
			var keyVaultProperty KeyVaultProperties
			err := keyVaultProperty.AssignProperties_From_KeyVaultProperties(&keyVaultPropertyItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_KeyVaultProperties() to populate field KeyVaultProperties")
			}
			keyVaultPropertyList[keyVaultPropertyIndex] = keyVaultProperty
		}
		encryption.KeyVaultProperties = keyVaultPropertyList
	} else {
		encryption.KeyVaultProperties = nil
	}

	// RequireInfrastructureEncryption
	if source.RequireInfrastructureEncryption != nil {
		requireInfrastructureEncryption := *source.RequireInfrastructureEncryption
		encryption.RequireInfrastructureEncryption = &requireInfrastructureEncryption
	} else {
		encryption.RequireInfrastructureEncryption = nil
	}

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

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

	// No error
	return nil
}

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

	// KeySource
	destination.KeySource = genruntime.ClonePointerToString(encryption.KeySource)

	// KeyVaultProperties
	if encryption.KeyVaultProperties != nil {
		keyVaultPropertyList := make([]storage.KeyVaultProperties, len(encryption.KeyVaultProperties))
		for keyVaultPropertyIndex, keyVaultPropertyItem := range encryption.KeyVaultProperties {
			var keyVaultProperty storage.KeyVaultProperties
			err := keyVaultPropertyItem.AssignProperties_To_KeyVaultProperties(&keyVaultProperty)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_KeyVaultProperties() to populate field KeyVaultProperties")
			}
			keyVaultPropertyList[keyVaultPropertyIndex] = keyVaultProperty
		}
		destination.KeyVaultProperties = keyVaultPropertyList
	} else {
		destination.KeyVaultProperties = nil
	}

	// RequireInfrastructureEncryption
	if encryption.RequireInfrastructureEncryption != nil {
		requireInfrastructureEncryption := *encryption.RequireInfrastructureEncryption
		destination.RequireInfrastructureEncryption = &requireInfrastructureEncryption
	} else {
		destination.RequireInfrastructureEncryption = nil
	}

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

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

	// No error
	return nil
}

// Storage version of v1api20211101.Encryption_STATUS
// Properties to configure Encryption
type Encryption_STATUS struct {
	KeySource                       *string                     `json:"keySource,omitempty"`
	KeyVaultProperties              []KeyVaultProperties_STATUS `json:"keyVaultProperties,omitempty"`
	PropertyBag                     genruntime.PropertyBag      `json:"$propertyBag,omitempty"`
	RequireInfrastructureEncryption *bool                       `json:"requireInfrastructureEncryption,omitempty"`
}

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

	// KeySource
	encryption.KeySource = genruntime.ClonePointerToString(source.KeySource)

	// KeyVaultProperties
	if source.KeyVaultProperties != nil {
		keyVaultPropertyList := make([]KeyVaultProperties_STATUS, len(source.KeyVaultProperties))
		for keyVaultPropertyIndex, keyVaultPropertyItem := range source.KeyVaultProperties {
			var keyVaultProperty KeyVaultProperties_STATUS
			err := keyVaultProperty.AssignProperties_From_KeyVaultProperties_STATUS(&keyVaultPropertyItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_KeyVaultProperties_STATUS() to populate field KeyVaultProperties")
			}
			keyVaultPropertyList[keyVaultPropertyIndex] = keyVaultProperty
		}
		encryption.KeyVaultProperties = keyVaultPropertyList
	} else {
		encryption.KeyVaultProperties = nil
	}

	// RequireInfrastructureEncryption
	if source.RequireInfrastructureEncryption != nil {
		requireInfrastructureEncryption := *source.RequireInfrastructureEncryption
		encryption.RequireInfrastructureEncryption = &requireInfrastructureEncryption
	} else {
		encryption.RequireInfrastructureEncryption = nil
	}

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

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

	// No error
	return nil
}

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

	// KeySource
	destination.KeySource = genruntime.ClonePointerToString(encryption.KeySource)

	// KeyVaultProperties
	if encryption.KeyVaultProperties != nil {
		keyVaultPropertyList := make([]storage.KeyVaultProperties_STATUS, len(encryption.KeyVaultProperties))
		for keyVaultPropertyIndex, keyVaultPropertyItem := range encryption.KeyVaultProperties {
			var keyVaultProperty storage.KeyVaultProperties_STATUS
			err := keyVaultPropertyItem.AssignProperties_To_KeyVaultProperties_STATUS(&keyVaultProperty)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_KeyVaultProperties_STATUS() to populate field KeyVaultProperties")
			}
			keyVaultPropertyList[keyVaultPropertyIndex] = keyVaultProperty
		}
		destination.KeyVaultProperties = keyVaultPropertyList
	} else {
		destination.KeyVaultProperties = nil
	}

	// RequireInfrastructureEncryption
	if encryption.RequireInfrastructureEncryption != nil {
		requireInfrastructureEncryption := *encryption.RequireInfrastructureEncryption
		destination.RequireInfrastructureEncryption = &requireInfrastructureEncryption
	} else {
		destination.RequireInfrastructureEncryption = nil
	}

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

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

	// No error
	return nil
}

// Storage version of v1api20211101.Identity
// Properties to configure Identity for Bring your Own Keys
type Identity struct {
	PropertyBag            genruntime.PropertyBag        `json:"$propertyBag,omitempty"`
	Type                   *string                       `json:"type,omitempty"`
	UserAssignedIdentities []UserAssignedIdentityDetails `json:"userAssignedIdentities,omitempty"`
}

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

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

	// UserAssignedIdentities
	if source.UserAssignedIdentities != nil {
		userAssignedIdentityList := make([]UserAssignedIdentityDetails, len(source.UserAssignedIdentities))
		for userAssignedIdentityIndex, userAssignedIdentityItem := range source.UserAssignedIdentities {
			var userAssignedIdentity UserAssignedIdentityDetails
			err := userAssignedIdentity.AssignProperties_From_UserAssignedIdentityDetails(&userAssignedIdentityItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_UserAssignedIdentityDetails() to populate field UserAssignedIdentities")
			}
			userAssignedIdentityList[userAssignedIdentityIndex] = userAssignedIdentity
		}
		identity.UserAssignedIdentities = userAssignedIdentityList
	} else {
		identity.UserAssignedIdentities = nil
	}

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

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

	// No error
	return nil
}

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

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

	// UserAssignedIdentities
	if identity.UserAssignedIdentities != nil {
		userAssignedIdentityList := make([]storage.UserAssignedIdentityDetails, len(identity.UserAssignedIdentities))
		for userAssignedIdentityIndex, userAssignedIdentityItem := range identity.UserAssignedIdentities {
			var userAssignedIdentity storage.UserAssignedIdentityDetails
			err := userAssignedIdentityItem.AssignProperties_To_UserAssignedIdentityDetails(&userAssignedIdentity)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_UserAssignedIdentityDetails() to populate field UserAssignedIdentities")
			}
			userAssignedIdentityList[userAssignedIdentityIndex] = userAssignedIdentity
		}
		destination.UserAssignedIdentities = userAssignedIdentityList
	} else {
		destination.UserAssignedIdentities = nil
	}

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

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

	// No error
	return nil
}

// Storage version of v1api20211101.Identity_STATUS
// Properties to configure Identity for Bring your Own Keys
type Identity_STATUS struct {
	PrincipalId            *string                                `json:"principalId,omitempty"`
	PropertyBag            genruntime.PropertyBag                 `json:"$propertyBag,omitempty"`
	TenantId               *string                                `json:"tenantId,omitempty"`
	Type                   *string                                `json:"type,omitempty"`
	UserAssignedIdentities map[string]UserAssignedIdentity_STATUS `json:"userAssignedIdentities,omitempty"`
}

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

	// PrincipalId
	identity.PrincipalId = genruntime.ClonePointerToString(source.PrincipalId)

	// TenantId
	identity.TenantId = genruntime.ClonePointerToString(source.TenantId)

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

	// UserAssignedIdentities
	if source.UserAssignedIdentities != nil {
		userAssignedIdentityMap := make(map[string]UserAssignedIdentity_STATUS, len(source.UserAssignedIdentities))
		for userAssignedIdentityKey, userAssignedIdentityValue := range source.UserAssignedIdentities {
			var userAssignedIdentity UserAssignedIdentity_STATUS
			err := userAssignedIdentity.AssignProperties_From_UserAssignedIdentity_STATUS(&userAssignedIdentityValue)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_UserAssignedIdentity_STATUS() to populate field UserAssignedIdentities")
			}
			userAssignedIdentityMap[userAssignedIdentityKey] = userAssignedIdentity
		}
		identity.UserAssignedIdentities = userAssignedIdentityMap
	} else {
		identity.UserAssignedIdentities = nil
	}

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

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

	// No error
	return nil
}

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

	// PrincipalId
	destination.PrincipalId = genruntime.ClonePointerToString(identity.PrincipalId)

	// TenantId
	destination.TenantId = genruntime.ClonePointerToString(identity.TenantId)

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

	// UserAssignedIdentities
	if identity.UserAssignedIdentities != nil {
		userAssignedIdentityMap := make(map[string]storage.UserAssignedIdentity_STATUS, len(identity.UserAssignedIdentities))
		for userAssignedIdentityKey, userAssignedIdentityValue := range identity.UserAssignedIdentities {
			var userAssignedIdentity storage.UserAssignedIdentity_STATUS
			err := userAssignedIdentityValue.AssignProperties_To_UserAssignedIdentity_STATUS(&userAssignedIdentity)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_UserAssignedIdentity_STATUS() to populate field UserAssignedIdentities")
			}
			userAssignedIdentityMap[userAssignedIdentityKey] = userAssignedIdentity
		}
		destination.UserAssignedIdentities = userAssignedIdentityMap
	} else {
		destination.UserAssignedIdentities = nil
	}

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

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

	// No error
	return nil
}

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

// AssignProperties_From_NamespaceOperatorSpec populates our NamespaceOperatorSpec from the provided source NamespaceOperatorSpec
func (operator *NamespaceOperatorSpec) AssignProperties_From_NamespaceOperatorSpec(source *storage.NamespaceOperatorSpec) 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
	}

	// Secrets
	if source.Secrets != nil {
		var secret NamespaceOperatorSecrets
		err := secret.AssignProperties_From_NamespaceOperatorSecrets(source.Secrets)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_NamespaceOperatorSecrets() to populate field Secrets")
		}
		operator.Secrets = &secret
	} else {
		operator.Secrets = nil
	}

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

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

	// No error
	return nil
}

// AssignProperties_To_NamespaceOperatorSpec populates the provided destination NamespaceOperatorSpec from our NamespaceOperatorSpec
func (operator *NamespaceOperatorSpec) AssignProperties_To_NamespaceOperatorSpec(destination *storage.NamespaceOperatorSpec) 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
	}

	// Secrets
	if operator.Secrets != nil {
		var secret storage.NamespaceOperatorSecrets
		err := operator.Secrets.AssignProperties_To_NamespaceOperatorSecrets(&secret)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_NamespaceOperatorSecrets() to populate field Secrets")
		}
		destination.Secrets = &secret
	} else {
		destination.Secrets = nil
	}

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

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

	// No error
	return nil
}

// Storage version of v1api20211101.PrivateEndpointConnection_STATUS
// Properties of the PrivateEndpointConnection.
type PrivateEndpointConnection_STATUS struct {
	Id          *string                `json:"id,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

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

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

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

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

	// No error
	return nil
}

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

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

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

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

	// No error
	return nil
}

// Storage version of v1api20211101.Sku
// SKU parameters supplied to the create namespace operation
type Sku struct {
	Capacity    *int                   `json:"capacity,omitempty"`
	Name        *string                `json:"name,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Tier        *string                `json:"tier,omitempty"`
}

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

	// Capacity
	sku.Capacity = genruntime.ClonePointerToInt(source.Capacity)

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

	// Tier
	sku.Tier = genruntime.ClonePointerToString(source.Tier)

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

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

	// No error
	return nil
}

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

	// Capacity
	destination.Capacity = genruntime.ClonePointerToInt(sku.Capacity)

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

	// Tier
	destination.Tier = genruntime.ClonePointerToString(sku.Tier)

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

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

	// No error
	return nil
}

// Storage version of v1api20211101.Sku_STATUS
// SKU parameters supplied to the create namespace operation
type Sku_STATUS struct {
	Capacity    *int                   `json:"capacity,omitempty"`
	Name        *string                `json:"name,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Tier        *string                `json:"tier,omitempty"`
}

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

	// Capacity
	sku.Capacity = genruntime.ClonePointerToInt(source.Capacity)

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

	// Tier
	sku.Tier = genruntime.ClonePointerToString(source.Tier)

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

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

	// No error
	return nil
}

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

	// Capacity
	destination.Capacity = genruntime.ClonePointerToInt(sku.Capacity)

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

	// Tier
	destination.Tier = genruntime.ClonePointerToString(sku.Tier)

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

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

	// No error
	return nil
}

// Storage version of v1api20211101.SystemData_STATUS
// Metadata pertaining to creation and last modification of the resource.
type SystemData_STATUS struct {
	CreatedAt          *string                `json:"createdAt,omitempty"`
	CreatedBy          *string                `json:"createdBy,omitempty"`
	CreatedByType      *string                `json:"createdByType,omitempty"`
	LastModifiedAt     *string                `json:"lastModifiedAt,omitempty"`
	LastModifiedBy     *string                `json:"lastModifiedBy,omitempty"`
	LastModifiedByType *string                `json:"lastModifiedByType,omitempty"`
	PropertyBag        genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

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

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

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

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

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

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

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

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

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

	// No error
	return nil
}

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

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

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

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

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

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

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

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

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

	// No error
	return nil
}

type augmentConversionForEncryption interface {
	AssignPropertiesFrom(src *storage.Encryption) error
	AssignPropertiesTo(dst *storage.Encryption) error
}

type augmentConversionForEncryption_STATUS interface {
	AssignPropertiesFrom(src *storage.Encryption_STATUS) error
	AssignPropertiesTo(dst *storage.Encryption_STATUS) error
}

type augmentConversionForIdentity interface {
	AssignPropertiesFrom(src *storage.Identity) error
	AssignPropertiesTo(dst *storage.Identity) error
}

type augmentConversionForIdentity_STATUS interface {
	AssignPropertiesFrom(src *storage.Identity_STATUS) error
	AssignPropertiesTo(dst *storage.Identity_STATUS) error
}

type augmentConversionForNamespaceOperatorSpec interface {
	AssignPropertiesFrom(src *storage.NamespaceOperatorSpec) error
	AssignPropertiesTo(dst *storage.NamespaceOperatorSpec) error
}

type augmentConversionForPrivateEndpointConnection_STATUS interface {
	AssignPropertiesFrom(src *storage.PrivateEndpointConnection_STATUS) error
	AssignPropertiesTo(dst *storage.PrivateEndpointConnection_STATUS) error
}

type augmentConversionForSku interface {
	AssignPropertiesFrom(src *storage.Sku) error
	AssignPropertiesTo(dst *storage.Sku) error
}

type augmentConversionForSku_STATUS interface {
	AssignPropertiesFrom(src *storage.Sku_STATUS) error
	AssignPropertiesTo(dst *storage.Sku_STATUS) error
}

type augmentConversionForSystemData_STATUS interface {
	AssignPropertiesFrom(src *storage.SystemData_STATUS) error
	AssignPropertiesTo(dst *storage.SystemData_STATUS) error
}

// Storage version of v1api20211101.KeyVaultProperties
// Properties to configure keyVault Properties
type KeyVaultProperties struct {
	Identity    *UserAssignedIdentityProperties `json:"identity,omitempty"`
	KeyName     *string                         `json:"keyName,omitempty"`
	KeyVaultUri *string                         `json:"keyVaultUri,omitempty"`
	KeyVersion  *string                         `json:"keyVersion,omitempty"`
	PropertyBag genruntime.PropertyBag          `json:"$propertyBag,omitempty"`
}

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

	// Identity
	if source.Identity != nil {
		var identity UserAssignedIdentityProperties
		err := identity.AssignProperties_From_UserAssignedIdentityProperties(source.Identity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_UserAssignedIdentityProperties() to populate field Identity")
		}
		properties.Identity = &identity
	} else {
		properties.Identity = nil
	}

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

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

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

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

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

	// No error
	return nil
}

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

	// Identity
	if properties.Identity != nil {
		var identity storage.UserAssignedIdentityProperties
		err := properties.Identity.AssignProperties_To_UserAssignedIdentityProperties(&identity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_UserAssignedIdentityProperties() to populate field Identity")
		}
		destination.Identity = &identity
	} else {
		destination.Identity = nil
	}

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

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

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

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

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

	// No error
	return nil
}

// Storage version of v1api20211101.KeyVaultProperties_STATUS
// Properties to configure keyVault Properties
type KeyVaultProperties_STATUS struct {
	Identity    *UserAssignedIdentityProperties_STATUS `json:"identity,omitempty"`
	KeyName     *string                                `json:"keyName,omitempty"`
	KeyVaultUri *string                                `json:"keyVaultUri,omitempty"`
	KeyVersion  *string                                `json:"keyVersion,omitempty"`
	PropertyBag genruntime.PropertyBag                 `json:"$propertyBag,omitempty"`
}

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

	// Identity
	if source.Identity != nil {
		var identity UserAssignedIdentityProperties_STATUS
		err := identity.AssignProperties_From_UserAssignedIdentityProperties_STATUS(source.Identity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_UserAssignedIdentityProperties_STATUS() to populate field Identity")
		}
		properties.Identity = &identity
	} else {
		properties.Identity = nil
	}

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

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

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

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

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

	// No error
	return nil
}

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

	// Identity
	if properties.Identity != nil {
		var identity storage.UserAssignedIdentityProperties_STATUS
		err := properties.Identity.AssignProperties_To_UserAssignedIdentityProperties_STATUS(&identity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_UserAssignedIdentityProperties_STATUS() to populate field Identity")
		}
		destination.Identity = &identity
	} else {
		destination.Identity = nil
	}

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

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

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

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

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

	// No error
	return nil
}

// Storage version of v1api20211101.NamespaceOperatorSecrets
type NamespaceOperatorSecrets struct {
	PrimaryConnectionString   *genruntime.SecretDestination `json:"primaryConnectionString,omitempty"`
	PrimaryKey                *genruntime.SecretDestination `json:"primaryKey,omitempty"`
	PropertyBag               genruntime.PropertyBag        `json:"$propertyBag,omitempty"`
	SecondaryConnectionString *genruntime.SecretDestination `json:"secondaryConnectionString,omitempty"`
	SecondaryKey              *genruntime.SecretDestination `json:"secondaryKey,omitempty"`
}

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

	// PrimaryConnectionString
	if source.PrimaryConnectionString != nil {
		primaryConnectionString := source.PrimaryConnectionString.Copy()
		secrets.PrimaryConnectionString = &primaryConnectionString
	} else {
		secrets.PrimaryConnectionString = nil
	}

	// PrimaryKey
	if source.PrimaryKey != nil {
		primaryKey := source.PrimaryKey.Copy()
		secrets.PrimaryKey = &primaryKey
	} else {
		secrets.PrimaryKey = nil
	}

	// SecondaryConnectionString
	if source.SecondaryConnectionString != nil {
		secondaryConnectionString := source.SecondaryConnectionString.Copy()
		secrets.SecondaryConnectionString = &secondaryConnectionString
	} else {
		secrets.SecondaryConnectionString = nil
	}

	// SecondaryKey
	if source.SecondaryKey != nil {
		secondaryKey := source.SecondaryKey.Copy()
		secrets.SecondaryKey = &secondaryKey
	} else {
		secrets.SecondaryKey = nil
	}

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

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

	// No error
	return nil
}

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

	// PrimaryConnectionString
	if secrets.PrimaryConnectionString != nil {
		primaryConnectionString := secrets.PrimaryConnectionString.Copy()
		destination.PrimaryConnectionString = &primaryConnectionString
	} else {
		destination.PrimaryConnectionString = nil
	}

	// PrimaryKey
	if secrets.PrimaryKey != nil {
		primaryKey := secrets.PrimaryKey.Copy()
		destination.PrimaryKey = &primaryKey
	} else {
		destination.PrimaryKey = nil
	}

	// SecondaryConnectionString
	if secrets.SecondaryConnectionString != nil {
		secondaryConnectionString := secrets.SecondaryConnectionString.Copy()
		destination.SecondaryConnectionString = &secondaryConnectionString
	} else {
		destination.SecondaryConnectionString = nil
	}

	// SecondaryKey
	if secrets.SecondaryKey != nil {
		secondaryKey := secrets.SecondaryKey.Copy()
		destination.SecondaryKey = &secondaryKey
	} else {
		destination.SecondaryKey = nil
	}

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

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

	// No error
	return nil
}

// Storage version of v1api20211101.UserAssignedIdentity_STATUS
// Recognized Dictionary value.
type UserAssignedIdentity_STATUS struct {
	ClientId    *string                `json:"clientId,omitempty"`
	PrincipalId *string                `json:"principalId,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

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

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

	// PrincipalId
	identity.PrincipalId = genruntime.ClonePointerToString(source.PrincipalId)

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

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

	// No error
	return nil
}

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

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

	// PrincipalId
	destination.PrincipalId = genruntime.ClonePointerToString(identity.PrincipalId)

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

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

	// No error
	return nil
}

// Storage version of v1api20211101.UserAssignedIdentityDetails
// Information about the user assigned identity for the resource
type UserAssignedIdentityDetails struct {
	PropertyBag genruntime.PropertyBag       `json:"$propertyBag,omitempty"`
	Reference   genruntime.ResourceReference `armReference:"Reference" json:"reference,omitempty"`
}

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

	// Reference
	details.Reference = source.Reference.Copy()

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

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

	// No error
	return nil
}

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

	// Reference
	destination.Reference = details.Reference.Copy()

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

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

	// No error
	return nil
}

type augmentConversionForKeyVaultProperties interface {
	AssignPropertiesFrom(src *storage.KeyVaultProperties) error
	AssignPropertiesTo(dst *storage.KeyVaultProperties) error
}

type augmentConversionForKeyVaultProperties_STATUS interface {
	AssignPropertiesFrom(src *storage.KeyVaultProperties_STATUS) error
	AssignPropertiesTo(dst *storage.KeyVaultProperties_STATUS) error
}

type augmentConversionForNamespaceOperatorSecrets interface {
	AssignPropertiesFrom(src *storage.NamespaceOperatorSecrets) error
	AssignPropertiesTo(dst *storage.NamespaceOperatorSecrets) error
}

type augmentConversionForUserAssignedIdentity_STATUS interface {
	AssignPropertiesFrom(src *storage.UserAssignedIdentity_STATUS) error
	AssignPropertiesTo(dst *storage.UserAssignedIdentity_STATUS) error
}

type augmentConversionForUserAssignedIdentityDetails interface {
	AssignPropertiesFrom(src *storage.UserAssignedIdentityDetails) error
	AssignPropertiesTo(dst *storage.UserAssignedIdentityDetails) error
}

// Storage version of v1api20211101.UserAssignedIdentityProperties
type UserAssignedIdentityProperties struct {
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`

	// UserAssignedIdentityReference: ARM ID of user Identity selected for encryption
	UserAssignedIdentityReference *genruntime.ResourceReference `armReference:"UserAssignedIdentity" json:"userAssignedIdentityReference,omitempty"`
}

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

	// UserAssignedIdentityReference
	if source.UserAssignedIdentityReference != nil {
		userAssignedIdentityReference := source.UserAssignedIdentityReference.Copy()
		properties.UserAssignedIdentityReference = &userAssignedIdentityReference
	} else {
		properties.UserAssignedIdentityReference = nil
	}

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

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

	// No error
	return nil
}

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

	// UserAssignedIdentityReference
	if properties.UserAssignedIdentityReference != nil {
		userAssignedIdentityReference := properties.UserAssignedIdentityReference.Copy()
		destination.UserAssignedIdentityReference = &userAssignedIdentityReference
	} else {
		destination.UserAssignedIdentityReference = nil
	}

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

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

	// No error
	return nil
}

// Storage version of v1api20211101.UserAssignedIdentityProperties_STATUS
type UserAssignedIdentityProperties_STATUS struct {
	PropertyBag          genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	UserAssignedIdentity *string                `json:"userAssignedIdentity,omitempty"`
}

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

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

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

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

	// No error
	return nil
}

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

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

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

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

	// No error
	return nil
}

type augmentConversionForUserAssignedIdentityProperties interface {
	AssignPropertiesFrom(src *storage.UserAssignedIdentityProperties) error
	AssignPropertiesTo(dst *storage.UserAssignedIdentityProperties) error
}

type augmentConversionForUserAssignedIdentityProperties_STATUS interface {
	AssignPropertiesFrom(src *storage.UserAssignedIdentityProperties_STATUS) error
	AssignPropertiesTo(dst *storage.UserAssignedIdentityProperties_STATUS) error
}

func init() {
	SchemeBuilder.Register(&Namespace{}, &NamespaceList{})
}
