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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/eventhub/v1api20211101/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/eventhub/v1api20211101/storage"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/configmaps"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/core"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/secrets"
	"github.com/rotisserie/eris"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"sigs.k8s.io/controller-runtime/pkg/conversion"
)

// +kubebuilder:object:root=true
// +kubebuilder:resource:categories={azure,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"
// Generator information:
// - Generated from: /eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/eventhubs.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}
type NamespacesEventhub struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              NamespacesEventhub_Spec   `json:"spec,omitempty"`
	Status            NamespacesEventhub_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &NamespacesEventhub{}

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

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

var _ conversion.Convertible = &NamespacesEventhub{}

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

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

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

	return nil
}

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

	return nil
}

var _ configmaps.Exporter = &NamespacesEventhub{}

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

var _ secrets.Exporter = &NamespacesEventhub{}

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

var _ genruntime.KubernetesResource = &NamespacesEventhub{}

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

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

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

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

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

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

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

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

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

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

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

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

	eventhub.Status = st
	return nil
}

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

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

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

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

	// No error
	return nil
}

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

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

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

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

	// No error
	return nil
}

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

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

type NamespacesEventhub_Spec struct {
	// +kubebuilder:validation:MaxLength=256
	// +kubebuilder:validation:MinLength=1
	// AzureName: The name of the resource in Azure. This is often the same as the name of the resource in Kubernetes but it
	// doesn't have to be.
	AzureName string `json:"azureName,omitempty"`

	// CaptureDescription: Properties of capture description
	CaptureDescription *CaptureDescription `json:"captureDescription,omitempty"`

	// +kubebuilder:validation:Minimum=1
	// MessageRetentionInDays: Number of days to retain the events for this Event Hub, value should be 1 to 7 days
	MessageRetentionInDays *int `json:"messageRetentionInDays,omitempty"`

	// OperatorSpec: The specification for configuring operator behavior. This field is interpreted by the operator and not
	// passed directly to Azure
	OperatorSpec *NamespacesEventhubOperatorSpec `json:"operatorSpec,omitempty"`

	// +kubebuilder:validation:Required
	// Owner: The owner of the resource. The owner controls where the resource goes when it is deployed. The owner also
	// controls the resources lifecycle. When the owner is deleted the resource will also be deleted. Owner is expected to be a
	// reference to a eventhub.azure.com/Namespace resource
	Owner *genruntime.KnownResourceReference `group:"eventhub.azure.com" json:"owner,omitempty" kind:"Namespace"`

	// +kubebuilder:validation:Minimum=1
	// PartitionCount: Number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions.
	PartitionCount *int `json:"partitionCount,omitempty"`
}

var _ genruntime.ARMTransformer = &NamespacesEventhub_Spec{}

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

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

	// Set property "Properties":
	if eventhub.CaptureDescription != nil ||
		eventhub.MessageRetentionInDays != nil ||
		eventhub.PartitionCount != nil {
		result.Properties = &arm.Namespaces_Eventhub_Properties_Spec{}
	}
	if eventhub.CaptureDescription != nil {
		captureDescription_ARM, err := eventhub.CaptureDescription.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		captureDescription := *captureDescription_ARM.(*arm.CaptureDescription)
		result.Properties.CaptureDescription = &captureDescription
	}
	if eventhub.MessageRetentionInDays != nil {
		messageRetentionInDays := *eventhub.MessageRetentionInDays
		result.Properties.MessageRetentionInDays = &messageRetentionInDays
	}
	if eventhub.PartitionCount != nil {
		partitionCount := *eventhub.PartitionCount
		result.Properties.PartitionCount = &partitionCount
	}
	return result, nil
}

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

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

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

	// Set property "CaptureDescription":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CaptureDescription != nil {
			var captureDescription1 CaptureDescription
			err := captureDescription1.PopulateFromARM(owner, *typedInput.Properties.CaptureDescription)
			if err != nil {
				return err
			}
			captureDescription := captureDescription1
			eventhub.CaptureDescription = &captureDescription
		}
	}

	// Set property "MessageRetentionInDays":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MessageRetentionInDays != nil {
			messageRetentionInDays := *typedInput.Properties.MessageRetentionInDays
			eventhub.MessageRetentionInDays = &messageRetentionInDays
		}
	}

	// no assignment for property "OperatorSpec"

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

	// Set property "PartitionCount":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PartitionCount != nil {
			partitionCount := *typedInput.Properties.PartitionCount
			eventhub.PartitionCount = &partitionCount
		}
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &NamespacesEventhub_Spec{}

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

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

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

	return nil
}

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

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

	// Update dst from our instance
	err = dst.ConvertSpecTo(destination)
	if err != nil {
		return eris.Wrap(err, "final step of conversion in ConvertSpecTo()")
	}

	return nil
}

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

	// AzureName
	eventhub.AzureName = source.AzureName

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

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

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

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

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

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = eventhub.AzureName

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

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

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

	// OriginalVersion
	destination.OriginalVersion = eventhub.OriginalVersion()

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

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

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

	// No error
	return nil
}

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

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

