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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/cache/v1api20210301/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/cache/v1api20210301/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,cache}
// +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: /redisenterprise/resource-manager/Microsoft.Cache/RedisEnterprise/stable/2021-03-01/redisenterprise.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}
type RedisEnterprise struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              RedisEnterprise_Spec   `json:"spec,omitempty"`
	Status            RedisEnterprise_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &RedisEnterprise{}

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

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

var _ conversion.Convertible = &RedisEnterprise{}

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

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

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

	return nil
}

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

	return nil
}

var _ configmaps.Exporter = &RedisEnterprise{}

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

var _ secrets.Exporter = &RedisEnterprise{}

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

var _ genruntime.KubernetesResource = &RedisEnterprise{}

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

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

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.Cache/redisEnterprise"
func (enterprise *RedisEnterprise) GetType() string {
	return "Microsoft.Cache/redisEnterprise"
}

// NewEmptyStatus returns a new empty (blank) status
func (enterprise *RedisEnterprise) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &RedisEnterprise_STATUS{}
}

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

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

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

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

	enterprise.Status = st
	return nil
}

// AssignProperties_From_RedisEnterprise populates our RedisEnterprise from the provided source RedisEnterprise
func (enterprise *RedisEnterprise) AssignProperties_From_RedisEnterprise(source *storage.RedisEnterprise) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_RedisEnterprise populates the provided destination RedisEnterprise from our RedisEnterprise
func (enterprise *RedisEnterprise) AssignProperties_To_RedisEnterprise(destination *storage.RedisEnterprise) error {

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /redisenterprise/resource-manager/Microsoft.Cache/RedisEnterprise/stable/2021-03-01/redisenterprise.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}
type RedisEnterpriseList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []RedisEnterprise `json:"items"`
}

// +kubebuilder:validation:Enum={"2021-03-01"}
type APIVersion string

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

type RedisEnterprise_Spec struct {
	// AzureName: The name of the resource in Azure. This is often the same as the name of the resource in Kubernetes but it
	// doesn't have to be.
	AzureName string `json:"azureName,omitempty"`

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

	// MinimumTlsVersion: The minimum TLS version for the cluster to support, e.g. '1.2'
	MinimumTlsVersion *ClusterProperties_MinimumTlsVersion `json:"minimumTlsVersion,omitempty"`

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

	// +kubebuilder:validation:Required
	// Sku: The SKU to create, which affects price, performance, and features.
	Sku *Sku `json:"sku,omitempty"`

	// Tags: Resource tags.
	Tags map[string]string `json:"tags,omitempty"`

	// Zones: The Availability Zones where this cluster will be deployed.
	Zones []string `json:"zones,omitempty"`
}

