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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/cdn/v1api20230501/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/cdn/v1api20230501/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,cdn}
// +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: /cdn/resource-manager/Microsoft.Cdn/Cdn/stable/2023-05-01/afdx.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}
type AfdCustomDomain struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              AfdCustomDomain_Spec   `json:"spec,omitempty"`
	Status            AfdCustomDomain_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &AfdCustomDomain{}

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

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

var _ conversion.Convertible = &AfdCustomDomain{}

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

	return domain.AssignProperties_From_AfdCustomDomain(source)
}

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

	return domain.AssignProperties_To_AfdCustomDomain(destination)
}

var _ configmaps.Exporter = &AfdCustomDomain{}

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

var _ secrets.Exporter = &AfdCustomDomain{}

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

var _ genruntime.ImportableResource = &AfdCustomDomain{}

// InitializeSpec initializes the spec for this resource from the given status
func (domain *AfdCustomDomain) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*AfdCustomDomain_STATUS); ok {
		return domain.Spec.Initialize_From_AfdCustomDomain_STATUS(s)
	}

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

var _ genruntime.KubernetesResource = &AfdCustomDomain{}

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

// GetAPIVersion returns the ARM API version of the resource. This is always "2023-05-01"
func (domain AfdCustomDomain) GetAPIVersion() string {
	return "2023-05-01"
}

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.Cdn/profiles/customDomains"
func (domain *AfdCustomDomain) GetType() string {
	return "Microsoft.Cdn/profiles/customDomains"
}

// NewEmptyStatus returns a new empty (blank) status
func (domain *AfdCustomDomain) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &AfdCustomDomain_STATUS{}
}

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

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

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

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

	domain.Status = st
	return nil
}

// AssignProperties_From_AfdCustomDomain populates our AfdCustomDomain from the provided source AfdCustomDomain
func (domain *AfdCustomDomain) AssignProperties_From_AfdCustomDomain(source *storage.AfdCustomDomain) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_AfdCustomDomain populates the provided destination AfdCustomDomain from our AfdCustomDomain
func (domain *AfdCustomDomain) AssignProperties_To_AfdCustomDomain(destination *storage.AfdCustomDomain) error {

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /cdn/resource-manager/Microsoft.Cdn/Cdn/stable/2023-05-01/afdx.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}
type AfdCustomDomainList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []AfdCustomDomain `json:"items"`
}

type AfdCustomDomain_Spec struct {
	// AzureDnsZone: Resource reference to the Azure DNS zone
	AzureDnsZone *ResourceReference `json:"azureDnsZone,omitempty"`

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

	// ExtendedProperties: Key-Value pair representing migration properties for domains.
	ExtendedProperties map[string]string `json:"extendedProperties,omitempty"`

	// +kubebuilder:validation:Required
	// HostName: The host name of the domain. Must be a domain name.
	HostName *string `json:"hostName,omitempty"`

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

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

	// PreValidatedCustomDomainResourceId: Resource reference to the Azure resource where custom domain ownership was
	// prevalidated
	PreValidatedCustomDomainResourceId *ResourceReference `json:"preValidatedCustomDomainResourceId,omitempty"`

	// TlsSettings: The configuration specifying how to enable HTTPS for the domain - using AzureFrontDoor managed certificate
	// or user's own certificate. If not specified, enabling ssl uses AzureFrontDoor managed certificate by default.
	TlsSettings *AFDDomainHttpsParameters `json:"tlsSettings,omitempty"`
}

var _ genruntime.ARMTransformer = &AfdCustomDomain_Spec{}

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

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

	// Set property "Properties":
	if domain.AzureDnsZone != nil ||
		domain.ExtendedProperties != nil ||
		domain.HostName != nil ||
		domain.PreValidatedCustomDomainResourceId != nil ||
		domain.TlsSettings != nil {
		result.Properties = &arm.AFDDomainProperties{}
	}
	if domain.AzureDnsZone != nil {
		azureDnsZone_ARM, err := domain.AzureDnsZone.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		azureDnsZone := *azureDnsZone_ARM.(*arm.ResourceReference)
		result.Properties.AzureDnsZone = &azureDnsZone
	}
	if domain.ExtendedProperties != nil {
		result.Properties.ExtendedProperties = make(map[string]string, len(domain.ExtendedProperties))
		for key, value := range domain.ExtendedProperties {
			result.Properties.ExtendedProperties[key] = value
		}
	}
	if domain.HostName != nil {
		hostName := *domain.HostName
		result.Properties.HostName = &hostName
	}
	if domain.PreValidatedCustomDomainResourceId != nil {
		preValidatedCustomDomainResourceId_ARM, err := domain.PreValidatedCustomDomainResourceId.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		preValidatedCustomDomainResourceId := *preValidatedCustomDomainResourceId_ARM.(*arm.ResourceReference)
		result.Properties.PreValidatedCustomDomainResourceId = &preValidatedCustomDomainResourceId
	}
	if domain.TlsSettings != nil {
		tlsSettings_ARM, err := domain.TlsSettings.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		tlsSettings := *tlsSettings_ARM.(*arm.AFDDomainHttpsParameters)
		result.Properties.TlsSettings = &tlsSettings
	}
	return result, nil
}

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

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

	// Set property "AzureDnsZone":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AzureDnsZone != nil {
			var azureDnsZone1 ResourceReference
			err := azureDnsZone1.PopulateFromARM(owner, *typedInput.Properties.AzureDnsZone)
			if err != nil {
				return err
			}
			azureDnsZone := azureDnsZone1
			domain.AzureDnsZone = &azureDnsZone
		}
	}

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

	// Set property "ExtendedProperties":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ExtendedProperties != nil {
			domain.ExtendedProperties = make(map[string]string, len(typedInput.Properties.ExtendedProperties))
			for key, value := range typedInput.Properties.ExtendedProperties {
				domain.ExtendedProperties[key] = value
			}
		}
	}

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

	// no assignment for property "OperatorSpec"

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

	// Set property "PreValidatedCustomDomainResourceId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PreValidatedCustomDomainResourceId != nil {
			var preValidatedCustomDomainResourceId1 ResourceReference
			err := preValidatedCustomDomainResourceId1.PopulateFromARM(owner, *typedInput.Properties.PreValidatedCustomDomainResourceId)
			if err != nil {
				return err
			}
			preValidatedCustomDomainResourceId := preValidatedCustomDomainResourceId1
			domain.PreValidatedCustomDomainResourceId = &preValidatedCustomDomainResourceId
		}
	}

	// Set property "TlsSettings":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.TlsSettings != nil {
			var tlsSettings1 AFDDomainHttpsParameters
			err := tlsSettings1.PopulateFromARM(owner, *typedInput.Properties.TlsSettings)
			if err != nil {
				return err
			}
			tlsSettings := tlsSettings1
			domain.TlsSettings = &tlsSettings
		}
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &AfdCustomDomain_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.AfdCustomDomain_Spec{}
	err := domain.AssignProperties_To_AfdCustomDomain_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_AfdCustomDomain_Spec populates our AfdCustomDomain_Spec from the provided source AfdCustomDomain_Spec