type NamespacesEventhub_STATUS struct {
	// CaptureDescription: Properties of capture description
	CaptureDescription *CaptureDescription_STATUS `json:"captureDescription,omitempty"`

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

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

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

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

	// MessageRetentionInDays: Number of days to retain the events for this Event Hub, value should be 1 to 7 days
	MessageRetentionInDays *int `json:"messageRetentionInDays,omitempty"`

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

	// PartitionCount: Number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions.
	PartitionCount *int `json:"partitionCount,omitempty"`

	// PartitionIds: Current number of shards on the Event Hub.
	PartitionIds []string `json:"partitionIds,omitempty"`

	// Status: Enumerates the possible values for the status of the Event Hub.
	Status *Namespaces_Eventhub_Properties_Status_STATUS `json:"status,omitempty"`

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

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

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

var _ genruntime.ConvertibleStatus = &NamespacesEventhub_STATUS{}

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

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

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

	return nil
}

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

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

	// Update dst from our instance
	err = dst.ConvertStatusTo(destination)
	if err != nil {
		return eris.Wrap(err, "final step of conversion in ConvertStatusTo()")
	}

	return nil
}

var _ genruntime.FromARMConverter = &NamespacesEventhub_STATUS{}

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

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

	// Set property "CaptureDescription":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CaptureDescription != nil {
			var captureDescription1 CaptureDescription_STATUS
			err := captureDescription1.PopulateFromARM(owner, *typedInput.Properties.CaptureDescription)
			if err != nil {
				return err
			}
			captureDescription := captureDescription1
			eventhub.CaptureDescription = &captureDescription
		}
	}

	// no assignment for property "Conditions"

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

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

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

	// Set property "MessageRetentionInDays":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MessageRetentionInDays != nil {
			messageRetentionInDays := *typedInput.Properties.MessageRetentionInDays
			eventhub.MessageRetentionInDays = &messageRetentionInDays
		}
	}

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

	// Set property "PartitionCount":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PartitionCount != nil {
			partitionCount := *typedInput.Properties.PartitionCount
			eventhub.PartitionCount = &partitionCount
		}
	}

	// Set property "PartitionIds":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.PartitionIds {
			eventhub.PartitionIds = append(eventhub.PartitionIds, item)
		}
	}

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

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

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

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

	// No error
	return nil
}

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

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

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

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

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

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

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

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

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

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

	// Status
	if source.Status != nil {
		status := *source.Status
		statusTemp := genruntime.ToEnum(status, namespaces_Eventhub_Properties_Status_STATUS_Values)
		eventhub.Status = &statusTemp
	} else {
		eventhub.Status = nil
	}

	// SystemData
	if source.SystemData != nil {
		var systemDatum SystemData_STATUS
		err := systemDatum.AssignProperties_From_SystemData_STATUS(source.SystemData)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SystemData_STATUS() to populate field SystemData")
		}
		eventhub.SystemData = &systemDatum
	} else {
		eventhub.SystemData = nil
	}

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

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

	// No error
	return nil
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	// No error
	return nil
}

