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

import (
	"fmt"
	v20211001s "github.com/Azure/azure-service-operator/v2/api/subscription/v1api20211001storage"
	"github.com/Azure/azure-service-operator/v2/internal/reflecthelpers"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions"
	"github.com/pkg/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"sigs.k8s.io/controller-runtime/pkg/conversion"
	"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

// +kubebuilder:object:root=true
// +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.(*v20211001s.Alias)
	if !ok {
		return fmt.Errorf("expected subscription/v1api20211001storage/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.(*v20211001s.Alias)
	if !ok {
		return fmt.Errorf("expected subscription/v1api20211001storage/Alias but received %T instead", hub)
	}

	return alias.AssignProperties_To_Alias(destination)
}

// +kubebuilder:webhook:path=/mutate-subscription-azure-com-v1api20211001-alias,mutating=true,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=subscription.azure.com,resources=aliases,verbs=create;update,versions=v1api20211001,name=default.v1api20211001.aliases.subscription.azure.com,admissionReviewVersions=v1

var _ admission.Defaulter = &Alias{}

// Default applies defaults to the Alias resource
func (alias *Alias) Default() {
	alias.defaultImpl()
	var temp any = alias
	if runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {
		runtimeDefaulter.CustomDefault()
	}
}

// defaultAzureName defaults the Azure name of the resource to the Kubernetes name
func (alias *Alias) defaultAzureName() {
	if alias.Spec.AzureName == "" {
		alias.Spec.AzureName = alias.Name
	}
}

// defaultImpl applies the code generated defaults to the Alias resource
func (alias *Alias) defaultImpl() { alias.defaultAzureName() }

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 string(APIVersion_Value)
}

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

// 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 errors.Wrap(err, "failed to convert status")
	}

	alias.Status = st
	return nil
}

// +kubebuilder:webhook:path=/validate-subscription-azure-com-v1api20211001-alias,mutating=false,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=subscription.azure.com,resources=aliases,verbs=create;update,versions=v1api20211001,name=validate.v1api20211001.aliases.subscription.azure.com,admissionReviewVersions=v1

var _ admission.Validator = &Alias{}

// ValidateCreate validates the creation of the resource
func (alias *Alias) ValidateCreate() (admission.Warnings, error) {
	validations := alias.createValidations()
	var temp any = alias
	if runtimeValidator, ok := temp.(genruntime.Validator); ok {
		validations = append(validations, runtimeValidator.CreateValidations()...)
	}
	return genruntime.ValidateCreate(validations)
}

// ValidateDelete validates the deletion of the resource
func (alias *Alias) ValidateDelete() (admission.Warnings, error) {
	validations := alias.deleteValidations()
	var temp any = alias
	if runtimeValidator, ok := temp.(genruntime.Validator); ok {
		validations = append(validations, runtimeValidator.DeleteValidations()...)
	}
	return genruntime.ValidateDelete(validations)
}

// ValidateUpdate validates an update of the resource
func (alias *Alias) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
	validations := alias.updateValidations()
	var temp any = alias
	if runtimeValidator, ok := temp.(genruntime.Validator); ok {
		validations = append(validations, runtimeValidator.UpdateValidations()...)
	}
	return genruntime.ValidateUpdate(old, validations)
}

// createValidations validates the creation of the resource
func (alias *Alias) createValidations() []func() (admission.Warnings, error) {
	return []func() (admission.Warnings, error){alias.validateResourceReferences}
}

// deleteValidations validates the deletion of the resource
func (alias *Alias) deleteValidations() []func() (admission.Warnings, error) {
	return nil
}

// updateValidations validates the update of the resource
func (alias *Alias) updateValidations() []func(old runtime.Object) (admission.Warnings, error) {
	return []func(old runtime.Object) (admission.Warnings, error){
		func(old runtime.Object) (admission.Warnings, error) {
			return alias.validateResourceReferences()
		},
		alias.validateWriteOnceProperties}
}