func (domain *AfdCustomDomain_Spec) AssignProperties_From_AfdCustomDomain_Spec(source *storage.AfdCustomDomain_Spec) error {

	// AzureDnsZone
	if source.AzureDnsZone != nil {
		var azureDnsZone ResourceReference
		err := azureDnsZone.AssignProperties_From_ResourceReference(source.AzureDnsZone)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ResourceReference() to populate field AzureDnsZone")
		}
		domain.AzureDnsZone = &azureDnsZone
	} else {
		domain.AzureDnsZone = nil
	}

	// AzureName
	domain.AzureName = source.AzureName

	// ExtendedProperties
	domain.ExtendedProperties = genruntime.CloneMapOfStringToString(source.ExtendedProperties)

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

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

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

	// PreValidatedCustomDomainResourceId
	if source.PreValidatedCustomDomainResourceId != nil {
		var preValidatedCustomDomainResourceId ResourceReference
		err := preValidatedCustomDomainResourceId.AssignProperties_From_ResourceReference(source.PreValidatedCustomDomainResourceId)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ResourceReference() to populate field PreValidatedCustomDomainResourceId")
		}
		domain.PreValidatedCustomDomainResourceId = &preValidatedCustomDomainResourceId
	} else {
		domain.PreValidatedCustomDomainResourceId = nil
	}

	// TlsSettings
	if source.TlsSettings != nil {
		var tlsSetting AFDDomainHttpsParameters
		err := tlsSetting.AssignProperties_From_AFDDomainHttpsParameters(source.TlsSettings)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_AFDDomainHttpsParameters() to populate field TlsSettings")
		}
		domain.TlsSettings = &tlsSetting
	} else {
		domain.TlsSettings = nil
	}

	// No error
	return nil
}

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

	// AzureDnsZone
	if domain.AzureDnsZone != nil {
		var azureDnsZone storage.ResourceReference
		err := domain.AzureDnsZone.AssignProperties_To_ResourceReference(&azureDnsZone)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ResourceReference() to populate field AzureDnsZone")
		}
		destination.AzureDnsZone = &azureDnsZone
	} else {
		destination.AzureDnsZone = nil
	}

	// AzureName
	destination.AzureName = domain.AzureName

	// ExtendedProperties
	destination.ExtendedProperties = genruntime.CloneMapOfStringToString(domain.ExtendedProperties)

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

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

	// OriginalVersion
	destination.OriginalVersion = domain.OriginalVersion()

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

	// PreValidatedCustomDomainResourceId
	if domain.PreValidatedCustomDomainResourceId != nil {
		var preValidatedCustomDomainResourceId storage.ResourceReference
		err := domain.PreValidatedCustomDomainResourceId.AssignProperties_To_ResourceReference(&preValidatedCustomDomainResourceId)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ResourceReference() to populate field PreValidatedCustomDomainResourceId")
		}
		destination.PreValidatedCustomDomainResourceId = &preValidatedCustomDomainResourceId
	} else {
		destination.PreValidatedCustomDomainResourceId = nil
	}

	// TlsSettings
	if domain.TlsSettings != nil {
		var tlsSetting storage.AFDDomainHttpsParameters
		err := domain.TlsSettings.AssignProperties_To_AFDDomainHttpsParameters(&tlsSetting)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_AFDDomainHttpsParameters() to populate field TlsSettings")
		}
		destination.TlsSettings = &tlsSetting
	} else {
		destination.TlsSettings = nil
	}

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

	// No error
	return nil
}

// Initialize_From_AfdCustomDomain_STATUS populates our AfdCustomDomain_Spec from the provided source AfdCustomDomain_STATUS
func (domain *AfdCustomDomain_Spec) Initialize_From_AfdCustomDomain_STATUS(source *AfdCustomDomain_STATUS) error {

	// AzureDnsZone
	if source.AzureDnsZone != nil {
		var azureDnsZone ResourceReference
		err := azureDnsZone.Initialize_From_ResourceReference_STATUS(source.AzureDnsZone)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_ResourceReference_STATUS() to populate field AzureDnsZone")
		}
		domain.AzureDnsZone = &azureDnsZone
	} else {
		domain.AzureDnsZone = nil
	}

	// ExtendedProperties
	domain.ExtendedProperties = genruntime.CloneMapOfStringToString(source.ExtendedProperties)

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

	// PreValidatedCustomDomainResourceId
	if source.PreValidatedCustomDomainResourceId != nil {
		var preValidatedCustomDomainResourceId ResourceReference
		err := preValidatedCustomDomainResourceId.Initialize_From_ResourceReference_STATUS(source.PreValidatedCustomDomainResourceId)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_ResourceReference_STATUS() to populate field PreValidatedCustomDomainResourceId")
		}
		domain.PreValidatedCustomDomainResourceId = &preValidatedCustomDomainResourceId
	} else {
		domain.PreValidatedCustomDomainResourceId = nil
	}

	// TlsSettings
	if source.TlsSettings != nil {
		var tlsSetting AFDDomainHttpsParameters
		err := tlsSetting.Initialize_From_AFDDomainHttpsParameters_STATUS(source.TlsSettings)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_AFDDomainHttpsParameters_STATUS() to populate field TlsSettings")
		}
		domain.TlsSettings = &tlsSetting
	} else {
		domain.TlsSettings = nil
	}

	// No error
	return nil
}

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

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