// Properties to configure capture description for eventhub
type CaptureDescription struct {
	// Destination: Properties of Destination where capture will be stored. (Storage Account, Blob Names)
	Destination *Destination `json:"destination,omitempty"`

	// Enabled: A value that indicates whether capture description is enabled.
	Enabled *bool `json:"enabled,omitempty"`

	// Encoding: Enumerates the possible values for the encoding format of capture description. Note: 'AvroDeflate' will be
	// deprecated in New API Version
	Encoding *CaptureDescription_Encoding `json:"encoding,omitempty"`

	// IntervalInSeconds: The time window allows you to set the frequency with which the capture to Azure Blobs will happen,
	// value should between 60 to 900 seconds
	IntervalInSeconds *int `json:"intervalInSeconds,omitempty"`

	// SizeLimitInBytes: The size window defines the amount of data built up in your Event Hub before an capture operation,
	// value should be between 10485760 to 524288000 bytes
	SizeLimitInBytes *int `json:"sizeLimitInBytes,omitempty"`

	// SkipEmptyArchives: A value that indicates whether to Skip Empty Archives
	SkipEmptyArchives *bool `json:"skipEmptyArchives,omitempty"`
}

var _ genruntime.ARMTransformer = &CaptureDescription{}

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

	// Set property "Destination":
	if description.Destination != nil {
		destination_ARM, err := description.Destination.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		destination := *destination_ARM.(*arm.Destination)
		result.Destination = &destination
	}

	// Set property "Enabled":
	if description.Enabled != nil {
		enabled := *description.Enabled
		result.Enabled = &enabled
	}

	// Set property "Encoding":
	if description.Encoding != nil {
		var temp string
		temp = string(*description.Encoding)
		encoding := arm.CaptureDescription_Encoding(temp)
		result.Encoding = &encoding
	}

	// Set property "IntervalInSeconds":
	if description.IntervalInSeconds != nil {
		intervalInSeconds := *description.IntervalInSeconds
		result.IntervalInSeconds = &intervalInSeconds
	}

	// Set property "SizeLimitInBytes":
	if description.SizeLimitInBytes != nil {
		sizeLimitInBytes := *description.SizeLimitInBytes
		result.SizeLimitInBytes = &sizeLimitInBytes
	}

	// Set property "SkipEmptyArchives":
	if description.SkipEmptyArchives != nil {
		skipEmptyArchives := *description.SkipEmptyArchives
		result.SkipEmptyArchives = &skipEmptyArchives
	}
	return result, nil
}

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

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

	// Set property "Destination":
	if typedInput.Destination != nil {
		var destination1 Destination
		err := destination1.PopulateFromARM(owner, *typedInput.Destination)
		if err != nil {
			return err
		}
		destination := destination1
		description.Destination = &destination
	}

	// Set property "Enabled":
	if typedInput.Enabled != nil {
		enabled := *typedInput.Enabled
		description.Enabled = &enabled
	}

	// Set property "Encoding":
	if typedInput.Encoding != nil {
		var temp string
		temp = string(*typedInput.Encoding)
		encoding := CaptureDescription_Encoding(temp)
		description.Encoding = &encoding
	}

	// Set property "IntervalInSeconds":
	if typedInput.IntervalInSeconds != nil {
		intervalInSeconds := *typedInput.IntervalInSeconds
		description.IntervalInSeconds = &intervalInSeconds
	}

	// Set property "SizeLimitInBytes":
	if typedInput.SizeLimitInBytes != nil {
		sizeLimitInBytes := *typedInput.SizeLimitInBytes
		description.SizeLimitInBytes = &sizeLimitInBytes
	}

	// Set property "SkipEmptyArchives":
	if typedInput.SkipEmptyArchives != nil {
		skipEmptyArchives := *typedInput.SkipEmptyArchives
		description.SkipEmptyArchives = &skipEmptyArchives
	}

	// No error
	return nil
}

