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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/subscription/v1api20211001/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/subscription/v1api20211001/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,subscription}
// +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: /subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/subscriptions.json
// - ARM URI: /providers/Microsoft.Subscription/aliases/{aliasName}
type Alias struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              Alias_Spec   `json:"spec,omitempty"`
	Status            Alias_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &Alias{}

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

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

var _ conversion.Convertible = &Alias{}

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

	return alias.AssignProperties_From_Alias(source)
}

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

	return alias.AssignProperties_To_Alias(destination)
}

var _ configmaps.Exporter = &Alias{}

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

var _ secrets.Exporter = &Alias{}

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

var _ genruntime.ImportableResource = &Alias{}

// InitializeSpec initializes the spec for this resource from the given status
func (alias *Alias) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*Alias_STATUS); ok {
		return alias.Spec.Initialize_From_Alias_STATUS(s)
	}

	return fmt.Errorf("expected Status of type Alias_STATUS but received %T instead", status)
}

var _ genruntime.KubernetesResource = &Alias{}

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

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

// GetResourceScope returns the scope of the resource
func (alias *Alias) GetResourceScope() genruntime.ResourceScope {
	return genruntime.ResourceScopeTenant
}

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.Subscription/aliases"
func (alias *Alias) GetType() string {
	return "Microsoft.Subscription/aliases"
}

// NewEmptyStatus returns a new empty (blank) status
func (alias *Alias) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &Alias_STATUS{}
}

// Owner returns nil as Tenant scoped resources never have an owner
func (alias *Alias) Owner() *genruntime.ResourceReference {
	return nil
}

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

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

	alias.Status = st
	return nil
}

// AssignProperties_From_Alias populates our Alias from the provided source Alias
func (alias *Alias) AssignProperties_From_Alias(source *storage.Alias) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_Alias populates the provided destination Alias from our Alias
func (alias *Alias) AssignProperties_To_Alias(destination *storage.Alias) error {

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/subscriptions.json
// - ARM URI: /providers/Microsoft.Subscription/aliases/{aliasName}
type AliasList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Alias `json:"items"`
}

type Alias_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"`

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

	// Properties: Put alias request properties.
	Properties *PutAliasRequestProperties `json:"properties,omitempty"`
}

var _ genruntime.ARMTransformer = &Alias_Spec{}

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

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

	// Set property "Properties":
	if alias.Properties != nil {
		properties_ARM, err := alias.Properties.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		properties := *properties_ARM.(*arm.PutAliasRequestProperties)
		result.Properties = &properties
	}
	return result, nil
}

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

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

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

	// no assignment for property "OperatorSpec"

	// Set property "Properties":
	if typedInput.Properties != nil {
		var properties1 PutAliasRequestProperties
		err := properties1.PopulateFromARM(owner, *typedInput.Properties)
		if err != nil {
			return err
		}
		properties := properties1
		alias.Properties = &properties
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &Alias_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.Alias_Spec{}
	err := alias.AssignProperties_To_Alias_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_Alias_Spec populates our Alias_Spec from the provided source Alias_Spec
func (alias *Alias_Spec) AssignProperties_From_Alias_Spec(source *storage.Alias_Spec) error {

	// AzureName
	alias.AzureName = source.AzureName

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

	// Properties
	if source.Properties != nil {
		var property PutAliasRequestProperties
		err := property.AssignProperties_From_PutAliasRequestProperties(source.Properties)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_PutAliasRequestProperties() to populate field Properties")
		}
		alias.Properties = &property
	} else {
		alias.Properties = nil
	}

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = alias.AzureName

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

	// OriginalVersion
	destination.OriginalVersion = alias.OriginalVersion()

	// Properties
	if alias.Properties != nil {
		var property storage.PutAliasRequestProperties
		err := alias.Properties.AssignProperties_To_PutAliasRequestProperties(&property)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_PutAliasRequestProperties() to populate field Properties")
		}
		destination.Properties = &property
	} else {
		destination.Properties = nil
	}

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

	// No error
	return nil
}