var _ genruntime.ARMTransformer = &RedisEnterprise_Spec{}

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

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

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

	// Set property "Properties":
	if enterprise.MinimumTlsVersion != nil {
		result.Properties = &arm.ClusterProperties{}
	}
	if enterprise.MinimumTlsVersion != nil {
		var temp string
		temp = string(*enterprise.MinimumTlsVersion)
		minimumTlsVersion := arm.ClusterProperties_MinimumTlsVersion(temp)
		result.Properties.MinimumTlsVersion = &minimumTlsVersion
	}

	// Set property "Sku":
	if enterprise.Sku != nil {
		sku_ARM, err := enterprise.Sku.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		sku := *sku_ARM.(*arm.Sku)
		result.Sku = &sku
	}

	// Set property "Tags":
	if enterprise.Tags != nil {
		result.Tags = make(map[string]string, len(enterprise.Tags))
		for key, value := range enterprise.Tags {
			result.Tags[key] = value
		}
	}

	// Set property "Zones":
	for _, item := range enterprise.Zones {
		result.Zones = append(result.Zones, item)
	}
	return result, nil
}

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

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

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

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

	// Set property "MinimumTlsVersion":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MinimumTlsVersion != nil {
			var temp string
			temp = string(*typedInput.Properties.MinimumTlsVersion)
			minimumTlsVersion := ClusterProperties_MinimumTlsVersion(temp)
			enterprise.MinimumTlsVersion = &minimumTlsVersion
		}
	}

	// no assignment for property "OperatorSpec"

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

	// Set property "Sku":
	if typedInput.Sku != nil {
		var sku1 Sku
		err := sku1.PopulateFromARM(owner, *typedInput.Sku)
		if err != nil {
			return err
		}
		sku := sku1
		enterprise.Sku = &sku
	}

	// Set property "Tags":
	if typedInput.Tags != nil {
		enterprise.Tags = make(map[string]string, len(typedInput.Tags))
		for key, value := range typedInput.Tags {
			enterprise.Tags[key] = value
		}
	}

	// Set property "Zones":
	for _, item := range typedInput.Zones {
		enterprise.Zones = append(enterprise.Zones, item)
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &RedisEnterprise_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.RedisEnterprise_Spec{}
	err := enterprise.AssignProperties_To_RedisEnterprise_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_RedisEnterprise_Spec populates our RedisEnterprise_Spec from the provided source RedisEnterprise_Spec
func (enterprise *RedisEnterprise_Spec) AssignProperties_From_RedisEnterprise_Spec(source *storage.RedisEnterprise_Spec) error {

	// AzureName
	enterprise.AzureName = source.AzureName

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

	// MinimumTlsVersion
	if source.MinimumTlsVersion != nil {
		minimumTlsVersion := *source.MinimumTlsVersion
		minimumTlsVersionTemp := genruntime.ToEnum(minimumTlsVersion, clusterProperties_MinimumTlsVersion_Values)
		enterprise.MinimumTlsVersion = &minimumTlsVersionTemp
	} else {
		enterprise.MinimumTlsVersion = nil
	}

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

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

	// 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")
		}
		enterprise.Sku = &sku
	} else {
		enterprise.Sku = nil
	}

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

	// Zones
	enterprise.Zones = genruntime.CloneSliceOfString(source.Zones)

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = enterprise.AzureName

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

	// MinimumTlsVersion
	if enterprise.MinimumTlsVersion != nil {
		minimumTlsVersion := string(*enterprise.MinimumTlsVersion)
		destination.MinimumTlsVersion = &minimumTlsVersion
	} else {
		destination.MinimumTlsVersion = nil
	}

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

	// OriginalVersion
	destination.OriginalVersion = enterprise.OriginalVersion()

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

	// Sku
	if enterprise.Sku != nil {
		var sku storage.Sku
		err := enterprise.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(enterprise.Tags)

	// Zones
	destination.Zones = genruntime.CloneSliceOfString(enterprise.Zones)

	// 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 (enterprise *RedisEnterprise_Spec) OriginalVersion() string {
	return GroupVersion.Version
}

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

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

	// HostName: DNS name of the cluster endpoint
	HostName *string `json:"hostName,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"`

	// MinimumTlsVersion: The minimum TLS version for the cluster to support, e.g. '1.2'
	MinimumTlsVersion *ClusterProperties_MinimumTlsVersion_STATUS `json:"minimumTlsVersion,omitempty"`

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

	// PrivateEndpointConnections: List of private endpoint connections associated with the specified RedisEnterprise cluster
	PrivateEndpointConnections []PrivateEndpointConnection_STATUS `json:"privateEndpointConnections,omitempty"`

	// ProvisioningState: Current provisioning status of the cluster
	ProvisioningState *ProvisioningState_STATUS `json:"provisioningState,omitempty"`

	// RedisVersion: Version of redis the cluster supports, e.g. '6'
	RedisVersion *string `json:"redisVersion,omitempty"`

	// ResourceState: Current resource status of the cluster
	ResourceState *ResourceState_STATUS `json:"resourceState,omitempty"`

	// Sku: The SKU to create, which affects price, performance, and features.
	Sku *Sku_STATUS `json:"sku,omitempty"`

	// Tags: Resource tags.
	Tags map[string]string `json:"tags,omitempty"`

	// Type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string `json:"type,omitempty"`

	// Zones: The Availability Zones where this cluster will be deployed.
	Zones []string `json:"zones,omitempty"`
}