// AssignProperties_From_CaptureDescription populates our CaptureDescription from the provided source CaptureDescription
func (description *CaptureDescription) AssignProperties_From_CaptureDescription(source *storage.CaptureDescription) error {

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

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

	// Encoding
	if source.Encoding != nil {
		encoding := *source.Encoding
		encodingTemp := genruntime.ToEnum(encoding, captureDescription_Encoding_Values)
		description.Encoding = &encodingTemp
	} else {
		description.Encoding = nil
	}

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

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

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

	// No error
	return nil
}

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

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

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

	// Encoding
	if description.Encoding != nil {
		encoding := string(*description.Encoding)
		destination.Encoding = &encoding
	} else {
		destination.Encoding = nil
	}

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

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

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

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

	// No error
	return nil
}

// Properties to configure capture description for eventhub
type CaptureDescription_STATUS struct {
	// Destination: Properties of Destination where capture will be stored. (Storage Account, Blob Names)
	Destination *Destination_STATUS `json:"destination,omitempty"`

	// Enabled: A value that indicates whether capture description is enabled.
	Enabled *bool `json:"enabled,omitempty"`

	// Encoding: Enumerates the possible values for the encoding format of capture description. Note: 'AvroDeflate' will be
	// deprecated in New API Version
	Encoding *CaptureDescription_Encoding_STATUS `json:"encoding,omitempty"`

	// IntervalInSeconds: The time window allows you to set the frequency with which the capture to Azure Blobs will happen,
	// value should between 60 to 900 seconds
	IntervalInSeconds *int `json:"intervalInSeconds,omitempty"`

	// SizeLimitInBytes: The size window defines the amount of data built up in your Event Hub before an capture operation,
	// value should be between 10485760 to 524288000 bytes
	SizeLimitInBytes *int `json:"sizeLimitInBytes,omitempty"`

	// SkipEmptyArchives: A value that indicates whether to Skip Empty Archives
	SkipEmptyArchives *bool `json:"skipEmptyArchives,omitempty"`
}

var _ genruntime.FromARMConverter = &CaptureDescription_STATUS{}

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

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

	// Set property "Destination":
	if typedInput.Destination != nil {
		var destination1 Destination_STATUS
		err := destination1.PopulateFromARM(owner, *typedInput.Destination)
		if err != nil {
			return err
		}
		destination := destination1
		description.Destination = &destination
	}

	// Set property "Enabled":
	if typedInput.Enabled != nil {
		enabled := *typedInput.Enabled
		description.Enabled = &enabled
	}

	// Set property "Encoding":
	if typedInput.Encoding != nil {
		var temp string
		temp = string(*typedInput.Encoding)
		encoding := CaptureDescription_Encoding_STATUS(temp)
		description.Encoding = &encoding
	}

	// Set property "IntervalInSeconds":
	if typedInput.IntervalInSeconds != nil {
		intervalInSeconds := *typedInput.IntervalInSeconds
		description.IntervalInSeconds = &intervalInSeconds
	}

	// Set property "SizeLimitInBytes":
	if typedInput.SizeLimitInBytes != nil {
		sizeLimitInBytes := *typedInput.SizeLimitInBytes
		description.SizeLimitInBytes = &sizeLimitInBytes
	}

	// Set property "SkipEmptyArchives":
	if typedInput.SkipEmptyArchives != nil {
		skipEmptyArchives := *typedInput.SkipEmptyArchives
		description.SkipEmptyArchives = &skipEmptyArchives
	}

	// No error
	return nil
}