// Initialize_From_Alias_STATUS populates our Alias_Spec from the provided source Alias_STATUS
func (alias *Alias_Spec) Initialize_From_Alias_STATUS(source *Alias_STATUS) error {

	// Properties
	if source.Properties != nil {
		var property PutAliasRequestProperties
		err := property.Initialize_From_SubscriptionAliasResponseProperties_STATUS(source.Properties)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_SubscriptionAliasResponseProperties_STATUS() to populate field Properties")
		}
		alias.Properties = &property
	} else {
		alias.Properties = nil
	}

	// No error
	return nil
}

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

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

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

	// Id: Fully qualified ID for the alias resource.
	Id *string `json:"id,omitempty"`

	// Name: Alias ID.
	Name *string `json:"name,omitempty"`

	// Properties: Subscription Alias response properties.
	Properties *SubscriptionAliasResponseProperties_STATUS `json:"properties,omitempty"`

	// SystemData: Metadata pertaining to creation and last modification of the resource.
	SystemData *SystemData_STATUS `json:"systemData,omitempty"`

	// Type: Resource type, Microsoft.Subscription/aliases.
	Type *string `json:"type,omitempty"`
}

var _ genruntime.ConvertibleStatus = &Alias_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.Alias_STATUS{}
	err := alias.AssignProperties_To_Alias_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 = &Alias_STATUS{}

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

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

	// no assignment for property "Conditions"

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

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

	// Set property "Properties":
	if typedInput.Properties != nil {
		var properties1 SubscriptionAliasResponseProperties_STATUS
		err := properties1.PopulateFromARM(owner, *typedInput.Properties)
		if err != nil {
			return err
		}
		properties := properties1
		alias.Properties = &properties
	}

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

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

	// No error
	return nil
}

// AssignProperties_From_Alias_STATUS populates our Alias_STATUS from the provided source Alias_STATUS
func (alias *Alias_STATUS) AssignProperties_From_Alias_STATUS(source *storage.Alias_STATUS) error {

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

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

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

	// Properties
	if source.Properties != nil {
		var property SubscriptionAliasResponseProperties_STATUS
		err := property.AssignProperties_From_SubscriptionAliasResponseProperties_STATUS(source.Properties)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubscriptionAliasResponseProperties_STATUS() to populate field Properties")
		}
		alias.Properties = &property
	} else {
		alias.Properties = 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")
		}
		alias.SystemData = &systemDatum
	} else {
		alias.SystemData = nil
	}

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

	// No error
	return nil
}

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

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

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

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

	// Properties
	if alias.Properties != nil {
		var property storage.SubscriptionAliasResponseProperties_STATUS
		err := alias.Properties.AssignProperties_To_SubscriptionAliasResponseProperties_STATUS(&property)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubscriptionAliasResponseProperties_STATUS() to populate field Properties")
		}
		destination.Properties = &property
	} else {
		destination.Properties = nil
	}

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

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

	// No error
	return nil
}

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

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

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

// Put subscription properties.
type PutAliasRequestProperties struct {
	// AdditionalProperties: Put alias request additional properties.
	AdditionalProperties *PutAliasRequestAdditionalProperties `json:"additionalProperties,omitempty"`
	BillingScope         *string                              `json:"billingScope,omitempty"`

	// DisplayName: The friendly name of the subscription.
	DisplayName *string `json:"displayName,omitempty"`

	// ResellerId: Reseller Id
	ResellerId *string `json:"resellerId,omitempty"`

	// SubscriptionId: This parameter can be used to create alias for existing subscription Id
	SubscriptionId *string `json:"subscriptionId,omitempty"`

	// Workload: The workload type of the subscription. It can be either Production or DevTest.
	Workload *Workload `json:"workload,omitempty"`
}

