// 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}/afdEndpoints/{endpointName}/routes/{routeName}
type Route struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              Route_Spec   `json:"spec,omitempty"`
	Status            Route_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &Route{}

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

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

var _ conversion.Convertible = &Route{}

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

	return route.AssignProperties_From_Route(source)
}

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

	return route.AssignProperties_To_Route(destination)
}

var _ configmaps.Exporter = &Route{}

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

var _ secrets.Exporter = &Route{}

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

var _ genruntime.ImportableResource = &Route{}

// InitializeSpec initializes the spec for this resource from the given status
func (route *Route) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*Route_STATUS); ok {
		return route.Spec.Initialize_From_Route_STATUS(s)
	}

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

var _ genruntime.KubernetesResource = &Route{}

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

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

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

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

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

// GetSupportedOperations returns the operations supported by the resource
func (route *Route) 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/afdEndpoints/routes"
func (route *Route) GetType() string {
	return "Microsoft.Cdn/profiles/afdEndpoints/routes"
}

// NewEmptyStatus returns a new empty (blank) status
func (route *Route) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &Route_STATUS{}
}

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

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

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

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

	route.Status = st
	return nil
}

// AssignProperties_From_Route populates our Route from the provided source Route
func (route *Route) AssignProperties_From_Route(source *storage.Route) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_Route populates the provided destination Route from our Route
func (route *Route) AssignProperties_To_Route(destination *storage.Route) error {

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

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

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

// +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}/afdEndpoints/{endpointName}/routes/{routeName}
type RouteList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Route `json:"items"`
}

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

	// CacheConfiguration: The caching configuration for this route. To disable caching, do not provide a cacheConfiguration
	// object.
	CacheConfiguration *AfdRouteCacheConfiguration `json:"cacheConfiguration,omitempty"`

	// CustomDomains: Domains referenced by this endpoint.
	CustomDomains []ActivatedResourceReference `json:"customDomains,omitempty"`

	// EnabledState: Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'
	EnabledState *RouteProperties_EnabledState `json:"enabledState,omitempty"`

	// ForwardingProtocol: Protocol this rule will use when forwarding traffic to backends.
	ForwardingProtocol *RouteProperties_ForwardingProtocol `json:"forwardingProtocol,omitempty"`

	// HttpsRedirect: Whether to automatically redirect HTTP traffic to HTTPS traffic. Note that this is a easy way to set up
	// this rule and it will be the first rule that gets executed.
	HttpsRedirect *RouteProperties_HttpsRedirect `json:"httpsRedirect,omitempty"`

	// LinkToDefaultDomain: whether this route will be linked to the default endpoint domain.
	LinkToDefaultDomain *RouteProperties_LinkToDefaultDomain `json:"linkToDefaultDomain,omitempty"`

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

	// OriginGroup: A reference to the origin group.
	OriginGroup *ResourceReference `json:"originGroup,omitempty"`

	// OriginPath: A directory path on the origin that AzureFrontDoor can use to retrieve content from, e.g.
	// contoso.cloudapp.net/originpath.
	OriginPath *string `json:"originPath,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/AfdEndpoint resource
	Owner *genruntime.KnownResourceReference `group:"cdn.azure.com" json:"owner,omitempty" kind:"AfdEndpoint"`

	// PatternsToMatch: The route patterns of the rule.
	PatternsToMatch []string `json:"patternsToMatch,omitempty"`

	// RuleSets: rule sets referenced by this endpoint.
	RuleSets []ResourceReference `json:"ruleSets,omitempty"`

	// SupportedProtocols: List of supported protocols for this route.
	SupportedProtocols []AFDEndpointProtocols `json:"supportedProtocols,omitempty"`
}

var _ genruntime.ARMTransformer = &Route_Spec{}

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

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

	// Set property "Properties":
	if route.CacheConfiguration != nil ||
		route.CustomDomains != nil ||
		route.EnabledState != nil ||
		route.ForwardingProtocol != nil ||
		route.HttpsRedirect != nil ||
		route.LinkToDefaultDomain != nil ||
		route.OriginGroup != nil ||
		route.OriginPath != nil ||
		route.PatternsToMatch != nil ||
		route.RuleSets != nil ||
		route.SupportedProtocols != nil {
		result.Properties = &arm.RouteProperties{}
	}
	if route.CacheConfiguration != nil {
		cacheConfiguration_ARM, err := route.CacheConfiguration.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		cacheConfiguration := *cacheConfiguration_ARM.(*arm.AfdRouteCacheConfiguration)
		result.Properties.CacheConfiguration = &cacheConfiguration
	}
	for _, item := range route.CustomDomains {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.CustomDomains = append(result.Properties.CustomDomains, *item_ARM.(*arm.ActivatedResourceReference))
	}
	if route.EnabledState != nil {
		var temp string
		temp = string(*route.EnabledState)
		enabledState := arm.RouteProperties_EnabledState(temp)
		result.Properties.EnabledState = &enabledState
	}
	if route.ForwardingProtocol != nil {
		var temp string
		temp = string(*route.ForwardingProtocol)
		forwardingProtocol := arm.RouteProperties_ForwardingProtocol(temp)
		result.Properties.ForwardingProtocol = &forwardingProtocol
	}
	if route.HttpsRedirect != nil {
		var temp string
		temp = string(*route.HttpsRedirect)
		httpsRedirect := arm.RouteProperties_HttpsRedirect(temp)
		result.Properties.HttpsRedirect = &httpsRedirect
	}
	if route.LinkToDefaultDomain != nil {
		var temp string
		temp = string(*route.LinkToDefaultDomain)
		linkToDefaultDomain := arm.RouteProperties_LinkToDefaultDomain(temp)
		result.Properties.LinkToDefaultDomain = &linkToDefaultDomain
	}
	if route.OriginGroup != nil {
		originGroup_ARM, err := route.OriginGroup.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		originGroup := *originGroup_ARM.(*arm.ResourceReference)
		result.Properties.OriginGroup = &originGroup
	}
	if route.OriginPath != nil {
		originPath := *route.OriginPath
		result.Properties.OriginPath = &originPath
	}
	for _, item := range route.PatternsToMatch {
		result.Properties.PatternsToMatch = append(result.Properties.PatternsToMatch, item)
	}
	for _, item := range route.RuleSets {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.RuleSets = append(result.Properties.RuleSets, *item_ARM.(*arm.ResourceReference))
	}
	for _, item := range route.SupportedProtocols {
		var temp string
		temp = string(item)
		result.Properties.SupportedProtocols = append(result.Properties.SupportedProtocols, arm.AFDEndpointProtocols(temp))
	}
	return result, nil
}

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

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

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

	// Set property "CacheConfiguration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CacheConfiguration != nil {
			var cacheConfiguration1 AfdRouteCacheConfiguration
			err := cacheConfiguration1.PopulateFromARM(owner, *typedInput.Properties.CacheConfiguration)
			if err != nil {
				return err
			}
			cacheConfiguration := cacheConfiguration1
			route.CacheConfiguration = &cacheConfiguration
		}
	}

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

	// Set property "EnabledState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnabledState != nil {
			var temp string
			temp = string(*typedInput.Properties.EnabledState)
			enabledState := RouteProperties_EnabledState(temp)
			route.EnabledState = &enabledState
		}
	}

	// Set property "ForwardingProtocol":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ForwardingProtocol != nil {
			var temp string
			temp = string(*typedInput.Properties.ForwardingProtocol)
			forwardingProtocol := RouteProperties_ForwardingProtocol(temp)
			route.ForwardingProtocol = &forwardingProtocol
		}
	}

	// Set property "HttpsRedirect":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.HttpsRedirect != nil {
			var temp string
			temp = string(*typedInput.Properties.HttpsRedirect)
			httpsRedirect := RouteProperties_HttpsRedirect(temp)
			route.HttpsRedirect = &httpsRedirect
		}
	}

	// Set property "LinkToDefaultDomain":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.LinkToDefaultDomain != nil {
			var temp string
			temp = string(*typedInput.Properties.LinkToDefaultDomain)
			linkToDefaultDomain := RouteProperties_LinkToDefaultDomain(temp)
			route.LinkToDefaultDomain = &linkToDefaultDomain
		}
	}

	// no assignment for property "OperatorSpec"

	// Set property "OriginGroup":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.OriginGroup != nil {
			var originGroup1 ResourceReference
			err := originGroup1.PopulateFromARM(owner, *typedInput.Properties.OriginGroup)
			if err != nil {
				return err
			}
			originGroup := originGroup1
			route.OriginGroup = &originGroup
		}
	}

	// Set property "OriginPath":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.OriginPath != nil {
			originPath := *typedInput.Properties.OriginPath
			route.OriginPath = &originPath
		}
	}

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

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

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

	// Set property "SupportedProtocols":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.SupportedProtocols {
			var temp string
			temp = string(item)
			route.SupportedProtocols = append(route.SupportedProtocols, AFDEndpointProtocols(temp))
		}
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &Route_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.Route_Spec{}
	err := route.AssignProperties_To_Route_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_Route_Spec populates our Route_Spec from the provided source Route_Spec
func (route *Route_Spec) AssignProperties_From_Route_Spec(source *storage.Route_Spec) error {

	// AzureName
	route.AzureName = source.AzureName

	// CacheConfiguration
	if source.CacheConfiguration != nil {
		var cacheConfiguration AfdRouteCacheConfiguration
		err := cacheConfiguration.AssignProperties_From_AfdRouteCacheConfiguration(source.CacheConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_AfdRouteCacheConfiguration() to populate field CacheConfiguration")
		}
		route.CacheConfiguration = &cacheConfiguration
	} else {
		route.CacheConfiguration = nil
	}

	// CustomDomains
	if source.CustomDomains != nil {
		customDomainList := make([]ActivatedResourceReference, len(source.CustomDomains))
		for customDomainIndex, customDomainItem := range source.CustomDomains {
			var customDomain ActivatedResourceReference
			err := customDomain.AssignProperties_From_ActivatedResourceReference(&customDomainItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_ActivatedResourceReference() to populate field CustomDomains")
			}
			customDomainList[customDomainIndex] = customDomain
		}
		route.CustomDomains = customDomainList
	} else {
		route.CustomDomains = nil
	}

	// EnabledState
	if source.EnabledState != nil {
		enabledState := *source.EnabledState
		enabledStateTemp := genruntime.ToEnum(enabledState, routeProperties_EnabledState_Values)
		route.EnabledState = &enabledStateTemp
	} else {
		route.EnabledState = nil
	}

	// ForwardingProtocol
	if source.ForwardingProtocol != nil {
		forwardingProtocol := *source.ForwardingProtocol
		forwardingProtocolTemp := genruntime.ToEnum(forwardingProtocol, routeProperties_ForwardingProtocol_Values)
		route.ForwardingProtocol = &forwardingProtocolTemp
	} else {
		route.ForwardingProtocol = nil
	}

	// HttpsRedirect
	if source.HttpsRedirect != nil {
		httpsRedirect := *source.HttpsRedirect
		httpsRedirectTemp := genruntime.ToEnum(httpsRedirect, routeProperties_HttpsRedirect_Values)
		route.HttpsRedirect = &httpsRedirectTemp
	} else {
		route.HttpsRedirect = nil
	}

	// LinkToDefaultDomain
	if source.LinkToDefaultDomain != nil {
		linkToDefaultDomain := *source.LinkToDefaultDomain
		linkToDefaultDomainTemp := genruntime.ToEnum(linkToDefaultDomain, routeProperties_LinkToDefaultDomain_Values)
		route.LinkToDefaultDomain = &linkToDefaultDomainTemp
	} else {
		route.LinkToDefaultDomain = nil
	}

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

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

	// OriginPath
	route.OriginPath = genruntime.ClonePointerToString(source.OriginPath)

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

	// PatternsToMatch
	route.PatternsToMatch = genruntime.CloneSliceOfString(source.PatternsToMatch)

	// RuleSets
	if source.RuleSets != nil {
		ruleSetList := make([]ResourceReference, len(source.RuleSets))
		for ruleSetIndex, ruleSetItem := range source.RuleSets {
			var ruleSet ResourceReference
			err := ruleSet.AssignProperties_From_ResourceReference(&ruleSetItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_ResourceReference() to populate field RuleSets")
			}
			ruleSetList[ruleSetIndex] = ruleSet
		}
		route.RuleSets = ruleSetList
	} else {
		route.RuleSets = nil
	}

	// SupportedProtocols
	if source.SupportedProtocols != nil {
		supportedProtocolList := make([]AFDEndpointProtocols, len(source.SupportedProtocols))
		for supportedProtocolIndex, supportedProtocolItem := range source.SupportedProtocols {
			supportedProtocolList[supportedProtocolIndex] = genruntime.ToEnum(supportedProtocolItem, aFDEndpointProtocols_Values)
		}
		route.SupportedProtocols = supportedProtocolList
	} else {
		route.SupportedProtocols = nil
	}

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = route.AzureName

	// CacheConfiguration
	if route.CacheConfiguration != nil {
		var cacheConfiguration storage.AfdRouteCacheConfiguration
		err := route.CacheConfiguration.AssignProperties_To_AfdRouteCacheConfiguration(&cacheConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_AfdRouteCacheConfiguration() to populate field CacheConfiguration")
		}
		destination.CacheConfiguration = &cacheConfiguration
	} else {
		destination.CacheConfiguration = nil
	}

	// CustomDomains
	if route.CustomDomains != nil {
		customDomainList := make([]storage.ActivatedResourceReference, len(route.CustomDomains))
		for customDomainIndex, customDomainItem := range route.CustomDomains {
			var customDomain storage.ActivatedResourceReference
			err := customDomainItem.AssignProperties_To_ActivatedResourceReference(&customDomain)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ActivatedResourceReference() to populate field CustomDomains")
			}
			customDomainList[customDomainIndex] = customDomain
		}
		destination.CustomDomains = customDomainList
	} else {
		destination.CustomDomains = nil
	}

	// EnabledState
	if route.EnabledState != nil {
		enabledState := string(*route.EnabledState)
		destination.EnabledState = &enabledState
	} else {
		destination.EnabledState = nil
	}

	// ForwardingProtocol
	if route.ForwardingProtocol != nil {
		forwardingProtocol := string(*route.ForwardingProtocol)
		destination.ForwardingProtocol = &forwardingProtocol
	} else {
		destination.ForwardingProtocol = nil
	}

	// HttpsRedirect
	if route.HttpsRedirect != nil {
		httpsRedirect := string(*route.HttpsRedirect)
		destination.HttpsRedirect = &httpsRedirect
	} else {
		destination.HttpsRedirect = nil
	}

	// LinkToDefaultDomain
	if route.LinkToDefaultDomain != nil {
		linkToDefaultDomain := string(*route.LinkToDefaultDomain)
		destination.LinkToDefaultDomain = &linkToDefaultDomain
	} else {
		destination.LinkToDefaultDomain = nil
	}

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

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

	// OriginPath
	destination.OriginPath = genruntime.ClonePointerToString(route.OriginPath)

	// OriginalVersion
	destination.OriginalVersion = route.OriginalVersion()

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

	// PatternsToMatch
	destination.PatternsToMatch = genruntime.CloneSliceOfString(route.PatternsToMatch)

	// RuleSets
	if route.RuleSets != nil {
		ruleSetList := make([]storage.ResourceReference, len(route.RuleSets))
		for ruleSetIndex, ruleSetItem := range route.RuleSets {
			var ruleSet storage.ResourceReference
			err := ruleSetItem.AssignProperties_To_ResourceReference(&ruleSet)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ResourceReference() to populate field RuleSets")
			}
			ruleSetList[ruleSetIndex] = ruleSet
		}
		destination.RuleSets = ruleSetList
	} else {
		destination.RuleSets = nil
	}

	// SupportedProtocols
	if route.SupportedProtocols != nil {
		supportedProtocolList := make([]string, len(route.SupportedProtocols))
		for supportedProtocolIndex, supportedProtocolItem := range route.SupportedProtocols {
			supportedProtocolList[supportedProtocolIndex] = string(supportedProtocolItem)
		}
		destination.SupportedProtocols = supportedProtocolList
	} else {
		destination.SupportedProtocols = nil
	}

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

	// No error
	return nil
}

// Initialize_From_Route_STATUS populates our Route_Spec from the provided source Route_STATUS
func (route *Route_Spec) Initialize_From_Route_STATUS(source *Route_STATUS) error {

	// CacheConfiguration
	if source.CacheConfiguration != nil {
		var cacheConfiguration AfdRouteCacheConfiguration
		err := cacheConfiguration.Initialize_From_AfdRouteCacheConfiguration_STATUS(source.CacheConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_AfdRouteCacheConfiguration_STATUS() to populate field CacheConfiguration")
		}
		route.CacheConfiguration = &cacheConfiguration
	} else {
		route.CacheConfiguration = nil
	}

	// CustomDomains
	if source.CustomDomains != nil {
		customDomainList := make([]ActivatedResourceReference, len(source.CustomDomains))
		for customDomainIndex, customDomainItem := range source.CustomDomains {
			var customDomain ActivatedResourceReference
			err := customDomain.Initialize_From_ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded(&customDomainItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded() to populate field CustomDomains")
			}
			customDomainList[customDomainIndex] = customDomain
		}
		route.CustomDomains = customDomainList
	} else {
		route.CustomDomains = nil
	}

	// EnabledState
	if source.EnabledState != nil {
		enabledState := genruntime.ToEnum(string(*source.EnabledState), routeProperties_EnabledState_Values)
		route.EnabledState = &enabledState
	} else {
		route.EnabledState = nil
	}

	// ForwardingProtocol
	if source.ForwardingProtocol != nil {
		forwardingProtocol := genruntime.ToEnum(string(*source.ForwardingProtocol), routeProperties_ForwardingProtocol_Values)
		route.ForwardingProtocol = &forwardingProtocol
	} else {
		route.ForwardingProtocol = nil
	}

	// HttpsRedirect
	if source.HttpsRedirect != nil {
		httpsRedirect := genruntime.ToEnum(string(*source.HttpsRedirect), routeProperties_HttpsRedirect_Values)
		route.HttpsRedirect = &httpsRedirect
	} else {
		route.HttpsRedirect = nil
	}

	// LinkToDefaultDomain
	if source.LinkToDefaultDomain != nil {
		linkToDefaultDomain := genruntime.ToEnum(string(*source.LinkToDefaultDomain), routeProperties_LinkToDefaultDomain_Values)
		route.LinkToDefaultDomain = &linkToDefaultDomain
	} else {
		route.LinkToDefaultDomain = nil
	}

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

	// OriginPath
	route.OriginPath = genruntime.ClonePointerToString(source.OriginPath)

	// PatternsToMatch
	route.PatternsToMatch = genruntime.CloneSliceOfString(source.PatternsToMatch)

	// RuleSets
	if source.RuleSets != nil {
		ruleSetList := make([]ResourceReference, len(source.RuleSets))
		for ruleSetIndex, ruleSetItem := range source.RuleSets {
			var ruleSet ResourceReference
			err := ruleSet.Initialize_From_ResourceReference_STATUS(&ruleSetItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_ResourceReference_STATUS() to populate field RuleSets")
			}
			ruleSetList[ruleSetIndex] = ruleSet
		}
		route.RuleSets = ruleSetList
	} else {
		route.RuleSets = nil
	}

	// SupportedProtocols
	if source.SupportedProtocols != nil {
		supportedProtocolList := make([]AFDEndpointProtocols, len(source.SupportedProtocols))
		for supportedProtocolIndex, supportedProtocolItem := range source.SupportedProtocols {
			supportedProtocol := genruntime.ToEnum(string(supportedProtocolItem), aFDEndpointProtocols_Values)
			supportedProtocolList[supportedProtocolIndex] = supportedProtocol
		}
		route.SupportedProtocols = supportedProtocolList
	} else {
		route.SupportedProtocols = nil
	}

	// No error
	return nil
}

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

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

type Route_STATUS struct {
	// CacheConfiguration: The caching configuration for this route. To disable caching, do not provide a cacheConfiguration
	// object.
	CacheConfiguration *AfdRouteCacheConfiguration_STATUS `json:"cacheConfiguration,omitempty"`

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

	// CustomDomains: Domains referenced by this endpoint.
	CustomDomains    []ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded `json:"customDomains,omitempty"`
	DeploymentStatus *RouteProperties_DeploymentStatus_STATUS                                            `json:"deploymentStatus,omitempty"`

	// EnabledState: Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'
	EnabledState *RouteProperties_EnabledState_STATUS `json:"enabledState,omitempty"`

	// EndpointName: The name of the endpoint which holds the route.
	EndpointName *string `json:"endpointName,omitempty"`

	// ForwardingProtocol: Protocol this rule will use when forwarding traffic to backends.
	ForwardingProtocol *RouteProperties_ForwardingProtocol_STATUS `json:"forwardingProtocol,omitempty"`

	// HttpsRedirect: Whether to automatically redirect HTTP traffic to HTTPS traffic. Note that this is a easy way to set up
	// this rule and it will be the first rule that gets executed.
	HttpsRedirect *RouteProperties_HttpsRedirect_STATUS `json:"httpsRedirect,omitempty"`

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

	// LinkToDefaultDomain: whether this route will be linked to the default endpoint domain.
	LinkToDefaultDomain *RouteProperties_LinkToDefaultDomain_STATUS `json:"linkToDefaultDomain,omitempty"`

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

	// OriginGroup: A reference to the origin group.
	OriginGroup *ResourceReference_STATUS `json:"originGroup,omitempty"`

	// OriginPath: A directory path on the origin that AzureFrontDoor can use to retrieve content from, e.g.
	// contoso.cloudapp.net/originpath.
	OriginPath *string `json:"originPath,omitempty"`

	// PatternsToMatch: The route patterns of the rule.
	PatternsToMatch []string `json:"patternsToMatch,omitempty"`

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

	// RuleSets: rule sets referenced by this endpoint.
	RuleSets []ResourceReference_STATUS `json:"ruleSets,omitempty"`

	// SupportedProtocols: List of supported protocols for this route.
	SupportedProtocols []AFDEndpointProtocols_STATUS `json:"supportedProtocols,omitempty"`

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

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

var _ genruntime.ConvertibleStatus = &Route_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.Route_STATUS{}
	err := route.AssignProperties_To_Route_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 = &Route_STATUS{}

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

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

	// Set property "CacheConfiguration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CacheConfiguration != nil {
			var cacheConfiguration1 AfdRouteCacheConfiguration_STATUS
			err := cacheConfiguration1.PopulateFromARM(owner, *typedInput.Properties.CacheConfiguration)
			if err != nil {
				return err
			}
			cacheConfiguration := cacheConfiguration1
			route.CacheConfiguration = &cacheConfiguration
		}
	}

	// no assignment for property "Conditions"

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

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

	// Set property "EnabledState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnabledState != nil {
			var temp string
			temp = string(*typedInput.Properties.EnabledState)
			enabledState := RouteProperties_EnabledState_STATUS(temp)
			route.EnabledState = &enabledState
		}
	}

	// Set property "EndpointName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EndpointName != nil {
			endpointName := *typedInput.Properties.EndpointName
			route.EndpointName = &endpointName
		}
	}

	// Set property "ForwardingProtocol":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ForwardingProtocol != nil {
			var temp string
			temp = string(*typedInput.Properties.ForwardingProtocol)
			forwardingProtocol := RouteProperties_ForwardingProtocol_STATUS(temp)
			route.ForwardingProtocol = &forwardingProtocol
		}
	}

	// Set property "HttpsRedirect":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.HttpsRedirect != nil {
			var temp string
			temp = string(*typedInput.Properties.HttpsRedirect)
			httpsRedirect := RouteProperties_HttpsRedirect_STATUS(temp)
			route.HttpsRedirect = &httpsRedirect
		}
	}

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

	// Set property "LinkToDefaultDomain":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.LinkToDefaultDomain != nil {
			var temp string
			temp = string(*typedInput.Properties.LinkToDefaultDomain)
			linkToDefaultDomain := RouteProperties_LinkToDefaultDomain_STATUS(temp)
			route.LinkToDefaultDomain = &linkToDefaultDomain
		}
	}

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

	// Set property "OriginGroup":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.OriginGroup != nil {
			var originGroup1 ResourceReference_STATUS
			err := originGroup1.PopulateFromARM(owner, *typedInput.Properties.OriginGroup)
			if err != nil {
				return err
			}
			originGroup := originGroup1
			route.OriginGroup = &originGroup
		}
	}

	// Set property "OriginPath":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.OriginPath != nil {
			originPath := *typedInput.Properties.OriginPath
			route.OriginPath = &originPath
		}
	}

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

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

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

	// Set property "SupportedProtocols":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.SupportedProtocols {
			var temp string
			temp = string(item)
			route.SupportedProtocols = append(route.SupportedProtocols, AFDEndpointProtocols_STATUS(temp))
		}
	}

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

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

	// No error
	return nil
}

// AssignProperties_From_Route_STATUS populates our Route_STATUS from the provided source Route_STATUS
func (route *Route_STATUS) AssignProperties_From_Route_STATUS(source *storage.Route_STATUS) error {

	// CacheConfiguration
	if source.CacheConfiguration != nil {
		var cacheConfiguration AfdRouteCacheConfiguration_STATUS
		err := cacheConfiguration.AssignProperties_From_AfdRouteCacheConfiguration_STATUS(source.CacheConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_AfdRouteCacheConfiguration_STATUS() to populate field CacheConfiguration")
		}
		route.CacheConfiguration = &cacheConfiguration
	} else {
		route.CacheConfiguration = nil
	}

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

	// CustomDomains
	if source.CustomDomains != nil {
		customDomainList := make([]ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded, len(source.CustomDomains))
		for customDomainIndex, customDomainItem := range source.CustomDomains {
			var customDomain ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded
			err := customDomain.AssignProperties_From_ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded(&customDomainItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded() to populate field CustomDomains")
			}
			customDomainList[customDomainIndex] = customDomain
		}
		route.CustomDomains = customDomainList
	} else {
		route.CustomDomains = nil
	}

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

	// EnabledState
	if source.EnabledState != nil {
		enabledState := *source.EnabledState
		enabledStateTemp := genruntime.ToEnum(enabledState, routeProperties_EnabledState_STATUS_Values)
		route.EnabledState = &enabledStateTemp
	} else {
		route.EnabledState = nil
	}

	// EndpointName
	route.EndpointName = genruntime.ClonePointerToString(source.EndpointName)

	// ForwardingProtocol
	if source.ForwardingProtocol != nil {
		forwardingProtocol := *source.ForwardingProtocol
		forwardingProtocolTemp := genruntime.ToEnum(forwardingProtocol, routeProperties_ForwardingProtocol_STATUS_Values)
		route.ForwardingProtocol = &forwardingProtocolTemp
	} else {
		route.ForwardingProtocol = nil
	}

	// HttpsRedirect
	if source.HttpsRedirect != nil {
		httpsRedirect := *source.HttpsRedirect
		httpsRedirectTemp := genruntime.ToEnum(httpsRedirect, routeProperties_HttpsRedirect_STATUS_Values)
		route.HttpsRedirect = &httpsRedirectTemp
	} else {
		route.HttpsRedirect = nil
	}

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

	// LinkToDefaultDomain
	if source.LinkToDefaultDomain != nil {
		linkToDefaultDomain := *source.LinkToDefaultDomain
		linkToDefaultDomainTemp := genruntime.ToEnum(linkToDefaultDomain, routeProperties_LinkToDefaultDomain_STATUS_Values)
		route.LinkToDefaultDomain = &linkToDefaultDomainTemp
	} else {
		route.LinkToDefaultDomain = nil
	}

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

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

	// OriginPath
	route.OriginPath = genruntime.ClonePointerToString(source.OriginPath)

	// PatternsToMatch
	route.PatternsToMatch = genruntime.CloneSliceOfString(source.PatternsToMatch)

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

	// RuleSets
	if source.RuleSets != nil {
		ruleSetList := make([]ResourceReference_STATUS, len(source.RuleSets))
		for ruleSetIndex, ruleSetItem := range source.RuleSets {
			var ruleSet ResourceReference_STATUS
			err := ruleSet.AssignProperties_From_ResourceReference_STATUS(&ruleSetItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_ResourceReference_STATUS() to populate field RuleSets")
			}
			ruleSetList[ruleSetIndex] = ruleSet
		}
		route.RuleSets = ruleSetList
	} else {
		route.RuleSets = nil
	}

	// SupportedProtocols
	if source.SupportedProtocols != nil {
		supportedProtocolList := make([]AFDEndpointProtocols_STATUS, len(source.SupportedProtocols))
		for supportedProtocolIndex, supportedProtocolItem := range source.SupportedProtocols {
			supportedProtocolList[supportedProtocolIndex] = genruntime.ToEnum(supportedProtocolItem, aFDEndpointProtocols_STATUS_Values)
		}
		route.SupportedProtocols = supportedProtocolList
	} else {
		route.SupportedProtocols = 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")
		}
		route.SystemData = &systemDatum
	} else {
		route.SystemData = nil
	}

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

	// No error
	return nil
}

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

	// CacheConfiguration
	if route.CacheConfiguration != nil {
		var cacheConfiguration storage.AfdRouteCacheConfiguration_STATUS
		err := route.CacheConfiguration.AssignProperties_To_AfdRouteCacheConfiguration_STATUS(&cacheConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_AfdRouteCacheConfiguration_STATUS() to populate field CacheConfiguration")
		}
		destination.CacheConfiguration = &cacheConfiguration
	} else {
		destination.CacheConfiguration = nil
	}

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

	// CustomDomains
	if route.CustomDomains != nil {
		customDomainList := make([]storage.ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded, len(route.CustomDomains))
		for customDomainIndex, customDomainItem := range route.CustomDomains {
			var customDomain storage.ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded
			err := customDomainItem.AssignProperties_To_ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded(&customDomain)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded() to populate field CustomDomains")
			}
			customDomainList[customDomainIndex] = customDomain
		}
		destination.CustomDomains = customDomainList
	} else {
		destination.CustomDomains = nil
	}

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

	// EnabledState
	if route.EnabledState != nil {
		enabledState := string(*route.EnabledState)
		destination.EnabledState = &enabledState
	} else {
		destination.EnabledState = nil
	}

	// EndpointName
	destination.EndpointName = genruntime.ClonePointerToString(route.EndpointName)

	// ForwardingProtocol
	if route.ForwardingProtocol != nil {
		forwardingProtocol := string(*route.ForwardingProtocol)
		destination.ForwardingProtocol = &forwardingProtocol
	} else {
		destination.ForwardingProtocol = nil
	}

	// HttpsRedirect
	if route.HttpsRedirect != nil {
		httpsRedirect := string(*route.HttpsRedirect)
		destination.HttpsRedirect = &httpsRedirect
	} else {
		destination.HttpsRedirect = nil
	}

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

	// LinkToDefaultDomain
	if route.LinkToDefaultDomain != nil {
		linkToDefaultDomain := string(*route.LinkToDefaultDomain)
		destination.LinkToDefaultDomain = &linkToDefaultDomain
	} else {
		destination.LinkToDefaultDomain = nil
	}

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

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

	// OriginPath
	destination.OriginPath = genruntime.ClonePointerToString(route.OriginPath)

	// PatternsToMatch
	destination.PatternsToMatch = genruntime.CloneSliceOfString(route.PatternsToMatch)

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

	// RuleSets
	if route.RuleSets != nil {
		ruleSetList := make([]storage.ResourceReference_STATUS, len(route.RuleSets))
		for ruleSetIndex, ruleSetItem := range route.RuleSets {
			var ruleSet storage.ResourceReference_STATUS
			err := ruleSetItem.AssignProperties_To_ResourceReference_STATUS(&ruleSet)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ResourceReference_STATUS() to populate field RuleSets")
			}
			ruleSetList[ruleSetIndex] = ruleSet
		}
		destination.RuleSets = ruleSetList
	} else {
		destination.RuleSets = nil
	}

	// SupportedProtocols
	if route.SupportedProtocols != nil {
		supportedProtocolList := make([]string, len(route.SupportedProtocols))
		for supportedProtocolIndex, supportedProtocolItem := range route.SupportedProtocols {
			supportedProtocolList[supportedProtocolIndex] = string(supportedProtocolItem)
		}
		destination.SupportedProtocols = supportedProtocolList
	} else {
		destination.SupportedProtocols = nil
	}

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

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

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

	// No error
	return nil
}

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

var _ genruntime.ARMTransformer = &ActivatedResourceReference{}

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

	// 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 *ActivatedResourceReference) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.ActivatedResourceReference{}
}

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

	// no assignment for property "Reference"

	// No error
	return nil
}

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

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

	// No error
	return nil
}

// AssignProperties_To_ActivatedResourceReference populates the provided destination ActivatedResourceReference from our ActivatedResourceReference
func (reference *ActivatedResourceReference) AssignProperties_To_ActivatedResourceReference(destination *storage.ActivatedResourceReference) 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_ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded populates our ActivatedResourceReference from the provided source ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded
func (reference *ActivatedResourceReference) Initialize_From_ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded(source *ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded) error {

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

	// No error
	return nil
}

// Initialize_From_ActivatedResourceReference_STATUS_Profiles_SecurityPolicy_SubResourceEmbedded populates our ActivatedResourceReference from the provided source ActivatedResourceReference_STATUS_Profiles_SecurityPolicy_SubResourceEmbedded
func (reference *ActivatedResourceReference) Initialize_From_ActivatedResourceReference_STATUS_Profiles_SecurityPolicy_SubResourceEmbedded(source *ActivatedResourceReference_STATUS_Profiles_SecurityPolicy_SubResourceEmbedded) 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 along with its state.
type ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded populates our ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded from the provided source ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded
func (embedded *ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded) AssignProperties_From_ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded(source *storage.ActivatedResourceReference_STATUS_Profiles_AfdEndpoints_Route_SubResourceEmbedded) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// Supported protocols for the customer's endpoint.
// +kubebuilder:validation:Enum={"Http","Https"}
type AFDEndpointProtocols string

const (
	AFDEndpointProtocols_Http  = AFDEndpointProtocols("Http")
	AFDEndpointProtocols_Https = AFDEndpointProtocols("Https")
)

// Mapping from string to AFDEndpointProtocols
var aFDEndpointProtocols_Values = map[string]AFDEndpointProtocols{
	"http":  AFDEndpointProtocols_Http,
	"https": AFDEndpointProtocols_Https,
}

// Supported protocols for the customer's endpoint.
type AFDEndpointProtocols_STATUS string

const (
	AFDEndpointProtocols_STATUS_Http  = AFDEndpointProtocols_STATUS("Http")
	AFDEndpointProtocols_STATUS_Https = AFDEndpointProtocols_STATUS("Https")
)

// Mapping from string to AFDEndpointProtocols_STATUS
var aFDEndpointProtocols_STATUS_Values = map[string]AFDEndpointProtocols_STATUS{
	"http":  AFDEndpointProtocols_STATUS_Http,
	"https": AFDEndpointProtocols_STATUS_Https,
}

// Caching settings for a caching-type route. To disable caching, do not provide a cacheConfiguration object.
type AfdRouteCacheConfiguration struct {
	// CompressionSettings: compression settings.
	CompressionSettings *CompressionSettings `json:"compressionSettings,omitempty"`

	// QueryParameters: query parameters to include or exclude (comma separated).
	QueryParameters *string `json:"queryParameters,omitempty"`

	// QueryStringCachingBehavior: Defines how Frontdoor caches requests that include query strings. You can ignore any query
	// strings when caching, ignore specific query strings, cache every request with a unique URL, or cache specific query
	// strings.
	QueryStringCachingBehavior *AfdRouteCacheConfiguration_QueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"`
}