// AssignProperties_From_CaptureDescription_STATUS populates our CaptureDescription_STATUS from the provided source CaptureDescription_STATUS
func (description *CaptureDescription_STATUS) AssignProperties_From_CaptureDescription_STATUS(source *storage.CaptureDescription_STATUS) error {

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

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

	// Encoding
	if source.Encoding != nil {
		encoding := *source.Encoding
		encodingTemp := genruntime.ToEnum(encoding, captureDescription_Encoding_STATUS_Values)
		description.Encoding = &encodingTemp
	} else {
		description.Encoding = nil
	}

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

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

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

	// No error
	return nil
}

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

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

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

	// Encoding
	if description.Encoding != nil {
		encoding := string(*description.Encoding)
		destination.Encoding = &encoding
	} else {
		destination.Encoding = nil
	}

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

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

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

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

	// No error
	return nil
}

type Namespaces_Eventhub_Properties_Status_STATUS string

const (
	Namespaces_Eventhub_Properties_Status_STATUS_Active          = Namespaces_Eventhub_Properties_Status_STATUS("Active")
	Namespaces_Eventhub_Properties_Status_STATUS_Creating        = Namespaces_Eventhub_Properties_Status_STATUS("Creating")
	Namespaces_Eventhub_Properties_Status_STATUS_Deleting        = Namespaces_Eventhub_Properties_Status_STATUS("Deleting")
	Namespaces_Eventhub_Properties_Status_STATUS_Disabled        = Namespaces_Eventhub_Properties_Status_STATUS("Disabled")
	Namespaces_Eventhub_Properties_Status_STATUS_ReceiveDisabled = Namespaces_Eventhub_Properties_Status_STATUS("ReceiveDisabled")
	Namespaces_Eventhub_Properties_Status_STATUS_Renaming        = Namespaces_Eventhub_Properties_Status_STATUS("Renaming")
	Namespaces_Eventhub_Properties_Status_STATUS_Restoring       = Namespaces_Eventhub_Properties_Status_STATUS("Restoring")
	Namespaces_Eventhub_Properties_Status_STATUS_SendDisabled    = Namespaces_Eventhub_Properties_Status_STATUS("SendDisabled")
	Namespaces_Eventhub_Properties_Status_STATUS_Unknown         = Namespaces_Eventhub_Properties_Status_STATUS("Unknown")
)

// Mapping from string to Namespaces_Eventhub_Properties_Status_STATUS
var namespaces_Eventhub_Properties_Status_STATUS_Values = map[string]Namespaces_Eventhub_Properties_Status_STATUS{
	"active":          Namespaces_Eventhub_Properties_Status_STATUS_Active,
	"creating":        Namespaces_Eventhub_Properties_Status_STATUS_Creating,
	"deleting":        Namespaces_Eventhub_Properties_Status_STATUS_Deleting,
	"disabled":        Namespaces_Eventhub_Properties_Status_STATUS_Disabled,
	"receivedisabled": Namespaces_Eventhub_Properties_Status_STATUS_ReceiveDisabled,
	"renaming":        Namespaces_Eventhub_Properties_Status_STATUS_Renaming,
	"restoring":       Namespaces_Eventhub_Properties_Status_STATUS_Restoring,
	"senddisabled":    Namespaces_Eventhub_Properties_Status_STATUS_SendDisabled,
	"unknown":         Namespaces_Eventhub_Properties_Status_STATUS_Unknown,
}

// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure
type NamespacesEventhubOperatorSpec struct {
	// ConfigMapExpressions: configures where to place operator written dynamic ConfigMaps (created with CEL expressions).
	ConfigMapExpressions []*core.DestinationExpression `json:"configMapExpressions,omitempty"`

	// SecretExpressions: configures where to place operator written dynamic secrets (created with CEL expressions).
	SecretExpressions []*core.DestinationExpression `json:"secretExpressions,omitempty"`
}