var _ genruntime.ARMTransformer = &PutAliasRequestProperties{}

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

	// Set property "AdditionalProperties":
	if properties.AdditionalProperties != nil {
		additionalProperties_ARM, err := properties.AdditionalProperties.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		additionalProperties := *additionalProperties_ARM.(*arm.PutAliasRequestAdditionalProperties)
		result.AdditionalProperties = &additionalProperties
	}

	// Set property "BillingScope":
	if properties.BillingScope != nil {
		billingScope := *properties.BillingScope
		result.BillingScope = &billingScope
	}

	// Set property "DisplayName":
	if properties.DisplayName != nil {
		displayName := *properties.DisplayName
		result.DisplayName = &displayName
	}

	// Set property "ResellerId":
	if properties.ResellerId != nil {
		resellerId := *properties.ResellerId
		result.ResellerId = &resellerId
	}

	// Set property "SubscriptionId":
	if properties.SubscriptionId != nil {
		subscriptionId := *properties.SubscriptionId
		result.SubscriptionId = &subscriptionId
	}

	// Set property "Workload":
	if properties.Workload != nil {
		var temp string
		temp = string(*properties.Workload)
		workload := arm.Workload(temp)
		result.Workload = &workload
	}
	return result, nil
}

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

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

	// Set property "AdditionalProperties":
	if typedInput.AdditionalProperties != nil {
		var additionalProperties1 PutAliasRequestAdditionalProperties
		err := additionalProperties1.PopulateFromARM(owner, *typedInput.AdditionalProperties)
		if err != nil {
			return err
		}
		additionalProperties := additionalProperties1
		properties.AdditionalProperties = &additionalProperties
	}

	// Set property "BillingScope":
	if typedInput.BillingScope != nil {
		billingScope := *typedInput.BillingScope
		properties.BillingScope = &billingScope
	}

	// Set property "DisplayName":
	if typedInput.DisplayName != nil {
		displayName := *typedInput.DisplayName
		properties.DisplayName = &displayName
	}

	// Set property "ResellerId":
	if typedInput.ResellerId != nil {
		resellerId := *typedInput.ResellerId
		properties.ResellerId = &resellerId
	}

	// Set property "SubscriptionId":
	if typedInput.SubscriptionId != nil {
		subscriptionId := *typedInput.SubscriptionId
		properties.SubscriptionId = &subscriptionId
	}

	// Set property "Workload":
	if typedInput.Workload != nil {
		var temp string
		temp = string(*typedInput.Workload)
		workload := Workload(temp)
		properties.Workload = &workload
	}

	// No error
	return nil
}

// AssignProperties_From_PutAliasRequestProperties populates our PutAliasRequestProperties from the provided source PutAliasRequestProperties
func (properties *PutAliasRequestProperties) AssignProperties_From_PutAliasRequestProperties(source *storage.PutAliasRequestProperties) error {

	// AdditionalProperties
	if source.AdditionalProperties != nil {
		var additionalProperty PutAliasRequestAdditionalProperties
		err := additionalProperty.AssignProperties_From_PutAliasRequestAdditionalProperties(source.AdditionalProperties)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_PutAliasRequestAdditionalProperties() to populate field AdditionalProperties")
		}
		properties.AdditionalProperties = &additionalProperty
	} else {
		properties.AdditionalProperties = nil
	}

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

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

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

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

	// Workload
	if source.Workload != nil {
		workload := *source.Workload
		workloadTemp := genruntime.ToEnum(workload, workload_Values)
		properties.Workload = &workloadTemp
	} else {
		properties.Workload = nil
	}

	// No error
	return nil
}

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

	// AdditionalProperties
	if properties.AdditionalProperties != nil {
		var additionalProperty storage.PutAliasRequestAdditionalProperties
		err := properties.AdditionalProperties.AssignProperties_To_PutAliasRequestAdditionalProperties(&additionalProperty)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_PutAliasRequestAdditionalProperties() to populate field AdditionalProperties")
		}
		destination.AdditionalProperties = &additionalProperty
	} else {
		destination.AdditionalProperties = nil
	}

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

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

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

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

	// Workload
	if properties.Workload != nil {
		workload := string(*properties.Workload)
		destination.Workload = &workload
	} else {
		destination.Workload = nil
	}

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

	// No error
	return nil
}

// Initialize_From_SubscriptionAliasResponseProperties_STATUS populates our PutAliasRequestProperties from the provided source SubscriptionAliasResponseProperties_STATUS
func (properties *PutAliasRequestProperties) Initialize_From_SubscriptionAliasResponseProperties_STATUS(source *SubscriptionAliasResponseProperties_STATUS) error {

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

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

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

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

	// Workload
	if source.Workload != nil {
		workload := genruntime.ToEnum(string(*source.Workload), workload_Values)
		properties.Workload = &workload
	} else {
		properties.Workload = nil
	}

	// No error
	return nil
}