type AfdCustomDomain_STATUS struct {
	// AzureDnsZone: Resource reference to the Azure DNS zone
	AzureDnsZone *ResourceReference_STATUS `json:"azureDnsZone,omitempty"`

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

	// DomainValidationState: Provisioning substate shows the progress of custom HTTPS enabling/disabling process step by step.
	// DCV stands for DomainControlValidation.
	DomainValidationState *AFDDomainProperties_DomainValidationState_STATUS `json:"domainValidationState,omitempty"`

	// ExtendedProperties: Key-Value pair representing migration properties for domains.
	ExtendedProperties map[string]string `json:"extendedProperties,omitempty"`

	// HostName: The host name of the domain. Must be a domain name.
	HostName *string `json:"hostName,omitempty"`

	// Id: Resource ID.
	Id *string `json:"id,omitempty"`

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

	// PreValidatedCustomDomainResourceId: Resource reference to the Azure resource where custom domain ownership was
	// prevalidated
	PreValidatedCustomDomainResourceId *ResourceReference_STATUS `json:"preValidatedCustomDomainResourceId,omitempty"`

	// ProfileName: The name of the profile which holds the domain.
	ProfileName *string `json:"profileName,omitempty"`

	// ProvisioningState: Provisioning status
	ProvisioningState *AFDDomainProperties_ProvisioningState_STATUS `json:"provisioningState,omitempty"`

	// SystemData: Read only system data
	SystemData *SystemData_STATUS `json:"systemData,omitempty"`

	// TlsSettings: The configuration specifying how to enable HTTPS for the domain - using AzureFrontDoor managed certificate
	// or user's own certificate. If not specified, enabling ssl uses AzureFrontDoor managed certificate by default.
	TlsSettings *AFDDomainHttpsParameters_STATUS `json:"tlsSettings,omitempty"`

	// Type: Resource type.
	Type *string `json:"type,omitempty"`

	// ValidationProperties: Values the customer needs to validate domain ownership
	ValidationProperties *DomainValidationProperties_STATUS `json:"validationProperties,omitempty"`
}

var _ genruntime.ConvertibleStatus = &AfdCustomDomain_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.AfdCustomDomain_STATUS{}
	err := domain.AssignProperties_To_AfdCustomDomain_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 = &AfdCustomDomain_STATUS{}

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

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

	// Set property "AzureDnsZone":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AzureDnsZone != nil {
			var azureDnsZone1 ResourceReference_STATUS
			err := azureDnsZone1.PopulateFromARM(owner, *typedInput.Properties.AzureDnsZone)
			if err != nil {
				return err
			}
			azureDnsZone := azureDnsZone1
			domain.AzureDnsZone = &azureDnsZone
		}
	}

	// no assignment for property "Conditions"

	// Set property "DeploymentStatus":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DeploymentStatus != nil {
			var temp string
			temp = string(*typedInput.Properties.DeploymentStatus)
			deploymentStatus := AFDDomainProperties_DeploymentStatus_STATUS(temp)
			domain.DeploymentStatus = &deploymentStatus
		}
	}

	// Set property "DomainValidationState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DomainValidationState != nil {
			var temp string
			temp = string(*typedInput.Properties.DomainValidationState)
			domainValidationState := AFDDomainProperties_DomainValidationState_STATUS(temp)
			domain.DomainValidationState = &domainValidationState
		}
	}

	// Set property "ExtendedProperties":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ExtendedProperties != nil {
			domain.ExtendedProperties = make(map[string]string, len(typedInput.Properties.ExtendedProperties))
			for key, value := range typedInput.Properties.ExtendedProperties {
				domain.ExtendedProperties[key] = value
			}
		}
	}

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

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

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

	// Set property "PreValidatedCustomDomainResourceId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PreValidatedCustomDomainResourceId != nil {
			var preValidatedCustomDomainResourceId1 ResourceReference_STATUS
			err := preValidatedCustomDomainResourceId1.PopulateFromARM(owner, *typedInput.Properties.PreValidatedCustomDomainResourceId)
			if err != nil {
				return err
			}
			preValidatedCustomDomainResourceId := preValidatedCustomDomainResourceId1
			domain.PreValidatedCustomDomainResourceId = &preValidatedCustomDomainResourceId
		}
	}

	// Set property "ProfileName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ProfileName != nil {
			profileName := *typedInput.Properties.ProfileName
			domain.ProfileName = &profileName
		}
	}

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

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

	// Set property "TlsSettings":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.TlsSettings != nil {
			var tlsSettings1 AFDDomainHttpsParameters_STATUS
			err := tlsSettings1.PopulateFromARM(owner, *typedInput.Properties.TlsSettings)
			if err != nil {
				return err
			}
			tlsSettings := tlsSettings1
			domain.TlsSettings = &tlsSettings
		}
	}

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

	// Set property "ValidationProperties":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ValidationProperties != nil {
			var validationProperties1 DomainValidationProperties_STATUS
			err := validationProperties1.PopulateFromARM(owner, *typedInput.Properties.ValidationProperties)
			if err != nil {
				return err
			}
			validationProperties := validationProperties1
			domain.ValidationProperties = &validationProperties
		}
	}

	// No error
	return nil
}