var _ genruntime.ConvertibleStatus = &RedisEnterprise_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.RedisEnterprise_STATUS{}
	err := enterprise.AssignProperties_To_RedisEnterprise_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 = &RedisEnterprise_STATUS{}

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

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

	// no assignment for property "Conditions"

	// Set property "HostName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.HostName != nil {
			hostName := *typedInput.Properties.HostName
			enterprise.HostName = &hostName
		}
	}

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

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

	// Set property "MinimumTlsVersion":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MinimumTlsVersion != nil {
			var temp string
			temp = string(*typedInput.Properties.MinimumTlsVersion)
			minimumTlsVersion := ClusterProperties_MinimumTlsVersion_STATUS(temp)
			enterprise.MinimumTlsVersion = &minimumTlsVersion
		}
	}

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

	// Set property "PrivateEndpointConnections":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.PrivateEndpointConnections {
			var item1 PrivateEndpointConnection_STATUS
			err := item1.PopulateFromARM(owner, item)
			if err != nil {
				return err
			}
			enterprise.PrivateEndpointConnections = append(enterprise.PrivateEndpointConnections, item1)
		}
	}

	// Set property "ProvisioningState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ProvisioningState != nil {
			var temp string
			temp = string(*typedInput.Properties.ProvisioningState)
			provisioningState := ProvisioningState_STATUS(temp)
			enterprise.ProvisioningState = &provisioningState
		}
	}

	// Set property "RedisVersion":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RedisVersion != nil {
			redisVersion := *typedInput.Properties.RedisVersion
			enterprise.RedisVersion = &redisVersion
		}
	}

	// Set property "ResourceState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ResourceState != nil {
			var temp string
			temp = string(*typedInput.Properties.ResourceState)
			resourceState := ResourceState_STATUS(temp)
			enterprise.ResourceState = &resourceState
		}
	}

	// Set property "Sku":
	if typedInput.Sku != nil {
		var sku1 Sku_STATUS
		err := sku1.PopulateFromARM(owner, *typedInput.Sku)
		if err != nil {
			return err
		}
		sku := sku1
		enterprise.Sku = &sku
	}

	// Set property "Tags":
	if typedInput.Tags != nil {
		enterprise.Tags = make(map[string]string, len(typedInput.Tags))
		for key, value := range typedInput.Tags {
			enterprise.Tags[key] = value
		}
	}

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

	// Set property "Zones":
	for _, item := range typedInput.Zones {
		enterprise.Zones = append(enterprise.Zones, item)
	}

	// No error
	return nil
}