// Put subscription creation result properties.
type SubscriptionAliasResponseProperties_STATUS struct {
	// AcceptOwnershipState: The accept ownership state of the resource.
	AcceptOwnershipState *AcceptOwnershipState_STATUS `json:"acceptOwnershipState,omitempty"`

	// AcceptOwnershipUrl: Url to accept ownership of the subscription.
	AcceptOwnershipUrl *string `json:"acceptOwnershipUrl,omitempty"`
	BillingScope       *string `json:"billingScope,omitempty"`

	// CreatedTime: Created Time
	CreatedTime *string `json:"createdTime,omitempty"`

	// DisplayName: The display name of the subscription.
	DisplayName *string `json:"displayName,omitempty"`

	// ManagementGroupId: The Management Group Id.
	ManagementGroupId *string `json:"managementGroupId,omitempty"`

	// ProvisioningState: The provisioning state of the resource.
	ProvisioningState *SubscriptionAliasResponseProperties_ProvisioningState_STATUS `json:"provisioningState,omitempty"`

	// ResellerId: Reseller Id
	ResellerId *string `json:"resellerId,omitempty"`

	// SubscriptionId: Newly created subscription Id.
	SubscriptionId *string `json:"subscriptionId,omitempty"`

	// SubscriptionOwnerId: Owner Id of the subscription
	SubscriptionOwnerId *string `json:"subscriptionOwnerId,omitempty"`

	// Tags: Tags for the subscription
	Tags map[string]string `json:"tags,omitempty"`

	// Workload: The workload type of the subscription. It can be either Production or DevTest.
	Workload *Workload_STATUS `json:"workload,omitempty"`
}

var _ genruntime.FromARMConverter = &SubscriptionAliasResponseProperties_STATUS{}

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

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

	// Set property "AcceptOwnershipState":
	if typedInput.AcceptOwnershipState != nil {
		var temp string
		temp = string(*typedInput.AcceptOwnershipState)
		acceptOwnershipState := AcceptOwnershipState_STATUS(temp)
		properties.AcceptOwnershipState = &acceptOwnershipState
	}

	// Set property "AcceptOwnershipUrl":
	if typedInput.AcceptOwnershipUrl != nil {
		acceptOwnershipUrl := *typedInput.AcceptOwnershipUrl
		properties.AcceptOwnershipUrl = &acceptOwnershipUrl
	}

	// Set property "BillingScope":
	if typedInput.BillingScope != nil {
		billingScope := *typedInput.BillingScope
		properties.BillingScope = &billingScope
	}

	// Set property "CreatedTime":
	if typedInput.CreatedTime != nil {
		createdTime := *typedInput.CreatedTime
		properties.CreatedTime = &createdTime
	}

	// Set property "DisplayName":
	if typedInput.DisplayName != nil {
		displayName := *typedInput.DisplayName
		properties.DisplayName = &displayName
	}

	// Set property "ManagementGroupId":
	if typedInput.ManagementGroupId != nil {
		managementGroupId := *typedInput.ManagementGroupId
		properties.ManagementGroupId = &managementGroupId
	}

	// Set property "ProvisioningState":
	if typedInput.ProvisioningState != nil {
		var temp string
		temp = string(*typedInput.ProvisioningState)
		provisioningState := SubscriptionAliasResponseProperties_ProvisioningState_STATUS(temp)
		properties.ProvisioningState = &provisioningState
	}

	// Set property "ResellerId":
	if typedInput.ResellerId != nil {
		resellerId := *typedInput.ResellerId
		properties.ResellerId = &resellerId
	}

	// Set property "SubscriptionId":
	if typedInput.SubscriptionId != nil {
		subscriptionId := *typedInput.SubscriptionId
		properties.SubscriptionId = &subscriptionId
	}

	// Set property "SubscriptionOwnerId":
	if typedInput.SubscriptionOwnerId != nil {
		subscriptionOwnerId := *typedInput.SubscriptionOwnerId
		properties.SubscriptionOwnerId = &subscriptionOwnerId
	}

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

	// Set property "Workload":
	if typedInput.Workload != nil {
		var temp string
		temp = string(*typedInput.Workload)
		workload := Workload_STATUS(temp)
		properties.Workload = &workload
	}

	// No error
	return nil
}