// AssignProperties_From_AfdCustomDomain_STATUS populates our AfdCustomDomain_STATUS from the provided source AfdCustomDomain_STATUS
func (domain *AfdCustomDomain_STATUS) AssignProperties_From_AfdCustomDomain_STATUS(source *storage.AfdCustomDomain_STATUS) error {

	// AzureDnsZone
	if source.AzureDnsZone != nil {
		var azureDnsZone ResourceReference_STATUS
		err := azureDnsZone.AssignProperties_From_ResourceReference_STATUS(source.AzureDnsZone)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ResourceReference_STATUS() to populate field AzureDnsZone")
		}
		domain.AzureDnsZone = &azureDnsZone
	} else {
		domain.AzureDnsZone = nil
	}

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

	// DeploymentStatus
	if source.DeploymentStatus != nil {
		deploymentStatus := *source.DeploymentStatus
		deploymentStatusTemp := genruntime.ToEnum(deploymentStatus, aFDDomainProperties_DeploymentStatus_STATUS_Values)
		domain.DeploymentStatus = &deploymentStatusTemp
	} else {
		domain.DeploymentStatus = nil
	}

	// DomainValidationState
	if source.DomainValidationState != nil {
		domainValidationState := *source.DomainValidationState
		domainValidationStateTemp := genruntime.ToEnum(domainValidationState, aFDDomainProperties_DomainValidationState_STATUS_Values)
		domain.DomainValidationState = &domainValidationStateTemp
	} else {
		domain.DomainValidationState = nil
	}

	// ExtendedProperties
	domain.ExtendedProperties = genruntime.CloneMapOfStringToString(source.ExtendedProperties)

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

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

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

	// PreValidatedCustomDomainResourceId
	if source.PreValidatedCustomDomainResourceId != nil {
		var preValidatedCustomDomainResourceId ResourceReference_STATUS
		err := preValidatedCustomDomainResourceId.AssignProperties_From_ResourceReference_STATUS(source.PreValidatedCustomDomainResourceId)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ResourceReference_STATUS() to populate field PreValidatedCustomDomainResourceId")
		}
		domain.PreValidatedCustomDomainResourceId = &preValidatedCustomDomainResourceId
	} else {
		domain.PreValidatedCustomDomainResourceId = nil
	}

	// ProfileName
	domain.ProfileName = genruntime.ClonePointerToString(source.ProfileName)

	// ProvisioningState
	if source.ProvisioningState != nil {
		provisioningState := *source.ProvisioningState
		provisioningStateTemp := genruntime.ToEnum(provisioningState, aFDDomainProperties_ProvisioningState_STATUS_Values)
		domain.ProvisioningState = &provisioningStateTemp
	} else {
		domain.ProvisioningState = 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")
		}
		domain.SystemData = &systemDatum
	} else {
		domain.SystemData = nil
	}

	// TlsSettings
	if source.TlsSettings != nil {
		var tlsSetting AFDDomainHttpsParameters_STATUS
		err := tlsSetting.AssignProperties_From_AFDDomainHttpsParameters_STATUS(source.TlsSettings)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_AFDDomainHttpsParameters_STATUS() to populate field TlsSettings")
		}
		domain.TlsSettings = &tlsSetting
	} else {
		domain.TlsSettings = nil
	}

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

	// ValidationProperties
	if source.ValidationProperties != nil {
		var validationProperty DomainValidationProperties_STATUS
		err := validationProperty.AssignProperties_From_DomainValidationProperties_STATUS(source.ValidationProperties)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_DomainValidationProperties_STATUS() to populate field ValidationProperties")
		}
		domain.ValidationProperties = &validationProperty
	} else {
		domain.ValidationProperties = nil
	}

	// No error
	return nil
}

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

	// AzureDnsZone
	if domain.AzureDnsZone != nil {
		var azureDnsZone storage.ResourceReference_STATUS
		err := domain.AzureDnsZone.AssignProperties_To_ResourceReference_STATUS(&azureDnsZone)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ResourceReference_STATUS() to populate field AzureDnsZone")
		}
		destination.AzureDnsZone = &azureDnsZone
	} else {
		destination.AzureDnsZone = nil
	}

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

	// DeploymentStatus
	if domain.DeploymentStatus != nil {
		deploymentStatus := string(*domain.DeploymentStatus)
		destination.DeploymentStatus = &deploymentStatus
	} else {
		destination.DeploymentStatus = nil
	}

	// DomainValidationState
	if domain.DomainValidationState != nil {
		domainValidationState := string(*domain.DomainValidationState)
		destination.DomainValidationState = &domainValidationState
	} else {
		destination.DomainValidationState = nil
	}

	// ExtendedProperties
	destination.ExtendedProperties = genruntime.CloneMapOfStringToString(domain.ExtendedProperties)

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

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

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

	// PreValidatedCustomDomainResourceId
	if domain.PreValidatedCustomDomainResourceId != nil {
		var preValidatedCustomDomainResourceId storage.ResourceReference_STATUS
		err := domain.PreValidatedCustomDomainResourceId.AssignProperties_To_ResourceReference_STATUS(&preValidatedCustomDomainResourceId)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ResourceReference_STATUS() to populate field PreValidatedCustomDomainResourceId")
		}
		destination.PreValidatedCustomDomainResourceId = &preValidatedCustomDomainResourceId
	} else {
		destination.PreValidatedCustomDomainResourceId = nil
	}

	// ProfileName
	destination.ProfileName = genruntime.ClonePointerToString(domain.ProfileName)

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

	// SystemData
	if domain.SystemData != nil {
		var systemDatum storage.SystemData_STATUS
		err := domain.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
	}

	// TlsSettings
	if domain.TlsSettings != nil {
		var tlsSetting storage.AFDDomainHttpsParameters_STATUS
		err := domain.TlsSettings.AssignProperties_To_AFDDomainHttpsParameters_STATUS(&tlsSetting)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_AFDDomainHttpsParameters_STATUS() to populate field TlsSettings")
		}
		destination.TlsSettings = &tlsSetting
	} else {
		destination.TlsSettings = nil
	}

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

	// ValidationProperties
	if domain.ValidationProperties != nil {
		var validationProperty storage.DomainValidationProperties_STATUS
		err := domain.ValidationProperties.AssignProperties_To_DomainValidationProperties_STATUS(&validationProperty)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_DomainValidationProperties_STATUS() to populate field ValidationProperties")
		}
		destination.ValidationProperties = &validationProperty
	} else {
		destination.ValidationProperties = nil
	}

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"2023-05-01"}
type APIVersion string