var _ genruntime.ARMTransformer = &AfdRouteCacheConfiguration{}

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

	// Set property "CompressionSettings":
	if configuration.CompressionSettings != nil {
		compressionSettings_ARM, err := configuration.CompressionSettings.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		compressionSettings := *compressionSettings_ARM.(*arm.CompressionSettings)
		result.CompressionSettings = &compressionSettings
	}

	// Set property "QueryParameters":
	if configuration.QueryParameters != nil {
		queryParameters := *configuration.QueryParameters
		result.QueryParameters = &queryParameters
	}

	// Set property "QueryStringCachingBehavior":
	if configuration.QueryStringCachingBehavior != nil {
		var temp string
		temp = string(*configuration.QueryStringCachingBehavior)
		queryStringCachingBehavior := arm.AfdRouteCacheConfiguration_QueryStringCachingBehavior(temp)
		result.QueryStringCachingBehavior = &queryStringCachingBehavior
	}
	return result, nil
}

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

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

	// Set property "CompressionSettings":
	if typedInput.CompressionSettings != nil {
		var compressionSettings1 CompressionSettings
		err := compressionSettings1.PopulateFromARM(owner, *typedInput.CompressionSettings)
		if err != nil {
			return err
		}
		compressionSettings := compressionSettings1
		configuration.CompressionSettings = &compressionSettings
	}

	// Set property "QueryParameters":
	if typedInput.QueryParameters != nil {
		queryParameters := *typedInput.QueryParameters
		configuration.QueryParameters = &queryParameters
	}

	// Set property "QueryStringCachingBehavior":
	if typedInput.QueryStringCachingBehavior != nil {
		var temp string
		temp = string(*typedInput.QueryStringCachingBehavior)
		queryStringCachingBehavior := AfdRouteCacheConfiguration_QueryStringCachingBehavior(temp)
		configuration.QueryStringCachingBehavior = &queryStringCachingBehavior
	}

	// No error
	return nil
}