// AssignProperties_From_SubscriptionAliasResponseProperties_STATUS populates our SubscriptionAliasResponseProperties_STATUS from the provided source SubscriptionAliasResponseProperties_STATUS
func (properties *SubscriptionAliasResponseProperties_STATUS) AssignProperties_From_SubscriptionAliasResponseProperties_STATUS(source *storage.SubscriptionAliasResponseProperties_STATUS) error {

	// AcceptOwnershipState
	if source.AcceptOwnershipState != nil {
		acceptOwnershipState := *source.AcceptOwnershipState
		acceptOwnershipStateTemp := genruntime.ToEnum(acceptOwnershipState, acceptOwnershipState_STATUS_Values)
		properties.AcceptOwnershipState = &acceptOwnershipStateTemp
	} else {
		properties.AcceptOwnershipState = nil
	}

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

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

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

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

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

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

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

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

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

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

	// Workload
	if source.Workload != nil {
		workload := *source.Workload
		workloadTemp := genruntime.ToEnum(workload, workload_STATUS_Values)
		properties.Workload = &workloadTemp
	} else {
		properties.Workload = nil
	}

	// No error
	return nil
}

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

	// AcceptOwnershipState
	if properties.AcceptOwnershipState != nil {
		acceptOwnershipState := string(*properties.AcceptOwnershipState)
		destination.AcceptOwnershipState = &acceptOwnershipState
	} else {
		destination.AcceptOwnershipState = nil
	}

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

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

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

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

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

	// ProvisioningState
	if properties.ProvisioningState != nil {
		provisioningState := string(*properties.ProvisioningState)
		destination.ProvisioningState = &provisioningState
	} else {
		destination.ProvisioningState = nil
	}

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

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

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

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

	// Workload
	if properties.Workload != nil {
		workload := string(*properties.Workload)
		destination.Workload = &workload
	} else {
		destination.Workload = nil
	}

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

	// No error
	return nil
}

// Metadata pertaining to creation and last modification of the resource.
type SystemData_STATUS struct {
	// CreatedAt: The timestamp of resource creation (UTC).
	CreatedAt *string `json:"createdAt,omitempty"`

	// CreatedBy: The identity that created the resource.
	CreatedBy *string `json:"createdBy,omitempty"`

	// CreatedByType: The type of identity that created the resource.
	CreatedByType *SystemData_CreatedByType_STATUS `json:"createdByType,omitempty"`

	// LastModifiedAt: The timestamp of resource last modification (UTC)
	LastModifiedAt *string `json:"lastModifiedAt,omitempty"`

	// LastModifiedBy: The identity that last modified the resource.
	LastModifiedBy *string `json:"lastModifiedBy,omitempty"`

	// LastModifiedByType: The type of identity that last modified the resource.
	LastModifiedByType *SystemData_LastModifiedByType_STATUS `json:"lastModifiedByType,omitempty"`
}

var _ genruntime.FromARMConverter = &SystemData_STATUS{}

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

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

	// Set property "CreatedAt":
	if typedInput.CreatedAt != nil {
		createdAt := *typedInput.CreatedAt
		data.CreatedAt = &createdAt
	}

	// Set property "CreatedBy":
	if typedInput.CreatedBy != nil {
		createdBy := *typedInput.CreatedBy
		data.CreatedBy = &createdBy
	}

	// Set property "CreatedByType":
	if typedInput.CreatedByType != nil {
		var temp string
		temp = string(*typedInput.CreatedByType)
		createdByType := SystemData_CreatedByType_STATUS(temp)
		data.CreatedByType = &createdByType
	}

	// Set property "LastModifiedAt":
	if typedInput.LastModifiedAt != nil {
		lastModifiedAt := *typedInput.LastModifiedAt
		data.LastModifiedAt = &lastModifiedAt
	}

	// Set property "LastModifiedBy":
	if typedInput.LastModifiedBy != nil {
		lastModifiedBy := *typedInput.LastModifiedBy
		data.LastModifiedBy = &lastModifiedBy
	}

	// Set property "LastModifiedByType":
	if typedInput.LastModifiedByType != nil {
		var temp string
		temp = string(*typedInput.LastModifiedByType)
		lastModifiedByType := SystemData_LastModifiedByType_STATUS(temp)
		data.LastModifiedByType = &lastModifiedByType
	}

	// No error
	return nil
}