const APIVersion_Value = APIVersion("2023-05-01")

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

// The JSON object that contains the properties to secure a domain.
type AFDDomainHttpsParameters struct {
	// +kubebuilder:validation:Required
	// CertificateType: Defines the source of the SSL certificate.
	CertificateType *AFDDomainHttpsParameters_CertificateType `json:"certificateType,omitempty"`

	// MinimumTlsVersion: TLS protocol version that will be used for Https
	MinimumTlsVersion *AFDDomainHttpsParameters_MinimumTlsVersion `json:"minimumTlsVersion,omitempty"`

	// Secret: Resource reference to the secret. ie. subs/rg/profile/secret
	Secret *ResourceReference `json:"secret,omitempty"`
}

var _ genruntime.ARMTransformer = &AFDDomainHttpsParameters{}

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

	// Set property "CertificateType":
	if parameters.CertificateType != nil {
		var temp string
		temp = string(*parameters.CertificateType)
		certificateType := arm.AFDDomainHttpsParameters_CertificateType(temp)
		result.CertificateType = &certificateType
	}

	// Set property "MinimumTlsVersion":
	if parameters.MinimumTlsVersion != nil {
		var temp string
		temp = string(*parameters.MinimumTlsVersion)
		minimumTlsVersion := arm.AFDDomainHttpsParameters_MinimumTlsVersion(temp)
		result.MinimumTlsVersion = &minimumTlsVersion
	}

	// Set property "Secret":
	if parameters.Secret != nil {
		secret_ARM, err := parameters.Secret.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		secret := *secret_ARM.(*arm.ResourceReference)
		result.Secret = &secret
	}
	return result, nil
}

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

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

	// Set property "CertificateType":
	if typedInput.CertificateType != nil {
		var temp string
		temp = string(*typedInput.CertificateType)
		certificateType := AFDDomainHttpsParameters_CertificateType(temp)
		parameters.CertificateType = &certificateType
	}

	// Set property "MinimumTlsVersion":
	if typedInput.MinimumTlsVersion != nil {
		var temp string
		temp = string(*typedInput.MinimumTlsVersion)
		minimumTlsVersion := AFDDomainHttpsParameters_MinimumTlsVersion(temp)
		parameters.MinimumTlsVersion = &minimumTlsVersion
	}

	// Set property "Secret":
	if typedInput.Secret != nil {
		var secret1 ResourceReference
		err := secret1.PopulateFromARM(owner, *typedInput.Secret)
		if err != nil {
			return err
		}
		secret := secret1
		parameters.Secret = &secret
	}

	// No error
	return nil
}

// AssignProperties_From_AFDDomainHttpsParameters populates our AFDDomainHttpsParameters from the provided source AFDDomainHttpsParameters
func (parameters *AFDDomainHttpsParameters) AssignProperties_From_AFDDomainHttpsParameters(source *storage.AFDDomainHttpsParameters) error {

	// CertificateType
	if source.CertificateType != nil {
		certificateType := *source.CertificateType
		certificateTypeTemp := genruntime.ToEnum(certificateType, aFDDomainHttpsParameters_CertificateType_Values)
		parameters.CertificateType = &certificateTypeTemp
	} else {
		parameters.CertificateType = nil
	}

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

	// Secret
	if source.Secret != nil {
		var secret ResourceReference
		err := secret.AssignProperties_From_ResourceReference(source.Secret)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ResourceReference() to populate field Secret")
		}
		parameters.Secret = &secret
	} else {
		parameters.Secret = nil
	}

	// No error
	return nil
}

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

	// CertificateType
	if parameters.CertificateType != nil {
		certificateType := string(*parameters.CertificateType)
		destination.CertificateType = &certificateType
	} else {
		destination.CertificateType = nil
	}

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

	// Secret
	if parameters.Secret != nil {
		var secret storage.ResourceReference
		err := parameters.Secret.AssignProperties_To_ResourceReference(&secret)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ResourceReference() to populate field Secret")
		}
		destination.Secret = &secret
	} else {
		destination.Secret = nil
	}

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

	// No error
	return nil
}

// Initialize_From_AFDDomainHttpsParameters_STATUS populates our AFDDomainHttpsParameters from the provided source AFDDomainHttpsParameters_STATUS
func (parameters *AFDDomainHttpsParameters) Initialize_From_AFDDomainHttpsParameters_STATUS(source *AFDDomainHttpsParameters_STATUS) error {

	// CertificateType
	if source.CertificateType != nil {
		certificateType := genruntime.ToEnum(string(*source.CertificateType), aFDDomainHttpsParameters_CertificateType_Values)
		parameters.CertificateType = &certificateType
	} else {
		parameters.CertificateType = nil
	}

	// MinimumTlsVersion
	if source.MinimumTlsVersion != nil {
		minimumTlsVersion := genruntime.ToEnum(string(*source.MinimumTlsVersion), aFDDomainHttpsParameters_MinimumTlsVersion_Values)
		parameters.MinimumTlsVersion = &minimumTlsVersion
	} else {
		parameters.MinimumTlsVersion = nil
	}

	// Secret
	if source.Secret != nil {
		var secret ResourceReference
		err := secret.Initialize_From_ResourceReference_STATUS(source.Secret)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_ResourceReference_STATUS() to populate field Secret")
		}
		parameters.Secret = &secret
	} else {
		parameters.Secret = nil
	}

	// No error
	return nil
}