// AssignProperties_From_AfdRouteCacheConfiguration populates our AfdRouteCacheConfiguration from the provided source AfdRouteCacheConfiguration
func (configuration *AfdRouteCacheConfiguration) AssignProperties_From_AfdRouteCacheConfiguration(source *storage.AfdRouteCacheConfiguration) error {

	// CompressionSettings
	if source.CompressionSettings != nil {
		var compressionSetting CompressionSettings
		err := compressionSetting.AssignProperties_From_CompressionSettings(source.CompressionSettings)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_CompressionSettings() to populate field CompressionSettings")
		}
		configuration.CompressionSettings = &compressionSetting
	} else {
		configuration.CompressionSettings = nil
	}

	// QueryParameters
	configuration.QueryParameters = genruntime.ClonePointerToString(source.QueryParameters)

	// QueryStringCachingBehavior
	if source.QueryStringCachingBehavior != nil {
		queryStringCachingBehavior := *source.QueryStringCachingBehavior
		queryStringCachingBehaviorTemp := genruntime.ToEnum(queryStringCachingBehavior, afdRouteCacheConfiguration_QueryStringCachingBehavior_Values)
		configuration.QueryStringCachingBehavior = &queryStringCachingBehaviorTemp
	} else {
		configuration.QueryStringCachingBehavior = nil
	}

	// No error
	return nil
}

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

	// CompressionSettings
	if configuration.CompressionSettings != nil {
		var compressionSetting storage.CompressionSettings
		err := configuration.CompressionSettings.AssignProperties_To_CompressionSettings(&compressionSetting)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_CompressionSettings() to populate field CompressionSettings")
		}
		destination.CompressionSettings = &compressionSetting
	} else {
		destination.CompressionSettings = nil
	}

	// QueryParameters
	destination.QueryParameters = genruntime.ClonePointerToString(configuration.QueryParameters)

	// QueryStringCachingBehavior
	if configuration.QueryStringCachingBehavior != nil {
		queryStringCachingBehavior := string(*configuration.QueryStringCachingBehavior)
		destination.QueryStringCachingBehavior = &queryStringCachingBehavior
	} else {
		destination.QueryStringCachingBehavior = nil
	}

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

	// No error
	return nil
}