// validateResourceReferences validates all resource references
func (alias *Alias) validateResourceReferences() (admission.Warnings, error) {
	refs, err := reflecthelpers.FindResourceReferences(&alias.Spec)
	if err != nil {
		return nil, err
	}
	return genruntime.ValidateResourceReferences(refs)
}

// validateWriteOnceProperties validates all WriteOnce properties
func (alias *Alias) validateWriteOnceProperties(old runtime.Object) (admission.Warnings, error) {
	oldObj, ok := old.(*Alias)
	if !ok {
		return nil, nil
	}

	return genruntime.ValidateWriteOnceProperties(oldObj, alias)
}

// AssignProperties_From_Alias populates our Alias from the provided source Alias
func (alias *Alias) AssignProperties_From_Alias(source *v20211001s.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 errors.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 errors.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 *v20211001s.Alias) error {

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

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

	// Status
	var status v20211001s.Alias_STATUS
	err = alias.Status.AssignProperties_To_Alias_STATUS(&status)
	if err != nil {
		return errors.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"`

	// 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 := &Alias_Spec_ARM{}

	// 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.(*PutAliasRequestProperties_ARM)
		result.Properties = &properties
	}
	return result, nil
}

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

// 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.(Alias_Spec_ARM)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected Alias_Spec_ARM, got %T", armInput)
	}

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

	// 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.(*v20211001s.Alias_Spec)
	if ok {
		// Populate our instance from source
		return alias.AssignProperties_From_Alias_Spec(src)
	}

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

	// Update our instance from src
	err = alias.AssignProperties_From_Alias_Spec(src)
	if err != nil {
		return errors.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.(*v20211001s.Alias_Spec)
	if ok {
		// Populate destination from our instance
		return alias.AssignProperties_To_Alias_Spec(dst)
	}

	// Convert to an intermediate form
	dst = &v20211001s.Alias_Spec{}
	err := alias.AssignProperties_To_Alias_Spec(dst)
	if err != nil {
		return errors.Wrap(err, "initial step of conversion in ConvertSpecTo()")
	}

	// Update dst from our instance
	err = dst.ConvertSpecTo(destination)
	if err != nil {
		return errors.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 *v20211001s.Alias_Spec) error {

	// AzureName
	alias.AzureName = source.AzureName

	// Properties
	if source.Properties != nil {
		var property PutAliasRequestProperties
		err := property.AssignProperties_From_PutAliasRequestProperties(source.Properties)
		if err != nil {
			return errors.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 *v20211001s.Alias_Spec) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// AzureName
	destination.AzureName = alias.AzureName

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

	// Properties
	if alias.Properties != nil {
		var property v20211001s.PutAliasRequestProperties
		err := alias.Properties.AssignProperties_To_PutAliasRequestProperties(&property)
		if err != nil {
			return errors.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 errors.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.(*v20211001s.Alias_STATUS)
	if ok {
		// Populate our instance from source
		return alias.AssignProperties_From_Alias_STATUS(src)
	}

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

	// Update our instance from src
	err = alias.AssignProperties_From_Alias_STATUS(src)
	if err != nil {
		return errors.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.(*v20211001s.Alias_STATUS)
	if ok {
		// Populate destination from our instance
		return alias.AssignProperties_To_Alias_STATUS(dst)
	}

	// Convert to an intermediate form
	dst = &v20211001s.Alias_STATUS{}
	err := alias.AssignProperties_To_Alias_STATUS(dst)
	if err != nil {
		return errors.Wrap(err, "initial step of conversion in ConvertStatusTo()")
	}

	// Update dst from our instance
	err = dst.ConvertStatusTo(destination)
	if err != nil {
		return errors.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 &Alias_STATUS_ARM{}
}

// 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.(Alias_STATUS_ARM)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected Alias_STATUS_ARM, 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 *v20211001s.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 errors.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 errors.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 *v20211001s.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 v20211001s.SubscriptionAliasResponseProperties_STATUS
		err := alias.Properties.AssignProperties_To_SubscriptionAliasResponseProperties_STATUS(&property)
		if err != nil {
			return errors.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 v20211001s.SystemData_STATUS
		err := alias.SystemData.AssignProperties_To_SystemData_STATUS(&systemDatum)
		if err != nil {
			return errors.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")

// 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 := &PutAliasRequestProperties_ARM{}

	// Set property "AdditionalProperties":
	if properties.AdditionalProperties != nil {
		additionalProperties_ARM, err := (*properties.AdditionalProperties).ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		additionalProperties := *additionalProperties_ARM.(*PutAliasRequestAdditionalProperties_ARM)
		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 {
		workload := *properties.Workload
		result.Workload = &workload
	}
	return result, nil
}

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

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (properties *PutAliasRequestProperties) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(PutAliasRequestProperties_ARM)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected PutAliasRequestProperties_ARM, 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 {
		workload := *typedInput.Workload
		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 *v20211001s.PutAliasRequestProperties) error {

	// AdditionalProperties
	if source.AdditionalProperties != nil {
		var additionalProperty PutAliasRequestAdditionalProperties
		err := additionalProperty.AssignProperties_From_PutAliasRequestAdditionalProperties(source.AdditionalProperties)
		if err != nil {
			return errors.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 := Workload(*source.Workload)
		properties.Workload = &workload
	} 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 *v20211001s.PutAliasRequestProperties) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// AdditionalProperties
	if properties.AdditionalProperties != nil {
		var additionalProperty v20211001s.PutAliasRequestAdditionalProperties
		err := properties.AdditionalProperties.AssignProperties_To_PutAliasRequestAdditionalProperties(&additionalProperty)
		if err != nil {
			return errors.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 := Workload(*source.Workload)
		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 &SubscriptionAliasResponseProperties_STATUS_ARM{}
}

// 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.(SubscriptionAliasResponseProperties_STATUS_ARM)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected SubscriptionAliasResponseProperties_STATUS_ARM, got %T", armInput)
	}

	// Set property "AcceptOwnershipState":
	if typedInput.AcceptOwnershipState != nil {
		acceptOwnershipState := *typedInput.AcceptOwnershipState
		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 {
		provisioningState := *typedInput.ProvisioningState
		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 {
		workload := *typedInput.Workload
		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 *v20211001s.SubscriptionAliasResponseProperties_STATUS) error {

	// AcceptOwnershipState
	if source.AcceptOwnershipState != nil {
		acceptOwnershipState := AcceptOwnershipState_STATUS(*source.AcceptOwnershipState)
		properties.AcceptOwnershipState = &acceptOwnershipState
	} 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 := SubscriptionAliasResponseProperties_ProvisioningState_STATUS(*source.ProvisioningState)
		properties.ProvisioningState = &provisioningState
	} 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 := Workload_STATUS(*source.Workload)
		properties.Workload = &workload
	} 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 *v20211001s.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 &SystemData_STATUS_ARM{}
}

// 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.(SystemData_STATUS_ARM)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected SystemData_STATUS_ARM, 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 {
		createdByType := *typedInput.CreatedByType
		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 {
		lastModifiedByType := *typedInput.LastModifiedByType
		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 *v20211001s.SystemData_STATUS) error {

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

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

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

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

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

	// LastModifiedByType
	if source.LastModifiedByType != nil {
		lastModifiedByType := SystemData_LastModifiedByType_STATUS(*source.LastModifiedByType)
		data.LastModifiedByType = &lastModifiedByType
	} 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 *v20211001s.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
}

// 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 := &PutAliasRequestAdditionalProperties_ARM{}

	// 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 &PutAliasRequestAdditionalProperties_ARM{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (properties *PutAliasRequestAdditionalProperties) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(PutAliasRequestAdditionalProperties_ARM)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected PutAliasRequestAdditionalProperties_ARM, 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 *v20211001s.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 *v20211001s.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
}

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