// The JSON object that contains the properties to secure a domain.
type AFDDomainHttpsParameters_STATUS struct {
	// CertificateType: Defines the source of the SSL certificate.
	CertificateType *AFDDomainHttpsParameters_CertificateType_STATUS `json:"certificateType,omitempty"`

	// MinimumTlsVersion: TLS protocol version that will be used for Https
	MinimumTlsVersion *AFDDomainHttpsParameters_MinimumTlsVersion_STATUS `json:"minimumTlsVersion,omitempty"`

	// Secret: Resource reference to the secret. ie. subs/rg/profile/secret
	Secret *ResourceReference_STATUS `json:"secret,omitempty"`
}

var _ genruntime.FromARMConverter = &AFDDomainHttpsParameters_STATUS{}

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

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

	// Set property "CertificateType":
	if typedInput.CertificateType != nil {
		var temp string
		temp = string(*typedInput.CertificateType)
		certificateType := AFDDomainHttpsParameters_CertificateType_STATUS(temp)
		parameters.CertificateType = &certificateType
	}

	// Set property "MinimumTlsVersion":
	if typedInput.MinimumTlsVersion != nil {
		var temp string
		temp = string(*typedInput.MinimumTlsVersion)
		minimumTlsVersion := AFDDomainHttpsParameters_MinimumTlsVersion_STATUS(temp)
		parameters.MinimumTlsVersion = &minimumTlsVersion
	}

	// Set property "Secret":
	if typedInput.Secret != nil {
		var secret1 ResourceReference_STATUS
		err := secret1.PopulateFromARM(owner, *typedInput.Secret)
		if err != nil {
			return err
		}
		secret := secret1
		parameters.Secret = &secret
	}

	// No error
	return nil
}

// AssignProperties_From_AFDDomainHttpsParameters_STATUS populates our AFDDomainHttpsParameters_STATUS from the provided source AFDDomainHttpsParameters_STATUS
func (parameters *AFDDomainHttpsParameters_STATUS) AssignProperties_From_AFDDomainHttpsParameters_STATUS(source *storage.AFDDomainHttpsParameters_STATUS) error {

	// CertificateType
	if source.CertificateType != nil {
		certificateType := *source.CertificateType
		certificateTypeTemp := genruntime.ToEnum(certificateType, aFDDomainHttpsParameters_CertificateType_STATUS_Values)
		parameters.CertificateType = &certificateTypeTemp
	} else {
		parameters.CertificateType = nil
	}

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

	// Secret
	if source.Secret != nil {
		var secret ResourceReference_STATUS
		err := secret.AssignProperties_From_ResourceReference_STATUS(source.Secret)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ResourceReference_STATUS() to populate field Secret")
		}
		parameters.Secret = &secret
	} else {
		parameters.Secret = nil
	}

	// No error
	return nil
}

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

	// CertificateType
	if parameters.CertificateType != nil {
		certificateType := string(*parameters.CertificateType)
		destination.CertificateType = &certificateType
	} else {
		destination.CertificateType = nil
	}

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

	// Secret
	if parameters.Secret != nil {
		var secret storage.ResourceReference_STATUS
		err := parameters.Secret.AssignProperties_To_ResourceReference_STATUS(&secret)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ResourceReference_STATUS() to populate field Secret")
		}
		destination.Secret = &secret
	} else {
		destination.Secret = nil
	}

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

	// No error
	return nil
}

type AFDDomainProperties_DeploymentStatus_STATUS string

const (
	AFDDomainProperties_DeploymentStatus_STATUS_Failed     = AFDDomainProperties_DeploymentStatus_STATUS("Failed")
	AFDDomainProperties_DeploymentStatus_STATUS_InProgress = AFDDomainProperties_DeploymentStatus_STATUS("InProgress")
	AFDDomainProperties_DeploymentStatus_STATUS_NotStarted = AFDDomainProperties_DeploymentStatus_STATUS("NotStarted")
	AFDDomainProperties_DeploymentStatus_STATUS_Succeeded  = AFDDomainProperties_DeploymentStatus_STATUS("Succeeded")
)

// Mapping from string to AFDDomainProperties_DeploymentStatus_STATUS
var aFDDomainProperties_DeploymentStatus_STATUS_Values = map[string]AFDDomainProperties_DeploymentStatus_STATUS{
	"failed":     AFDDomainProperties_DeploymentStatus_STATUS_Failed,
	"inprogress": AFDDomainProperties_DeploymentStatus_STATUS_InProgress,
	"notstarted": AFDDomainProperties_DeploymentStatus_STATUS_NotStarted,
	"succeeded":  AFDDomainProperties_DeploymentStatus_STATUS_Succeeded,
}

type AFDDomainProperties_DomainValidationState_STATUS string