// Initialize_From_AfdRouteCacheConfiguration_STATUS populates our AfdRouteCacheConfiguration from the provided source AfdRouteCacheConfiguration_STATUS
func (configuration *AfdRouteCacheConfiguration) Initialize_From_AfdRouteCacheConfiguration_STATUS(source *AfdRouteCacheConfiguration_STATUS) error {

	// CompressionSettings
	if source.CompressionSettings != nil {
		var compressionSetting CompressionSettings
		err := compressionSetting.Initialize_From_CompressionSettings_STATUS(source.CompressionSettings)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_CompressionSettings_STATUS() to populate field CompressionSettings")
		}
		configuration.CompressionSettings = &compressionSetting
	} else {
		configuration.CompressionSettings = nil
	}

	// QueryParameters
	configuration.QueryParameters = genruntime.ClonePointerToString(source.QueryParameters)

	// QueryStringCachingBehavior
	if source.QueryStringCachingBehavior != nil {
		queryStringCachingBehavior := genruntime.ToEnum(string(*source.QueryStringCachingBehavior), afdRouteCacheConfiguration_QueryStringCachingBehavior_Values)
		configuration.QueryStringCachingBehavior = &queryStringCachingBehavior
	} else {
		configuration.QueryStringCachingBehavior = nil
	}

	// No error
	return nil
}