// AssignProperties_From_SystemData_STATUS populates our SystemData_STATUS from the provided source SystemData_STATUS
func (data *SystemData_STATUS) AssignProperties_From_SystemData_STATUS(source *storage.SystemData_STATUS) error {

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

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

	// CreatedByType
	if source.CreatedByType != nil {
		createdByType := *source.CreatedByType
		createdByTypeTemp := genruntime.ToEnum(createdByType, systemData_CreatedByType_STATUS_Values)
		data.CreatedByType = &createdByTypeTemp
	} else {
		data.CreatedByType = nil
	}

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

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

	// LastModifiedByType
	if source.LastModifiedByType != nil {
		lastModifiedByType := *source.LastModifiedByType
		lastModifiedByTypeTemp := genruntime.ToEnum(lastModifiedByType, systemData_LastModifiedByType_STATUS_Values)
		data.LastModifiedByType = &lastModifiedByTypeTemp
	} else {
		data.LastModifiedByType = nil
	}

	// No error
	return nil
}

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

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

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

	// CreatedByType
	if data.CreatedByType != nil {
		createdByType := string(*data.CreatedByType)
		destination.CreatedByType = &createdByType
	} else {
		destination.CreatedByType = nil
	}

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

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

	// LastModifiedByType
	if data.LastModifiedByType != nil {
		lastModifiedByType := string(*data.LastModifiedByType)
		destination.LastModifiedByType = &lastModifiedByType
	} else {
		destination.LastModifiedByType = nil
	}

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

	// No error
	return nil
}

// The accept ownership state of the resource.
type AcceptOwnershipState_STATUS string

const (
	AcceptOwnershipState_STATUS_Completed = AcceptOwnershipState_STATUS("Completed")
	AcceptOwnershipState_STATUS_Expired   = AcceptOwnershipState_STATUS("Expired")
	AcceptOwnershipState_STATUS_Pending   = AcceptOwnershipState_STATUS("Pending")
)

// Mapping from string to AcceptOwnershipState_STATUS
var acceptOwnershipState_STATUS_Values = map[string]AcceptOwnershipState_STATUS{
	"completed": AcceptOwnershipState_STATUS_Completed,
	"expired":   AcceptOwnershipState_STATUS_Expired,
	"pending":   AcceptOwnershipState_STATUS_Pending,
}

// Put subscription additional properties.
type PutAliasRequestAdditionalProperties struct {
	// ManagementGroupId: Management group Id for the subscription.
	ManagementGroupId *string `json:"managementGroupId,omitempty"`

	// SubscriptionOwnerId: Owner Id of the subscription
	SubscriptionOwnerId *string `json:"subscriptionOwnerId,omitempty"`

	// SubscriptionTenantId: Tenant Id of the subscription
	SubscriptionTenantId *string `json:"subscriptionTenantId,omitempty"`

	// Tags: Tags for the subscription
	Tags map[string]string `json:"tags,omitempty"`
}

var _ genruntime.ARMTransformer = &PutAliasRequestAdditionalProperties{}

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

	// Set property "ManagementGroupId":
	if properties.ManagementGroupId != nil {
		managementGroupId := *properties.ManagementGroupId
		result.ManagementGroupId = &managementGroupId
	}

	// Set property "SubscriptionOwnerId":
	if properties.SubscriptionOwnerId != nil {
		subscriptionOwnerId := *properties.SubscriptionOwnerId
		result.SubscriptionOwnerId = &subscriptionOwnerId
	}

	// Set property "SubscriptionTenantId":
	if properties.SubscriptionTenantId != nil {
		subscriptionTenantId := *properties.SubscriptionTenantId
		result.SubscriptionTenantId = &subscriptionTenantId
	}

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

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

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

	// Set property "ManagementGroupId":
	if typedInput.ManagementGroupId != nil {
		managementGroupId := *typedInput.ManagementGroupId
		properties.ManagementGroupId = &managementGroupId
	}

	// Set property "SubscriptionOwnerId":
	if typedInput.SubscriptionOwnerId != nil {
		subscriptionOwnerId := *typedInput.SubscriptionOwnerId
		properties.SubscriptionOwnerId = &subscriptionOwnerId
	}

	// Set property "SubscriptionTenantId":
	if typedInput.SubscriptionTenantId != nil {
		subscriptionTenantId := *typedInput.SubscriptionTenantId
		properties.SubscriptionTenantId = &subscriptionTenantId
	}

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

	// No error
	return nil
}

// AssignProperties_From_PutAliasRequestAdditionalProperties populates our PutAliasRequestAdditionalProperties from the provided source PutAliasRequestAdditionalProperties
func (properties *PutAliasRequestAdditionalProperties) AssignProperties_From_PutAliasRequestAdditionalProperties(source *storage.PutAliasRequestAdditionalProperties) error {

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

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

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

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

	// No error
	return nil
}

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

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

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

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

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

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

	// No error
	return nil
}