// AssignProperties_From_RedisEnterprise_STATUS populates our RedisEnterprise_STATUS from the provided source RedisEnterprise_STATUS
func (enterprise *RedisEnterprise_STATUS) AssignProperties_From_RedisEnterprise_STATUS(source *storage.RedisEnterprise_STATUS) error {

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

	// HostName
	enterprise.HostName = genruntime.ClonePointerToString(source.HostName)

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

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

	// MinimumTlsVersion
	if source.MinimumTlsVersion != nil {
		minimumTlsVersion := *source.MinimumTlsVersion
		minimumTlsVersionTemp := genruntime.ToEnum(minimumTlsVersion, clusterProperties_MinimumTlsVersion_STATUS_Values)
		enterprise.MinimumTlsVersion = &minimumTlsVersionTemp
	} else {
		enterprise.MinimumTlsVersion = nil
	}

	// Name
	enterprise.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
		}
		enterprise.PrivateEndpointConnections = privateEndpointConnectionList
	} else {
		enterprise.PrivateEndpointConnections = nil
	}

	// ProvisioningState
	if source.ProvisioningState != nil {
		provisioningState := *source.ProvisioningState
		provisioningStateTemp := genruntime.ToEnum(provisioningState, provisioningState_STATUS_Values)
		enterprise.ProvisioningState = &provisioningStateTemp
	} else {
		enterprise.ProvisioningState = nil
	}

	// RedisVersion
	enterprise.RedisVersion = genruntime.ClonePointerToString(source.RedisVersion)

	// ResourceState
	if source.ResourceState != nil {
		resourceState := *source.ResourceState
		resourceStateTemp := genruntime.ToEnum(resourceState, resourceState_STATUS_Values)
		enterprise.ResourceState = &resourceStateTemp
	} else {
		enterprise.ResourceState = nil
	}

	// 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")
		}
		enterprise.Sku = &sku
	} else {
		enterprise.Sku = nil
	}

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

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

	// Zones
	enterprise.Zones = genruntime.CloneSliceOfString(source.Zones)

	// No error
	return nil
}

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

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

	// HostName
	destination.HostName = genruntime.ClonePointerToString(enterprise.HostName)

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

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

	// MinimumTlsVersion
	if enterprise.MinimumTlsVersion != nil {
		minimumTlsVersion := string(*enterprise.MinimumTlsVersion)
		destination.MinimumTlsVersion = &minimumTlsVersion
	} else {
		destination.MinimumTlsVersion = nil
	}

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

	// PrivateEndpointConnections
	if enterprise.PrivateEndpointConnections != nil {
		privateEndpointConnectionList := make([]storage.PrivateEndpointConnection_STATUS, len(enterprise.PrivateEndpointConnections))
		for privateEndpointConnectionIndex, privateEndpointConnectionItem := range enterprise.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
	if enterprise.ProvisioningState != nil {
		provisioningState := string(*enterprise.ProvisioningState)
		destination.ProvisioningState = &provisioningState
	} else {
		destination.ProvisioningState = nil
	}

	// RedisVersion
	destination.RedisVersion = genruntime.ClonePointerToString(enterprise.RedisVersion)

	// ResourceState
	if enterprise.ResourceState != nil {
		resourceState := string(*enterprise.ResourceState)
		destination.ResourceState = &resourceState
	} else {
		destination.ResourceState = nil
	}

	// Sku
	if enterprise.Sku != nil {
		var sku storage.Sku_STATUS
		err := enterprise.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
	}

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

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

	// Zones
	destination.Zones = genruntime.CloneSliceOfString(enterprise.Zones)

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"1.0","1.1","1.2"}
type ClusterProperties_MinimumTlsVersion string

const (
	ClusterProperties_MinimumTlsVersion_10 = ClusterProperties_MinimumTlsVersion("1.0")
	ClusterProperties_MinimumTlsVersion_11 = ClusterProperties_MinimumTlsVersion("1.1")
	ClusterProperties_MinimumTlsVersion_12 = ClusterProperties_MinimumTlsVersion("1.2")
)

// Mapping from string to ClusterProperties_MinimumTlsVersion
var clusterProperties_MinimumTlsVersion_Values = map[string]ClusterProperties_MinimumTlsVersion{
	"1.0": ClusterProperties_MinimumTlsVersion_10,
	"1.1": ClusterProperties_MinimumTlsVersion_11,
	"1.2": ClusterProperties_MinimumTlsVersion_12,
}

type ClusterProperties_MinimumTlsVersion_STATUS string

const (
	ClusterProperties_MinimumTlsVersion_STATUS_10 = ClusterProperties_MinimumTlsVersion_STATUS("1.0")
	ClusterProperties_MinimumTlsVersion_STATUS_11 = ClusterProperties_MinimumTlsVersion_STATUS("1.1")
	ClusterProperties_MinimumTlsVersion_STATUS_12 = ClusterProperties_MinimumTlsVersion_STATUS("1.2")
)