// Caching settings for a caching-type route. To disable caching, do not provide a cacheConfiguration object.
type AfdRouteCacheConfiguration_STATUS struct {
	// CompressionSettings: compression settings.
	CompressionSettings *CompressionSettings_STATUS `json:"compressionSettings,omitempty"`

	// QueryParameters: query parameters to include or exclude (comma separated).
	QueryParameters *string `json:"queryParameters,omitempty"`

	// QueryStringCachingBehavior: Defines how Frontdoor caches requests that include query strings. You can ignore any query
	// strings when caching, ignore specific query strings, cache every request with a unique URL, or cache specific query
	// strings.
	QueryStringCachingBehavior *AfdRouteCacheConfiguration_QueryStringCachingBehavior_STATUS `json:"queryStringCachingBehavior,omitempty"`
}

var _ genruntime.FromARMConverter = &AfdRouteCacheConfiguration_STATUS{}

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

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

	// Set property "CompressionSettings":
	if typedInput.CompressionSettings != nil {
		var compressionSettings1 CompressionSettings_STATUS
		err := compressionSettings1.PopulateFromARM(owner, *typedInput.CompressionSettings)
		if err != nil {
			return err
		}
		compressionSettings := compressionSettings1
		configuration.CompressionSettings = &compressionSettings
	}

	// Set property "QueryParameters":
	if typedInput.QueryParameters != nil {
		queryParameters := *typedInput.QueryParameters
		configuration.QueryParameters = &queryParameters
	}

	// Set property "QueryStringCachingBehavior":
	if typedInput.QueryStringCachingBehavior != nil {
		var temp string
		temp = string(*typedInput.QueryStringCachingBehavior)
		queryStringCachingBehavior := AfdRouteCacheConfiguration_QueryStringCachingBehavior_STATUS(temp)
		configuration.QueryStringCachingBehavior = &queryStringCachingBehavior
	}

	// No error
	return nil
}