type SubscriptionAliasResponseProperties_ProvisioningState_STATUS string

const (
	SubscriptionAliasResponseProperties_ProvisioningState_STATUS_Accepted  = SubscriptionAliasResponseProperties_ProvisioningState_STATUS("Accepted")
	SubscriptionAliasResponseProperties_ProvisioningState_STATUS_Failed    = SubscriptionAliasResponseProperties_ProvisioningState_STATUS("Failed")
	SubscriptionAliasResponseProperties_ProvisioningState_STATUS_Succeeded = SubscriptionAliasResponseProperties_ProvisioningState_STATUS("Succeeded")
)

// Mapping from string to SubscriptionAliasResponseProperties_ProvisioningState_STATUS
var subscriptionAliasResponseProperties_ProvisioningState_STATUS_Values = map[string]SubscriptionAliasResponseProperties_ProvisioningState_STATUS{
	"accepted":  SubscriptionAliasResponseProperties_ProvisioningState_STATUS_Accepted,
	"failed":    SubscriptionAliasResponseProperties_ProvisioningState_STATUS_Failed,
	"succeeded": SubscriptionAliasResponseProperties_ProvisioningState_STATUS_Succeeded,
}

type SystemData_CreatedByType_STATUS string

const (
	SystemData_CreatedByType_STATUS_Application     = SystemData_CreatedByType_STATUS("Application")
	SystemData_CreatedByType_STATUS_Key             = SystemData_CreatedByType_STATUS("Key")
	SystemData_CreatedByType_STATUS_ManagedIdentity = SystemData_CreatedByType_STATUS("ManagedIdentity")
	SystemData_CreatedByType_STATUS_User            = SystemData_CreatedByType_STATUS("User")
)

// Mapping from string to SystemData_CreatedByType_STATUS
var systemData_CreatedByType_STATUS_Values = map[string]SystemData_CreatedByType_STATUS{
	"application":     SystemData_CreatedByType_STATUS_Application,
	"key":             SystemData_CreatedByType_STATUS_Key,
	"managedidentity": SystemData_CreatedByType_STATUS_ManagedIdentity,
	"user":            SystemData_CreatedByType_STATUS_User,
}

type SystemData_LastModifiedByType_STATUS string

const (
	SystemData_LastModifiedByType_STATUS_Application     = SystemData_LastModifiedByType_STATUS("Application")
	SystemData_LastModifiedByType_STATUS_Key             = SystemData_LastModifiedByType_STATUS("Key")
	SystemData_LastModifiedByType_STATUS_ManagedIdentity = SystemData_LastModifiedByType_STATUS("ManagedIdentity")
	SystemData_LastModifiedByType_STATUS_User            = SystemData_LastModifiedByType_STATUS("User")
)

// Mapping from string to SystemData_LastModifiedByType_STATUS
var systemData_LastModifiedByType_STATUS_Values = map[string]SystemData_LastModifiedByType_STATUS{
	"application":     SystemData_LastModifiedByType_STATUS_Application,
	"key":             SystemData_LastModifiedByType_STATUS_Key,
	"managedidentity": SystemData_LastModifiedByType_STATUS_ManagedIdentity,
	"user":            SystemData_LastModifiedByType_STATUS_User,
}

// The workload type of the subscription. It can be either Production or DevTest.
// +kubebuilder:validation:Enum={"DevTest","Production"}
type Workload string

const (
	Workload_DevTest    = Workload("DevTest")
	Workload_Production = Workload("Production")
)

// Mapping from string to Workload
var workload_Values = map[string]Workload{
	"devtest":    Workload_DevTest,
	"production": Workload_Production,
}

// The workload type of the subscription. It can be either Production or DevTest.
type Workload_STATUS string

const (
	Workload_STATUS_DevTest    = Workload_STATUS("DevTest")
	Workload_STATUS_Production = Workload_STATUS("Production")
)

// Mapping from string to Workload_STATUS
var workload_STATUS_Values = map[string]Workload_STATUS{
	"devtest":    Workload_STATUS_DevTest,
	"production": Workload_STATUS_Production,
}

func init() {
	SchemeBuilder.Register(&Alias{}, &AliasList{})
}