const (
	AFDDomainProperties_DomainValidationState_STATUS_Approved                  = AFDDomainProperties_DomainValidationState_STATUS("Approved")
	AFDDomainProperties_DomainValidationState_STATUS_InternalError             = AFDDomainProperties_DomainValidationState_STATUS("InternalError")
	AFDDomainProperties_DomainValidationState_STATUS_Pending                   = AFDDomainProperties_DomainValidationState_STATUS("Pending")
	AFDDomainProperties_DomainValidationState_STATUS_PendingRevalidation       = AFDDomainProperties_DomainValidationState_STATUS("PendingRevalidation")
	AFDDomainProperties_DomainValidationState_STATUS_RefreshingValidationToken = AFDDomainProperties_DomainValidationState_STATUS("RefreshingValidationToken")
	AFDDomainProperties_DomainValidationState_STATUS_Rejected                  = AFDDomainProperties_DomainValidationState_STATUS("Rejected")
	AFDDomainProperties_DomainValidationState_STATUS_Submitting                = AFDDomainProperties_DomainValidationState_STATUS("Submitting")
	AFDDomainProperties_DomainValidationState_STATUS_TimedOut                  = AFDDomainProperties_DomainValidationState_STATUS("TimedOut")
	AFDDomainProperties_DomainValidationState_STATUS_Unknown                   = AFDDomainProperties_DomainValidationState_STATUS("Unknown")
)

// Mapping from string to AFDDomainProperties_DomainValidationState_STATUS
var aFDDomainProperties_DomainValidationState_STATUS_Values = map[string]AFDDomainProperties_DomainValidationState_STATUS{
	"approved":                  AFDDomainProperties_DomainValidationState_STATUS_Approved,
	"internalerror":             AFDDomainProperties_DomainValidationState_STATUS_InternalError,
	"pending":                   AFDDomainProperties_DomainValidationState_STATUS_Pending,
	"pendingrevalidation":       AFDDomainProperties_DomainValidationState_STATUS_PendingRevalidation,
	"refreshingvalidationtoken": AFDDomainProperties_DomainValidationState_STATUS_RefreshingValidationToken,
	"rejected":                  AFDDomainProperties_DomainValidationState_STATUS_Rejected,
	"submitting":                AFDDomainProperties_DomainValidationState_STATUS_Submitting,
	"timedout":                  AFDDomainProperties_DomainValidationState_STATUS_TimedOut,
	"unknown":                   AFDDomainProperties_DomainValidationState_STATUS_Unknown,
}

type AFDDomainProperties_ProvisioningState_STATUS string

const (
	AFDDomainProperties_ProvisioningState_STATUS_Creating  = AFDDomainProperties_ProvisioningState_STATUS("Creating")
	AFDDomainProperties_ProvisioningState_STATUS_Deleting  = AFDDomainProperties_ProvisioningState_STATUS("Deleting")
	AFDDomainProperties_ProvisioningState_STATUS_Failed    = AFDDomainProperties_ProvisioningState_STATUS("Failed")
	AFDDomainProperties_ProvisioningState_STATUS_Succeeded = AFDDomainProperties_ProvisioningState_STATUS("Succeeded")
	AFDDomainProperties_ProvisioningState_STATUS_Updating  = AFDDomainProperties_ProvisioningState_STATUS("Updating")
)

// Mapping from string to AFDDomainProperties_ProvisioningState_STATUS
var aFDDomainProperties_ProvisioningState_STATUS_Values = map[string]AFDDomainProperties_ProvisioningState_STATUS{
	"creating":  AFDDomainProperties_ProvisioningState_STATUS_Creating,
	"deleting":  AFDDomainProperties_ProvisioningState_STATUS_Deleting,
	"failed":    AFDDomainProperties_ProvisioningState_STATUS_Failed,
	"succeeded": AFDDomainProperties_ProvisioningState_STATUS_Succeeded,
	"updating":  AFDDomainProperties_ProvisioningState_STATUS_Updating,
}

// The JSON object that contains the properties to validate a domain.
type DomainValidationProperties_STATUS struct {
	// ExpirationDate: The date time that the token expires
	ExpirationDate *string `json:"expirationDate,omitempty"`

	// ValidationToken: Challenge used for DNS TXT record or file based validation
	ValidationToken *string `json:"validationToken,omitempty"`
}

var _ genruntime.FromARMConverter = &DomainValidationProperties_STATUS{}

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

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

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

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

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

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

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

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

	// No error
	return nil
}

// Reference to another resource.
type ResourceReference struct {
	// Reference: Resource ID.
	Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"`
}

var _ genruntime.ARMTransformer = &ResourceReference{}

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

	// Set property "Id":
	if reference.Reference != nil {
		referenceARMID, err := resolved.ResolvedReferences.Lookup(*reference.Reference)
		if err != nil {
			return nil, err
		}
		reference1 := referenceARMID
		result.Id = &reference1
	}
	return result, nil
}

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

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

	// no assignment for property "Reference"

	// No error
	return nil
}

// AssignProperties_From_ResourceReference populates our ResourceReference from the provided source ResourceReference
func (reference *ResourceReference) AssignProperties_From_ResourceReference(source *storage.ResourceReference) error {

	// Reference
	if source.Reference != nil {
		referenceTemp := source.Reference.Copy()
		reference.Reference = &referenceTemp
	} else {
		reference.Reference = nil
	}

	// No error
	return nil
}

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

	// Reference
	if reference.Reference != nil {
		referenceTemp := reference.Reference.Copy()
		destination.Reference = &referenceTemp
	} else {
		destination.Reference = nil
	}

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

	// No error
	return nil
}

// Initialize_From_ResourceReference_STATUS populates our ResourceReference from the provided source ResourceReference_STATUS
func (reference *ResourceReference) Initialize_From_ResourceReference_STATUS(source *ResourceReference_STATUS) error {

	// Reference
	if source.Id != nil {
		referenceTemp := genruntime.CreateResourceReferenceFromARMID(*source.Id)
		reference.Reference = &referenceTemp
	} else {
		reference.Reference = nil
	}

	// No error
	return nil
}