// AssignProperties_From_AfdRouteCacheConfiguration_STATUS populates our AfdRouteCacheConfiguration_STATUS from the provided source AfdRouteCacheConfiguration_STATUS
func (configuration *AfdRouteCacheConfiguration_STATUS) AssignProperties_From_AfdRouteCacheConfiguration_STATUS(source *storage.AfdRouteCacheConfiguration_STATUS) error {

	// CompressionSettings
	if source.CompressionSettings != nil {
		var compressionSetting CompressionSettings_STATUS
		err := compressionSetting.AssignProperties_From_CompressionSettings_STATUS(source.CompressionSettings)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_CompressionSettings_STATUS() to populate field CompressionSettings")
		}
		configuration.CompressionSettings = &compressionSetting
	} else {
		configuration.CompressionSettings = nil
	}

	// QueryParameters
	configuration.QueryParameters = genruntime.ClonePointerToString(source.QueryParameters)

	// QueryStringCachingBehavior
	if source.QueryStringCachingBehavior != nil {
		queryStringCachingBehavior := *source.QueryStringCachingBehavior
		queryStringCachingBehaviorTemp := genruntime.ToEnum(queryStringCachingBehavior, afdRouteCacheConfiguration_QueryStringCachingBehavior_STATUS_Values)
		configuration.QueryStringCachingBehavior = &queryStringCachingBehaviorTemp
	} else {
		configuration.QueryStringCachingBehavior = nil
	}

	// No error
	return nil
}

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

	// CompressionSettings
	if configuration.CompressionSettings != nil {
		var compressionSetting storage.CompressionSettings_STATUS
		err := configuration.CompressionSettings.AssignProperties_To_CompressionSettings_STATUS(&compressionSetting)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_CompressionSettings_STATUS() to populate field CompressionSettings")
		}
		destination.CompressionSettings = &compressionSetting
	} else {
		destination.CompressionSettings = nil
	}

	// QueryParameters
	destination.QueryParameters = genruntime.ClonePointerToString(configuration.QueryParameters)

	// QueryStringCachingBehavior
	if configuration.QueryStringCachingBehavior != nil {
		queryStringCachingBehavior := string(*configuration.QueryStringCachingBehavior)
		destination.QueryStringCachingBehavior = &queryStringCachingBehavior
	} else {
		destination.QueryStringCachingBehavior = nil
	}

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

	// No error
	return nil
}

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

type RouteProperties_DeploymentStatus_STATUS string

const (
	RouteProperties_DeploymentStatus_STATUS_Failed     = RouteProperties_DeploymentStatus_STATUS("Failed")
	RouteProperties_DeploymentStatus_STATUS_InProgress = RouteProperties_DeploymentStatus_STATUS("InProgress")
	RouteProperties_DeploymentStatus_STATUS_NotStarted = RouteProperties_DeploymentStatus_STATUS("NotStarted")
	RouteProperties_DeploymentStatus_STATUS_Succeeded  = RouteProperties_DeploymentStatus_STATUS("Succeeded")
)

// Mapping from string to RouteProperties_DeploymentStatus_STATUS
var routeProperties_DeploymentStatus_STATUS_Values = map[string]RouteProperties_DeploymentStatus_STATUS{
	"failed":     RouteProperties_DeploymentStatus_STATUS_Failed,
	"inprogress": RouteProperties_DeploymentStatus_STATUS_InProgress,
	"notstarted": RouteProperties_DeploymentStatus_STATUS_NotStarted,
	"succeeded":  RouteProperties_DeploymentStatus_STATUS_Succeeded,
}

// +kubebuilder:validation:Enum={"Disabled","Enabled"}
type RouteProperties_EnabledState string

const (
	RouteProperties_EnabledState_Disabled = RouteProperties_EnabledState("Disabled")
	RouteProperties_EnabledState_Enabled  = RouteProperties_EnabledState("Enabled")
)

// Mapping from string to RouteProperties_EnabledState
var routeProperties_EnabledState_Values = map[string]RouteProperties_EnabledState{
	"disabled": RouteProperties_EnabledState_Disabled,
	"enabled":  RouteProperties_EnabledState_Enabled,
}

type RouteProperties_EnabledState_STATUS string

const (
	RouteProperties_EnabledState_STATUS_Disabled = RouteProperties_EnabledState_STATUS("Disabled")
	RouteProperties_EnabledState_STATUS_Enabled  = RouteProperties_EnabledState_STATUS("Enabled")
)

// Mapping from string to RouteProperties_EnabledState_STATUS
var routeProperties_EnabledState_STATUS_Values = map[string]RouteProperties_EnabledState_STATUS{
	"disabled": RouteProperties_EnabledState_STATUS_Disabled,
	"enabled":  RouteProperties_EnabledState_STATUS_Enabled,
}

// +kubebuilder:validation:Enum={"HttpOnly","HttpsOnly","MatchRequest"}
type RouteProperties_ForwardingProtocol string