// Mapping from string to ClusterProperties_MinimumTlsVersion_STATUS
var clusterProperties_MinimumTlsVersion_STATUS_Values = map[string]ClusterProperties_MinimumTlsVersion_STATUS{
	"1.0": ClusterProperties_MinimumTlsVersion_STATUS_10,
	"1.1": ClusterProperties_MinimumTlsVersion_STATUS_11,
	"1.2": ClusterProperties_MinimumTlsVersion_STATUS_12,
}

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

var _ genruntime.FromARMConverter = &PrivateEndpointConnection_STATUS{}

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

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

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

	// No error
	return nil
}

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

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

	// 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 {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

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

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

	// No error
	return nil
}

// Current provisioning status
type ProvisioningState_STATUS string

const (
	ProvisioningState_STATUS_Canceled  = ProvisioningState_STATUS("Canceled")
	ProvisioningState_STATUS_Creating  = ProvisioningState_STATUS("Creating")
	ProvisioningState_STATUS_Deleting  = ProvisioningState_STATUS("Deleting")
	ProvisioningState_STATUS_Failed    = ProvisioningState_STATUS("Failed")
	ProvisioningState_STATUS_Succeeded = ProvisioningState_STATUS("Succeeded")
	ProvisioningState_STATUS_Updating  = ProvisioningState_STATUS("Updating")
)

// Mapping from string to ProvisioningState_STATUS
var provisioningState_STATUS_Values = map[string]ProvisioningState_STATUS{
	"canceled":  ProvisioningState_STATUS_Canceled,
	"creating":  ProvisioningState_STATUS_Creating,
	"deleting":  ProvisioningState_STATUS_Deleting,
	"failed":    ProvisioningState_STATUS_Failed,
	"succeeded": ProvisioningState_STATUS_Succeeded,
	"updating":  ProvisioningState_STATUS_Updating,
}

// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure
type RedisEnterpriseOperatorSpec 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_RedisEnterpriseOperatorSpec populates our RedisEnterpriseOperatorSpec from the provided source RedisEnterpriseOperatorSpec
func (operator *RedisEnterpriseOperatorSpec) AssignProperties_From_RedisEnterpriseOperatorSpec(source *storage.RedisEnterpriseOperatorSpec) 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_RedisEnterpriseOperatorSpec populates the provided destination RedisEnterpriseOperatorSpec from our RedisEnterpriseOperatorSpec
func (operator *RedisEnterpriseOperatorSpec) AssignProperties_To_RedisEnterpriseOperatorSpec(destination *storage.RedisEnterpriseOperatorSpec) 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
}

// Current resource status
type ResourceState_STATUS string

const (
	ResourceState_STATUS_CreateFailed  = ResourceState_STATUS("CreateFailed")
	ResourceState_STATUS_Creating      = ResourceState_STATUS("Creating")
	ResourceState_STATUS_DeleteFailed  = ResourceState_STATUS("DeleteFailed")
	ResourceState_STATUS_Deleting      = ResourceState_STATUS("Deleting")
	ResourceState_STATUS_DisableFailed = ResourceState_STATUS("DisableFailed")
	ResourceState_STATUS_Disabled      = ResourceState_STATUS("Disabled")
	ResourceState_STATUS_Disabling     = ResourceState_STATUS("Disabling")
	ResourceState_STATUS_EnableFailed  = ResourceState_STATUS("EnableFailed")
	ResourceState_STATUS_Enabling      = ResourceState_STATUS("Enabling")
	ResourceState_STATUS_Running       = ResourceState_STATUS("Running")
	ResourceState_STATUS_UpdateFailed  = ResourceState_STATUS("UpdateFailed")
	ResourceState_STATUS_Updating      = ResourceState_STATUS("Updating")
)