// Reference to another resource.
type ResourceReference_STATUS struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &ResourceReference_STATUS{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_ResourceReference_STATUS populates our ResourceReference_STATUS from the provided source ResourceReference_STATUS
func (reference *ResourceReference_STATUS) AssignProperties_From_ResourceReference_STATUS(source *storage.ResourceReference_STATUS) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// Read only system data
type SystemData_STATUS struct {
	// CreatedAt: The timestamp of resource creation (UTC)
	CreatedAt *string `json:"createdAt,omitempty"`

	// CreatedBy: An identifier for the identity that created the resource
	CreatedBy *string `json:"createdBy,omitempty"`

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

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

	// LastModifiedBy: An identifier for the identity that last modified the resource
	LastModifiedBy *string `json:"lastModifiedBy,omitempty"`

	// LastModifiedByType: The type of identity that last modified the resource
	LastModifiedByType *IdentityType_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 := IdentityType_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 := IdentityType_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, identityType_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, identityType_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
}

// +kubebuilder:validation:Enum={"AzureFirstPartyManagedCertificate","CustomerCertificate","ManagedCertificate"}
type AFDDomainHttpsParameters_CertificateType string

const (
	AFDDomainHttpsParameters_CertificateType_AzureFirstPartyManagedCertificate = AFDDomainHttpsParameters_CertificateType("AzureFirstPartyManagedCertificate")
	AFDDomainHttpsParameters_CertificateType_CustomerCertificate               = AFDDomainHttpsParameters_CertificateType("CustomerCertificate")
	AFDDomainHttpsParameters_CertificateType_ManagedCertificate                = AFDDomainHttpsParameters_CertificateType("ManagedCertificate")
)

// Mapping from string to AFDDomainHttpsParameters_CertificateType
var aFDDomainHttpsParameters_CertificateType_Values = map[string]AFDDomainHttpsParameters_CertificateType{
	"azurefirstpartymanagedcertificate": AFDDomainHttpsParameters_CertificateType_AzureFirstPartyManagedCertificate,
	"customercertificate":               AFDDomainHttpsParameters_CertificateType_CustomerCertificate,
	"managedcertificate":                AFDDomainHttpsParameters_CertificateType_ManagedCertificate,
}

type AFDDomainHttpsParameters_CertificateType_STATUS string

const (
	AFDDomainHttpsParameters_CertificateType_STATUS_AzureFirstPartyManagedCertificate = AFDDomainHttpsParameters_CertificateType_STATUS("AzureFirstPartyManagedCertificate")
	AFDDomainHttpsParameters_CertificateType_STATUS_CustomerCertificate               = AFDDomainHttpsParameters_CertificateType_STATUS("CustomerCertificate")
	AFDDomainHttpsParameters_CertificateType_STATUS_ManagedCertificate                = AFDDomainHttpsParameters_CertificateType_STATUS("ManagedCertificate")
)

// Mapping from string to AFDDomainHttpsParameters_CertificateType_STATUS
var aFDDomainHttpsParameters_CertificateType_STATUS_Values = map[string]AFDDomainHttpsParameters_CertificateType_STATUS{
	"azurefirstpartymanagedcertificate": AFDDomainHttpsParameters_CertificateType_STATUS_AzureFirstPartyManagedCertificate,
	"customercertificate":               AFDDomainHttpsParameters_CertificateType_STATUS_CustomerCertificate,
	"managedcertificate":                AFDDomainHttpsParameters_CertificateType_STATUS_ManagedCertificate,
}

// +kubebuilder:validation:Enum={"TLS10","TLS12"}
type AFDDomainHttpsParameters_MinimumTlsVersion string

const (
	AFDDomainHttpsParameters_MinimumTlsVersion_TLS10 = AFDDomainHttpsParameters_MinimumTlsVersion("TLS10")
	AFDDomainHttpsParameters_MinimumTlsVersion_TLS12 = AFDDomainHttpsParameters_MinimumTlsVersion("TLS12")
)

// Mapping from string to AFDDomainHttpsParameters_MinimumTlsVersion
var aFDDomainHttpsParameters_MinimumTlsVersion_Values = map[string]AFDDomainHttpsParameters_MinimumTlsVersion{
	"tls10": AFDDomainHttpsParameters_MinimumTlsVersion_TLS10,
	"tls12": AFDDomainHttpsParameters_MinimumTlsVersion_TLS12,
}

type AFDDomainHttpsParameters_MinimumTlsVersion_STATUS string

const (
	AFDDomainHttpsParameters_MinimumTlsVersion_STATUS_TLS10 = AFDDomainHttpsParameters_MinimumTlsVersion_STATUS("TLS10")
	AFDDomainHttpsParameters_MinimumTlsVersion_STATUS_TLS12 = AFDDomainHttpsParameters_MinimumTlsVersion_STATUS("TLS12")
)

// Mapping from string to AFDDomainHttpsParameters_MinimumTlsVersion_STATUS
var aFDDomainHttpsParameters_MinimumTlsVersion_STATUS_Values = map[string]AFDDomainHttpsParameters_MinimumTlsVersion_STATUS{
	"tls10": AFDDomainHttpsParameters_MinimumTlsVersion_STATUS_TLS10,
	"tls12": AFDDomainHttpsParameters_MinimumTlsVersion_STATUS_TLS12,
}

// The type of identity that creates/modifies resources
type IdentityType_STATUS string

const (
	IdentityType_STATUS_Application     = IdentityType_STATUS("application")
	IdentityType_STATUS_Key             = IdentityType_STATUS("key")
	IdentityType_STATUS_ManagedIdentity = IdentityType_STATUS("managedIdentity")
	IdentityType_STATUS_User            = IdentityType_STATUS("user")
)

// Mapping from string to IdentityType_STATUS
var identityType_STATUS_Values = map[string]IdentityType_STATUS{
	"application":     IdentityType_STATUS_Application,
	"key":             IdentityType_STATUS_Key,
	"managedidentity": IdentityType_STATUS_ManagedIdentity,
	"user":            IdentityType_STATUS_User,
}

func init() {
	SchemeBuilder.Register(&AfdCustomDomain{}, &AfdCustomDomainList{})
}