const (
	RouteProperties_ForwardingProtocol_HttpOnly     = RouteProperties_ForwardingProtocol("HttpOnly")
	RouteProperties_ForwardingProtocol_HttpsOnly    = RouteProperties_ForwardingProtocol("HttpsOnly")
	RouteProperties_ForwardingProtocol_MatchRequest = RouteProperties_ForwardingProtocol("MatchRequest")
)

// Mapping from string to RouteProperties_ForwardingProtocol
var routeProperties_ForwardingProtocol_Values = map[string]RouteProperties_ForwardingProtocol{
	"httponly":     RouteProperties_ForwardingProtocol_HttpOnly,
	"httpsonly":    RouteProperties_ForwardingProtocol_HttpsOnly,
	"matchrequest": RouteProperties_ForwardingProtocol_MatchRequest,
}

type RouteProperties_ForwardingProtocol_STATUS string

const (
	RouteProperties_ForwardingProtocol_STATUS_HttpOnly     = RouteProperties_ForwardingProtocol_STATUS("HttpOnly")
	RouteProperties_ForwardingProtocol_STATUS_HttpsOnly    = RouteProperties_ForwardingProtocol_STATUS("HttpsOnly")
	RouteProperties_ForwardingProtocol_STATUS_MatchRequest = RouteProperties_ForwardingProtocol_STATUS("MatchRequest")
)

// Mapping from string to RouteProperties_ForwardingProtocol_STATUS
var routeProperties_ForwardingProtocol_STATUS_Values = map[string]RouteProperties_ForwardingProtocol_STATUS{
	"httponly":     RouteProperties_ForwardingProtocol_STATUS_HttpOnly,
	"httpsonly":    RouteProperties_ForwardingProtocol_STATUS_HttpsOnly,
	"matchrequest": RouteProperties_ForwardingProtocol_STATUS_MatchRequest,
}

// +kubebuilder:validation:Enum={"Disabled","Enabled"}
type RouteProperties_HttpsRedirect string

const (
	RouteProperties_HttpsRedirect_Disabled = RouteProperties_HttpsRedirect("Disabled")
	RouteProperties_HttpsRedirect_Enabled  = RouteProperties_HttpsRedirect("Enabled")
)

// Mapping from string to RouteProperties_HttpsRedirect
var routeProperties_HttpsRedirect_Values = map[string]RouteProperties_HttpsRedirect{
	"disabled": RouteProperties_HttpsRedirect_Disabled,
	"enabled":  RouteProperties_HttpsRedirect_Enabled,
}

type RouteProperties_HttpsRedirect_STATUS string

const (
	RouteProperties_HttpsRedirect_STATUS_Disabled = RouteProperties_HttpsRedirect_STATUS("Disabled")
	RouteProperties_HttpsRedirect_STATUS_Enabled  = RouteProperties_HttpsRedirect_STATUS("Enabled")
)

// Mapping from string to RouteProperties_HttpsRedirect_STATUS
var routeProperties_HttpsRedirect_STATUS_Values = map[string]RouteProperties_HttpsRedirect_STATUS{
	"disabled": RouteProperties_HttpsRedirect_STATUS_Disabled,
	"enabled":  RouteProperties_HttpsRedirect_STATUS_Enabled,
}

// +kubebuilder:validation:Enum={"Disabled","Enabled"}
type RouteProperties_LinkToDefaultDomain string

const (
	RouteProperties_LinkToDefaultDomain_Disabled = RouteProperties_LinkToDefaultDomain("Disabled")
	RouteProperties_LinkToDefaultDomain_Enabled  = RouteProperties_LinkToDefaultDomain("Enabled")
)

// Mapping from string to RouteProperties_LinkToDefaultDomain
var routeProperties_LinkToDefaultDomain_Values = map[string]RouteProperties_LinkToDefaultDomain{
	"disabled": RouteProperties_LinkToDefaultDomain_Disabled,
	"enabled":  RouteProperties_LinkToDefaultDomain_Enabled,
}

type RouteProperties_LinkToDefaultDomain_STATUS string

const (
	RouteProperties_LinkToDefaultDomain_STATUS_Disabled = RouteProperties_LinkToDefaultDomain_STATUS("Disabled")
	RouteProperties_LinkToDefaultDomain_STATUS_Enabled  = RouteProperties_LinkToDefaultDomain_STATUS("Enabled")
)

// Mapping from string to RouteProperties_LinkToDefaultDomain_STATUS
var routeProperties_LinkToDefaultDomain_STATUS_Values = map[string]RouteProperties_LinkToDefaultDomain_STATUS{
	"disabled": RouteProperties_LinkToDefaultDomain_STATUS_Disabled,
	"enabled":  RouteProperties_LinkToDefaultDomain_STATUS_Enabled,
}

type RouteProperties_ProvisioningState_STATUS string

const (
	RouteProperties_ProvisioningState_STATUS_Creating  = RouteProperties_ProvisioningState_STATUS("Creating")
	RouteProperties_ProvisioningState_STATUS_Deleting  = RouteProperties_ProvisioningState_STATUS("Deleting")
	RouteProperties_ProvisioningState_STATUS_Failed    = RouteProperties_ProvisioningState_STATUS("Failed")
	RouteProperties_ProvisioningState_STATUS_Succeeded = RouteProperties_ProvisioningState_STATUS("Succeeded")
	RouteProperties_ProvisioningState_STATUS_Updating  = RouteProperties_ProvisioningState_STATUS("Updating")
)

// Mapping from string to RouteProperties_ProvisioningState_STATUS
var routeProperties_ProvisioningState_STATUS_Values = map[string]RouteProperties_ProvisioningState_STATUS{
	"creating":  RouteProperties_ProvisioningState_STATUS_Creating,
	"deleting":  RouteProperties_ProvisioningState_STATUS_Deleting,
	"failed":    RouteProperties_ProvisioningState_STATUS_Failed,
	"succeeded": RouteProperties_ProvisioningState_STATUS_Succeeded,
	"updating":  RouteProperties_ProvisioningState_STATUS_Updating,
}

// Reference to another resource along with its state.
type ActivatedResourceReference_STATUS_Profiles_SecurityPolicy_SubResourceEmbedded struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &ActivatedResourceReference_STATUS_Profiles_SecurityPolicy_SubResourceEmbedded{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_ActivatedResourceReference_STATUS_Profiles_SecurityPolicy_SubResourceEmbedded populates our ActivatedResourceReference_STATUS_Profiles_SecurityPolicy_SubResourceEmbedded from the provided source ActivatedResourceReference_STATUS_Profiles_SecurityPolicy_SubResourceEmbedded
func (embedded *ActivatedResourceReference_STATUS_Profiles_SecurityPolicy_SubResourceEmbedded) AssignProperties_From_ActivatedResourceReference_STATUS_Profiles_SecurityPolicy_SubResourceEmbedded(source *storage.ActivatedResourceReference_STATUS_Profiles_SecurityPolicy_SubResourceEmbedded) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"IgnoreQueryString","IgnoreSpecifiedQueryStrings","IncludeSpecifiedQueryStrings","UseQueryString"}
type AfdRouteCacheConfiguration_QueryStringCachingBehavior string

const (
	AfdRouteCacheConfiguration_QueryStringCachingBehavior_IgnoreQueryString            = AfdRouteCacheConfiguration_QueryStringCachingBehavior("IgnoreQueryString")
	AfdRouteCacheConfiguration_QueryStringCachingBehavior_IgnoreSpecifiedQueryStrings  = AfdRouteCacheConfiguration_QueryStringCachingBehavior("IgnoreSpecifiedQueryStrings")
	AfdRouteCacheConfiguration_QueryStringCachingBehavior_IncludeSpecifiedQueryStrings = AfdRouteCacheConfiguration_QueryStringCachingBehavior("IncludeSpecifiedQueryStrings")
	AfdRouteCacheConfiguration_QueryStringCachingBehavior_UseQueryString               = AfdRouteCacheConfiguration_QueryStringCachingBehavior("UseQueryString")
)