// AssignProperties_From_NamespacesEventhubOperatorSpec populates our NamespacesEventhubOperatorSpec from the provided source NamespacesEventhubOperatorSpec
func (operator *NamespacesEventhubOperatorSpec) AssignProperties_From_NamespacesEventhubOperatorSpec(source *storage.NamespacesEventhubOperatorSpec) error {

	// ConfigMapExpressions
	if source.ConfigMapExpressions != nil {
		configMapExpressionList := make([]*core.DestinationExpression, len(source.ConfigMapExpressions))
		for configMapExpressionIndex, configMapExpressionItem := range source.ConfigMapExpressions {
			if configMapExpressionItem != nil {
				configMapExpression := *configMapExpressionItem.DeepCopy()
				configMapExpressionList[configMapExpressionIndex] = &configMapExpression
			} else {
				configMapExpressionList[configMapExpressionIndex] = nil
			}
		}
		operator.ConfigMapExpressions = configMapExpressionList
	} else {
		operator.ConfigMapExpressions = nil
	}

	// SecretExpressions
	if source.SecretExpressions != nil {
		secretExpressionList := make([]*core.DestinationExpression, len(source.SecretExpressions))
		for secretExpressionIndex, secretExpressionItem := range source.SecretExpressions {
			if secretExpressionItem != nil {
				secretExpression := *secretExpressionItem.DeepCopy()
				secretExpressionList[secretExpressionIndex] = &secretExpression
			} else {
				secretExpressionList[secretExpressionIndex] = nil
			}
		}
		operator.SecretExpressions = secretExpressionList
	} else {
		operator.SecretExpressions = nil
	}

	// No error
	return nil
}

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

	// ConfigMapExpressions
	if operator.ConfigMapExpressions != nil {
		configMapExpressionList := make([]*core.DestinationExpression, len(operator.ConfigMapExpressions))
		for configMapExpressionIndex, configMapExpressionItem := range operator.ConfigMapExpressions {
			if configMapExpressionItem != nil {
				configMapExpression := *configMapExpressionItem.DeepCopy()
				configMapExpressionList[configMapExpressionIndex] = &configMapExpression
			} else {
				configMapExpressionList[configMapExpressionIndex] = nil
			}
		}
		destination.ConfigMapExpressions = configMapExpressionList
	} else {
		destination.ConfigMapExpressions = nil
	}

	// SecretExpressions
	if operator.SecretExpressions != nil {
		secretExpressionList := make([]*core.DestinationExpression, len(operator.SecretExpressions))
		for secretExpressionIndex, secretExpressionItem := range operator.SecretExpressions {
			if secretExpressionItem != nil {
				secretExpression := *secretExpressionItem.DeepCopy()
				secretExpressionList[secretExpressionIndex] = &secretExpression
			} else {
				secretExpressionList[secretExpressionIndex] = nil
			}
		}
		destination.SecretExpressions = secretExpressionList
	} else {
		destination.SecretExpressions = nil
	}

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"Avro","AvroDeflate"}
type CaptureDescription_Encoding string

const (
	CaptureDescription_Encoding_Avro        = CaptureDescription_Encoding("Avro")
	CaptureDescription_Encoding_AvroDeflate = CaptureDescription_Encoding("AvroDeflate")
)

// Mapping from string to CaptureDescription_Encoding
var captureDescription_Encoding_Values = map[string]CaptureDescription_Encoding{
	"avro":        CaptureDescription_Encoding_Avro,
	"avrodeflate": CaptureDescription_Encoding_AvroDeflate,
}

type CaptureDescription_Encoding_STATUS string

const (
	CaptureDescription_Encoding_STATUS_Avro        = CaptureDescription_Encoding_STATUS("Avro")
	CaptureDescription_Encoding_STATUS_AvroDeflate = CaptureDescription_Encoding_STATUS("AvroDeflate")
)