// Mapping from string to ResourceState_STATUS
var resourceState_STATUS_Values = map[string]ResourceState_STATUS{
	"createfailed":  ResourceState_STATUS_CreateFailed,
	"creating":      ResourceState_STATUS_Creating,
	"deletefailed":  ResourceState_STATUS_DeleteFailed,
	"deleting":      ResourceState_STATUS_Deleting,
	"disablefailed": ResourceState_STATUS_DisableFailed,
	"disabled":      ResourceState_STATUS_Disabled,
	"disabling":     ResourceState_STATUS_Disabling,
	"enablefailed":  ResourceState_STATUS_EnableFailed,
	"enabling":      ResourceState_STATUS_Enabling,
	"running":       ResourceState_STATUS_Running,
	"updatefailed":  ResourceState_STATUS_UpdateFailed,
	"updating":      ResourceState_STATUS_Updating,
}

// SKU parameters supplied to the create RedisEnterprise operation.
type Sku struct {
	// Capacity: The size of the RedisEnterprise cluster. Defaults to 2 or 3 depending on SKU. Valid values are (2, 4, 6, ...)
	// for Enterprise SKUs and (3, 9, 15, ...) for Flash SKUs.
	Capacity *int `json:"capacity,omitempty"`

	// +kubebuilder:validation:Required
	// Name: The type of RedisEnterprise cluster to deploy. Possible values: (Enterprise_E10, EnterpriseFlash_F300 etc.)
	Name *Sku_Name `json:"name,omitempty"`
}

var _ genruntime.ARMTransformer = &Sku{}

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

	// Set property "Capacity":
	if sku.Capacity != nil {
		capacity := *sku.Capacity
		result.Capacity = &capacity
	}

	// Set property "Name":
	if sku.Name != nil {
		var temp string
		temp = string(*sku.Name)
		name := arm.Sku_Name(temp)
		result.Name = &name
	}
	return result, nil
}

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

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

	// Set property "Capacity":
	if typedInput.Capacity != nil {
		capacity := *typedInput.Capacity
		sku.Capacity = &capacity
	}

	// Set property "Name":
	if typedInput.Name != nil {
		var temp string
		temp = string(*typedInput.Name)
		name := Sku_Name(temp)
		sku.Name = &name
	}

	// No error
	return nil
}

// AssignProperties_From_Sku populates our Sku from the provided source Sku
func (sku *Sku) AssignProperties_From_Sku(source *storage.Sku) error {

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

	// Name
	if source.Name != nil {
		name := *source.Name
		nameTemp := genruntime.ToEnum(name, sku_Name_Values)
		sku.Name = &nameTemp
	} else {
		sku.Name = nil
	}

	// 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 {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

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

	// Name
	if sku.Name != nil {
		name := string(*sku.Name)
		destination.Name = &name
	} else {
		destination.Name = nil
	}

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

	// No error
	return nil
}

// SKU parameters supplied to the create RedisEnterprise operation.
type Sku_STATUS struct {
	// Capacity: The size of the RedisEnterprise cluster. Defaults to 2 or 3 depending on SKU. Valid values are (2, 4, 6, ...)
	// for Enterprise SKUs and (3, 9, 15, ...) for Flash SKUs.
	Capacity *int `json:"capacity,omitempty"`

	// Name: The type of RedisEnterprise cluster to deploy. Possible values: (Enterprise_E10, EnterpriseFlash_F300 etc.)
	Name *Sku_Name_STATUS `json:"name,omitempty"`
}