// Mapping from string to AfdRouteCacheConfiguration_QueryStringCachingBehavior
var afdRouteCacheConfiguration_QueryStringCachingBehavior_Values = map[string]AfdRouteCacheConfiguration_QueryStringCachingBehavior{
	"ignorequerystring":            AfdRouteCacheConfiguration_QueryStringCachingBehavior_IgnoreQueryString,
	"ignorespecifiedquerystrings":  AfdRouteCacheConfiguration_QueryStringCachingBehavior_IgnoreSpecifiedQueryStrings,
	"includespecifiedquerystrings": AfdRouteCacheConfiguration_QueryStringCachingBehavior_IncludeSpecifiedQueryStrings,
	"usequerystring":               AfdRouteCacheConfiguration_QueryStringCachingBehavior_UseQueryString,
}

type AfdRouteCacheConfiguration_QueryStringCachingBehavior_STATUS string

const (
	AfdRouteCacheConfiguration_QueryStringCachingBehavior_STATUS_IgnoreQueryString            = AfdRouteCacheConfiguration_QueryStringCachingBehavior_STATUS("IgnoreQueryString")
	AfdRouteCacheConfiguration_QueryStringCachingBehavior_STATUS_IgnoreSpecifiedQueryStrings  = AfdRouteCacheConfiguration_QueryStringCachingBehavior_STATUS("IgnoreSpecifiedQueryStrings")
	AfdRouteCacheConfiguration_QueryStringCachingBehavior_STATUS_IncludeSpecifiedQueryStrings = AfdRouteCacheConfiguration_QueryStringCachingBehavior_STATUS("IncludeSpecifiedQueryStrings")
	AfdRouteCacheConfiguration_QueryStringCachingBehavior_STATUS_UseQueryString               = AfdRouteCacheConfiguration_QueryStringCachingBehavior_STATUS("UseQueryString")
)

// Mapping from string to AfdRouteCacheConfiguration_QueryStringCachingBehavior_STATUS
var afdRouteCacheConfiguration_QueryStringCachingBehavior_STATUS_Values = map[string]AfdRouteCacheConfiguration_QueryStringCachingBehavior_STATUS{
	"ignorequerystring":            AfdRouteCacheConfiguration_QueryStringCachingBehavior_STATUS_IgnoreQueryString,
	"ignorespecifiedquerystrings":  AfdRouteCacheConfiguration_QueryStringCachingBehavior_STATUS_IgnoreSpecifiedQueryStrings,
	"includespecifiedquerystrings": AfdRouteCacheConfiguration_QueryStringCachingBehavior_STATUS_IncludeSpecifiedQueryStrings,
	"usequerystring":               AfdRouteCacheConfiguration_QueryStringCachingBehavior_STATUS_UseQueryString,
}

// settings for compression.
type CompressionSettings struct {
	// ContentTypesToCompress: List of content types on which compression applies. The value should be a valid MIME type.
	ContentTypesToCompress []string `json:"contentTypesToCompress,omitempty"`

	// IsCompressionEnabled: Indicates whether content compression is enabled on AzureFrontDoor. Default value is false. If
	// compression is enabled, content will be served as compressed if user requests for a compressed version. Content won't be
	// compressed on AzureFrontDoor when requested content is smaller than 1 byte or larger than 1 MB.
	IsCompressionEnabled *bool `json:"isCompressionEnabled,omitempty"`
}

var _ genruntime.ARMTransformer = &CompressionSettings{}

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

	// Set property "ContentTypesToCompress":
	for _, item := range settings.ContentTypesToCompress {
		result.ContentTypesToCompress = append(result.ContentTypesToCompress, item)
	}

	// Set property "IsCompressionEnabled":
	if settings.IsCompressionEnabled != nil {
		isCompressionEnabled := *settings.IsCompressionEnabled
		result.IsCompressionEnabled = &isCompressionEnabled
	}
	return result, nil
}

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

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

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

	// Set property "IsCompressionEnabled":
	if typedInput.IsCompressionEnabled != nil {
		isCompressionEnabled := *typedInput.IsCompressionEnabled
		settings.IsCompressionEnabled = &isCompressionEnabled
	}

	// No error
	return nil
}

// AssignProperties_From_CompressionSettings populates our CompressionSettings from the provided source CompressionSettings
func (settings *CompressionSettings) AssignProperties_From_CompressionSettings(source *storage.CompressionSettings) error {

	// ContentTypesToCompress
	settings.ContentTypesToCompress = genruntime.CloneSliceOfString(source.ContentTypesToCompress)

	// IsCompressionEnabled
	if source.IsCompressionEnabled != nil {
		isCompressionEnabled := *source.IsCompressionEnabled
		settings.IsCompressionEnabled = &isCompressionEnabled
	} else {
		settings.IsCompressionEnabled = nil
	}

	// No error
	return nil
}

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

	// ContentTypesToCompress
	destination.ContentTypesToCompress = genruntime.CloneSliceOfString(settings.ContentTypesToCompress)

	// IsCompressionEnabled
	if settings.IsCompressionEnabled != nil {
		isCompressionEnabled := *settings.IsCompressionEnabled
		destination.IsCompressionEnabled = &isCompressionEnabled
	} else {
		destination.IsCompressionEnabled = nil
	}

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

	// No error
	return nil
}

// Initialize_From_CompressionSettings_STATUS populates our CompressionSettings from the provided source CompressionSettings_STATUS
func (settings *CompressionSettings) Initialize_From_CompressionSettings_STATUS(source *CompressionSettings_STATUS) error {

	// ContentTypesToCompress
	settings.ContentTypesToCompress = genruntime.CloneSliceOfString(source.ContentTypesToCompress)

	// IsCompressionEnabled
	if source.IsCompressionEnabled != nil {
		isCompressionEnabled := *source.IsCompressionEnabled
		settings.IsCompressionEnabled = &isCompressionEnabled
	} else {
		settings.IsCompressionEnabled = nil
	}

	// No error
	return nil
}

// settings for compression.
type CompressionSettings_STATUS struct {
	// ContentTypesToCompress: List of content types on which compression applies. The value should be a valid MIME type.
	ContentTypesToCompress []string `json:"contentTypesToCompress,omitempty"`

	// IsCompressionEnabled: Indicates whether content compression is enabled on AzureFrontDoor. Default value is false. If
	// compression is enabled, content will be served as compressed if user requests for a compressed version. Content won't be
	// compressed on AzureFrontDoor when requested content is smaller than 1 byte or larger than 1 MB.
	IsCompressionEnabled *bool `json:"isCompressionEnabled,omitempty"`
}

var _ genruntime.FromARMConverter = &CompressionSettings_STATUS{}

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

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

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

	// Set property "IsCompressionEnabled":
	if typedInput.IsCompressionEnabled != nil {
		isCompressionEnabled := *typedInput.IsCompressionEnabled
		settings.IsCompressionEnabled = &isCompressionEnabled
	}

	// No error
	return nil
}

// AssignProperties_From_CompressionSettings_STATUS populates our CompressionSettings_STATUS from the provided source CompressionSettings_STATUS
func (settings *CompressionSettings_STATUS) AssignProperties_From_CompressionSettings_STATUS(source *storage.CompressionSettings_STATUS) error {

	// ContentTypesToCompress
	settings.ContentTypesToCompress = genruntime.CloneSliceOfString(source.ContentTypesToCompress)

	// IsCompressionEnabled
	if source.IsCompressionEnabled != nil {
		isCompressionEnabled := *source.IsCompressionEnabled
		settings.IsCompressionEnabled = &isCompressionEnabled
	} else {
		settings.IsCompressionEnabled = nil
	}

	// No error
	return nil
}

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

	// ContentTypesToCompress
	destination.ContentTypesToCompress = genruntime.CloneSliceOfString(settings.ContentTypesToCompress)

	// IsCompressionEnabled
	if settings.IsCompressionEnabled != nil {
		isCompressionEnabled := *settings.IsCompressionEnabled
		destination.IsCompressionEnabled = &isCompressionEnabled
	} else {
		destination.IsCompressionEnabled = nil
	}

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

	// No error
	return nil
}

func init() {
	SchemeBuilder.Register(&Route{}, &RouteList{})
}