// Mapping from string to CaptureDescription_Encoding_STATUS
var captureDescription_Encoding_STATUS_Values = map[string]CaptureDescription_Encoding_STATUS{
	"avro":        CaptureDescription_Encoding_STATUS_Avro,
	"avrodeflate": CaptureDescription_Encoding_STATUS_AvroDeflate,
}

// Capture storage details for capture description
type Destination struct {
	// ArchiveNameFormat: Blob naming convention for archive, e.g.
	// {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}. Here all the parameters
	// (Namespace,EventHub .. etc) are mandatory irrespective of order
	ArchiveNameFormat *string `json:"archiveNameFormat,omitempty"`

	// BlobContainer: Blob container Name
	BlobContainer *string `json:"blobContainer,omitempty"`

	// DataLakeAccountName: The Azure Data Lake Store name for the captured events
	DataLakeAccountName *string `json:"dataLakeAccountName,omitempty"`

	// DataLakeFolderPath: The destination folder path for the captured events
	DataLakeFolderPath *string `json:"dataLakeFolderPath,omitempty"`

	// +kubebuilder:validation:Pattern="^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
	// DataLakeSubscriptionId: Subscription Id of Azure Data Lake Store
	DataLakeSubscriptionId *string `json:"dataLakeSubscriptionId,omitempty"`

	// Name: Name for capture destination
	Name *string `json:"name,omitempty"`

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

var _ genruntime.ARMTransformer = &Destination{}

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

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

	// Set property "Properties":
	if destination.ArchiveNameFormat != nil ||
		destination.BlobContainer != nil ||
		destination.DataLakeAccountName != nil ||
		destination.DataLakeFolderPath != nil ||
		destination.DataLakeSubscriptionId != nil ||
		destination.StorageAccountResourceReference != nil {
		result.Properties = &arm.Destination_Properties{}
	}
	if destination.ArchiveNameFormat != nil {
		archiveNameFormat := *destination.ArchiveNameFormat
		result.Properties.ArchiveNameFormat = &archiveNameFormat
	}
	if destination.BlobContainer != nil {
		blobContainer := *destination.BlobContainer
		result.Properties.BlobContainer = &blobContainer
	}
	if destination.DataLakeAccountName != nil {
		dataLakeAccountName := *destination.DataLakeAccountName
		result.Properties.DataLakeAccountName = &dataLakeAccountName
	}
	if destination.DataLakeFolderPath != nil {
		dataLakeFolderPath := *destination.DataLakeFolderPath
		result.Properties.DataLakeFolderPath = &dataLakeFolderPath
	}
	if destination.DataLakeSubscriptionId != nil {
		dataLakeSubscriptionId := *destination.DataLakeSubscriptionId
		result.Properties.DataLakeSubscriptionId = &dataLakeSubscriptionId
	}
	if destination.StorageAccountResourceReference != nil {
		storageAccountResourceIdARMID, err := resolved.ResolvedReferences.Lookup(*destination.StorageAccountResourceReference)
		if err != nil {
			return nil, err
		}
		storageAccountResourceId := storageAccountResourceIdARMID
		result.Properties.StorageAccountResourceId = &storageAccountResourceId
	}
	return result, nil
}

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

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

	// Set property "ArchiveNameFormat":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ArchiveNameFormat != nil {
			archiveNameFormat := *typedInput.Properties.ArchiveNameFormat
			destination.ArchiveNameFormat = &archiveNameFormat
		}
	}

	// Set property "BlobContainer":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.BlobContainer != nil {
			blobContainer := *typedInput.Properties.BlobContainer
			destination.BlobContainer = &blobContainer
		}
	}

	// Set property "DataLakeAccountName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DataLakeAccountName != nil {
			dataLakeAccountName := *typedInput.Properties.DataLakeAccountName
			destination.DataLakeAccountName = &dataLakeAccountName
		}
	}

	// Set property "DataLakeFolderPath":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DataLakeFolderPath != nil {
			dataLakeFolderPath := *typedInput.Properties.DataLakeFolderPath
			destination.DataLakeFolderPath = &dataLakeFolderPath
		}
	}

	// Set property "DataLakeSubscriptionId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DataLakeSubscriptionId != nil {
			dataLakeSubscriptionId := *typedInput.Properties.DataLakeSubscriptionId
			destination.DataLakeSubscriptionId = &dataLakeSubscriptionId
		}
	}

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

	// no assignment for property "StorageAccountResourceReference"

	// No error
	return nil
}