var _ genruntime.FromARMConverter = &Sku_STATUS{}

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

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

	// Set property "Capacity":
	if typedInput.Capacity != nil {
		capacity := *typedInput.Capacity
		sku.Capacity = &capacity
	}

	// Set property "Name":
	if typedInput.Name != nil {
		var temp string
		temp = string(*typedInput.Name)
		name := Sku_Name_STATUS(temp)
		sku.Name = &name
	}

	// No error
	return nil
}

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

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

	// Name
	if source.Name != nil {
		name := *source.Name
		nameTemp := genruntime.ToEnum(name, sku_Name_STATUS_Values)
		sku.Name = &nameTemp
	} else {
		sku.Name = nil
	}

	// 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 {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

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

	// Name
	if sku.Name != nil {
		name := string(*sku.Name)
		destination.Name = &name
	} else {
		destination.Name = nil
	}

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"EnterpriseFlash_F1500","EnterpriseFlash_F300","EnterpriseFlash_F700","Enterprise_E10","Enterprise_E100","Enterprise_E20","Enterprise_E50"}
type Sku_Name string

const (
	Sku_Name_EnterpriseFlash_F1500 = Sku_Name("EnterpriseFlash_F1500")
	Sku_Name_EnterpriseFlash_F300  = Sku_Name("EnterpriseFlash_F300")
	Sku_Name_EnterpriseFlash_F700  = Sku_Name("EnterpriseFlash_F700")
	Sku_Name_Enterprise_E10        = Sku_Name("Enterprise_E10")
	Sku_Name_Enterprise_E100       = Sku_Name("Enterprise_E100")
	Sku_Name_Enterprise_E20        = Sku_Name("Enterprise_E20")
	Sku_Name_Enterprise_E50        = Sku_Name("Enterprise_E50")
)

// Mapping from string to Sku_Name
var sku_Name_Values = map[string]Sku_Name{
	"enterpriseflash_f1500": Sku_Name_EnterpriseFlash_F1500,
	"enterpriseflash_f300":  Sku_Name_EnterpriseFlash_F300,
	"enterpriseflash_f700":  Sku_Name_EnterpriseFlash_F700,
	"enterprise_e10":        Sku_Name_Enterprise_E10,
	"enterprise_e100":       Sku_Name_Enterprise_E100,
	"enterprise_e20":        Sku_Name_Enterprise_E20,
	"enterprise_e50":        Sku_Name_Enterprise_E50,
}

type Sku_Name_STATUS string

const (
	Sku_Name_STATUS_EnterpriseFlash_F1500 = Sku_Name_STATUS("EnterpriseFlash_F1500")
	Sku_Name_STATUS_EnterpriseFlash_F300  = Sku_Name_STATUS("EnterpriseFlash_F300")
	Sku_Name_STATUS_EnterpriseFlash_F700  = Sku_Name_STATUS("EnterpriseFlash_F700")
	Sku_Name_STATUS_Enterprise_E10        = Sku_Name_STATUS("Enterprise_E10")
	Sku_Name_STATUS_Enterprise_E100       = Sku_Name_STATUS("Enterprise_E100")
	Sku_Name_STATUS_Enterprise_E20        = Sku_Name_STATUS("Enterprise_E20")
	Sku_Name_STATUS_Enterprise_E50        = Sku_Name_STATUS("Enterprise_E50")
)

// Mapping from string to Sku_Name_STATUS
var sku_Name_STATUS_Values = map[string]Sku_Name_STATUS{
	"enterpriseflash_f1500": Sku_Name_STATUS_EnterpriseFlash_F1500,
	"enterpriseflash_f300":  Sku_Name_STATUS_EnterpriseFlash_F300,
	"enterpriseflash_f700":  Sku_Name_STATUS_EnterpriseFlash_F700,
	"enterprise_e10":        Sku_Name_STATUS_Enterprise_E10,
	"enterprise_e100":       Sku_Name_STATUS_Enterprise_E100,
	"enterprise_e20":        Sku_Name_STATUS_Enterprise_E20,
	"enterprise_e50":        Sku_Name_STATUS_Enterprise_E50,
}

func init() {
	SchemeBuilder.Register(&RedisEnterprise{}, &RedisEnterpriseList{})
}