// AssignProperties_From_Destination populates our Destination from the provided source Destination
func (destination *Destination) AssignProperties_From_Destination(source *storage.Destination) error {

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

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

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

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

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

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

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

	// No error
	return nil
}

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

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

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

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

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

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

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

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

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

	// No error
	return nil
}

// Capture storage details for capture description
type Destination_STATUS struct {
	// ArchiveNameFormat: Blob naming convention for archive, e.g.
	// {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}. Here all the parameters
	// (Namespace,EventHub .. etc) are mandatory irrespective of order
	ArchiveNameFormat *string `json:"archiveNameFormat,omitempty"`

	// BlobContainer: Blob container Name
	BlobContainer *string `json:"blobContainer,omitempty"`

	// DataLakeAccountName: The Azure Data Lake Store name for the captured events
	DataLakeAccountName *string `json:"dataLakeAccountName,omitempty"`

	// DataLakeFolderPath: The destination folder path for the captured events
	DataLakeFolderPath *string `json:"dataLakeFolderPath,omitempty"`

	// DataLakeSubscriptionId: Subscription Id of Azure Data Lake Store
	DataLakeSubscriptionId *string `json:"dataLakeSubscriptionId,omitempty"`

	// Name: Name for capture destination
	Name *string `json:"name,omitempty"`

	// StorageAccountResourceId: Resource id of the storage account to be used to create the blobs
	StorageAccountResourceId *string `json:"storageAccountResourceId,omitempty"`
}

var _ genruntime.FromARMConverter = &Destination_STATUS{}

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

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

	// Set property "ArchiveNameFormat":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ArchiveNameFormat != nil {
			archiveNameFormat := *typedInput.Properties.ArchiveNameFormat
			destination.ArchiveNameFormat = &archiveNameFormat
		}
	}

	// Set property "BlobContainer":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.BlobContainer != nil {
			blobContainer := *typedInput.Properties.BlobContainer
			destination.BlobContainer = &blobContainer
		}
	}

	// Set property "DataLakeAccountName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DataLakeAccountName != nil {
			dataLakeAccountName := *typedInput.Properties.DataLakeAccountName
			destination.DataLakeAccountName = &dataLakeAccountName
		}
	}

	// Set property "DataLakeFolderPath":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DataLakeFolderPath != nil {
			dataLakeFolderPath := *typedInput.Properties.DataLakeFolderPath
			destination.DataLakeFolderPath = &dataLakeFolderPath
		}
	}

	// Set property "DataLakeSubscriptionId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DataLakeSubscriptionId != nil {
			dataLakeSubscriptionId := *typedInput.Properties.DataLakeSubscriptionId
			destination.DataLakeSubscriptionId = &dataLakeSubscriptionId
		}
	}

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

	// Set property "StorageAccountResourceId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.StorageAccountResourceId != nil {
			storageAccountResourceId := *typedInput.Properties.StorageAccountResourceId
			destination.StorageAccountResourceId = &storageAccountResourceId
		}
	}

	// No error
	return nil
}

// AssignProperties_From_Destination_STATUS populates our Destination_STATUS from the provided source Destination_STATUS
func (destination *Destination_STATUS) AssignProperties_From_Destination_STATUS(source *storage.Destination_STATUS) error {

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

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

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

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

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

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

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

	// No error
	return nil
}

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

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

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

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

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

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

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

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

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

	// No error
	return nil
}

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