// 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}/originGroups/{originGroupName}
type AfdOriginGroup struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              AfdOriginGroup_Spec   `json:"spec,omitempty"`
	Status            AfdOriginGroup_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &AfdOriginGroup{}

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

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

var _ conversion.Convertible = &AfdOriginGroup{}

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

	return group.AssignProperties_From_AfdOriginGroup(source)
}

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

	return group.AssignProperties_To_AfdOriginGroup(destination)
}

var _ configmaps.Exporter = &AfdOriginGroup{}

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

var _ secrets.Exporter = &AfdOriginGroup{}

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

var _ genruntime.ImportableResource = &AfdOriginGroup{}

// InitializeSpec initializes the spec for this resource from the given status
func (group *AfdOriginGroup) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*AfdOriginGroup_STATUS); ok {
		return group.Spec.Initialize_From_AfdOriginGroup_STATUS(s)
	}

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

var _ genruntime.KubernetesResource = &AfdOriginGroup{}

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

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

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

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

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

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

// NewEmptyStatus returns a new empty (blank) status
func (group *AfdOriginGroup) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &AfdOriginGroup_STATUS{}
}

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

	ownerGroup, ownerKind := genruntime.LookupOwnerGroupKind(group.Spec)
	return group.Spec.Owner.AsResourceReference(ownerGroup, ownerKind)
}

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

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

	group.Status = st
	return nil
}

// AssignProperties_From_AfdOriginGroup populates our AfdOriginGroup from the provided source AfdOriginGroup
func (group *AfdOriginGroup) AssignProperties_From_AfdOriginGroup(source *storage.AfdOriginGroup) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_AfdOriginGroup populates the provided destination AfdOriginGroup from our AfdOriginGroup
func (group *AfdOriginGroup) AssignProperties_To_AfdOriginGroup(destination *storage.AfdOriginGroup) error {

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

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

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

// +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}/originGroups/{originGroupName}
type AfdOriginGroupList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []AfdOriginGroup `json:"items"`
}

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

	// HealthProbeSettings: Health probe settings to the origin that is used to determine the health of the origin.
	HealthProbeSettings *HealthProbeParameters `json:"healthProbeSettings,omitempty"`

	// LoadBalancingSettings: Load balancing settings for a backend pool
	LoadBalancingSettings *LoadBalancingSettingsParameters `json:"loadBalancingSettings,omitempty"`

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

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

	// SessionAffinityState: Whether to allow session affinity on this host. Valid options are 'Enabled' or 'Disabled'
	SessionAffinityState *AFDOriginGroupProperties_SessionAffinityState `json:"sessionAffinityState,omitempty"`

	// +kubebuilder:validation:Maximum=50
	// +kubebuilder:validation:Minimum=0
	// TrafficRestorationTimeToHealedOrNewEndpointsInMinutes: Time in minutes to shift the traffic to the endpoint gradually
	// when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not
	// supported.
	TrafficRestorationTimeToHealedOrNewEndpointsInMinutes *int `json:"trafficRestorationTimeToHealedOrNewEndpointsInMinutes,omitempty"`
}

var _ genruntime.ARMTransformer = &AfdOriginGroup_Spec{}

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

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

	// Set property "Properties":
	if group.HealthProbeSettings != nil ||
		group.LoadBalancingSettings != nil ||
		group.SessionAffinityState != nil ||
		group.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes != nil {
		result.Properties = &arm.AFDOriginGroupProperties{}
	}
	if group.HealthProbeSettings != nil {
		healthProbeSettings_ARM, err := group.HealthProbeSettings.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		healthProbeSettings := *healthProbeSettings_ARM.(*arm.HealthProbeParameters)
		result.Properties.HealthProbeSettings = &healthProbeSettings
	}
	if group.LoadBalancingSettings != nil {
		loadBalancingSettings_ARM, err := group.LoadBalancingSettings.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		loadBalancingSettings := *loadBalancingSettings_ARM.(*arm.LoadBalancingSettingsParameters)
		result.Properties.LoadBalancingSettings = &loadBalancingSettings
	}
	if group.SessionAffinityState != nil {
		var temp string
		temp = string(*group.SessionAffinityState)
		sessionAffinityState := arm.AFDOriginGroupProperties_SessionAffinityState(temp)
		result.Properties.SessionAffinityState = &sessionAffinityState
	}
	if group.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes != nil {
		trafficRestorationTimeToHealedOrNewEndpointsInMinutes := *group.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes
		result.Properties.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes = &trafficRestorationTimeToHealedOrNewEndpointsInMinutes
	}
	return result, nil
}

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

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

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

	// Set property "HealthProbeSettings":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.HealthProbeSettings != nil {
			var healthProbeSettings1 HealthProbeParameters
			err := healthProbeSettings1.PopulateFromARM(owner, *typedInput.Properties.HealthProbeSettings)
			if err != nil {
				return err
			}
			healthProbeSettings := healthProbeSettings1
			group.HealthProbeSettings = &healthProbeSettings
		}
	}

	// Set property "LoadBalancingSettings":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.LoadBalancingSettings != nil {
			var loadBalancingSettings1 LoadBalancingSettingsParameters
			err := loadBalancingSettings1.PopulateFromARM(owner, *typedInput.Properties.LoadBalancingSettings)
			if err != nil {
				return err
			}
			loadBalancingSettings := loadBalancingSettings1
			group.LoadBalancingSettings = &loadBalancingSettings
		}
	}

	// no assignment for property "OperatorSpec"

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

	// Set property "SessionAffinityState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SessionAffinityState != nil {
			var temp string
			temp = string(*typedInput.Properties.SessionAffinityState)
			sessionAffinityState := AFDOriginGroupProperties_SessionAffinityState(temp)
			group.SessionAffinityState = &sessionAffinityState
		}
	}

	// Set property "TrafficRestorationTimeToHealedOrNewEndpointsInMinutes":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes != nil {
			trafficRestorationTimeToHealedOrNewEndpointsInMinutes := *typedInput.Properties.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes
			group.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes = &trafficRestorationTimeToHealedOrNewEndpointsInMinutes
		}
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &AfdOriginGroup_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.AfdOriginGroup_Spec{}
	err := group.AssignProperties_To_AfdOriginGroup_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_AfdOriginGroup_Spec populates our AfdOriginGroup_Spec from the provided source AfdOriginGroup_Spec
func (group *AfdOriginGroup_Spec) AssignProperties_From_AfdOriginGroup_Spec(source *storage.AfdOriginGroup_Spec) error {

	// AzureName
	group.AzureName = source.AzureName

	// HealthProbeSettings
	if source.HealthProbeSettings != nil {
		var healthProbeSetting HealthProbeParameters
		err := healthProbeSetting.AssignProperties_From_HealthProbeParameters(source.HealthProbeSettings)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_HealthProbeParameters() to populate field HealthProbeSettings")
		}
		group.HealthProbeSettings = &healthProbeSetting
	} else {
		group.HealthProbeSettings = nil
	}

	// LoadBalancingSettings
	if source.LoadBalancingSettings != nil {
		var loadBalancingSetting LoadBalancingSettingsParameters
		err := loadBalancingSetting.AssignProperties_From_LoadBalancingSettingsParameters(source.LoadBalancingSettings)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_LoadBalancingSettingsParameters() to populate field LoadBalancingSettings")
		}
		group.LoadBalancingSettings = &loadBalancingSetting
	} else {
		group.LoadBalancingSettings = nil
	}

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

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

	// SessionAffinityState
	if source.SessionAffinityState != nil {
		sessionAffinityState := *source.SessionAffinityState
		sessionAffinityStateTemp := genruntime.ToEnum(sessionAffinityState, aFDOriginGroupProperties_SessionAffinityState_Values)
		group.SessionAffinityState = &sessionAffinityStateTemp
	} else {
		group.SessionAffinityState = nil
	}

	// TrafficRestorationTimeToHealedOrNewEndpointsInMinutes
	group.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes = genruntime.ClonePointerToInt(source.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes)

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = group.AzureName

	// HealthProbeSettings
	if group.HealthProbeSettings != nil {
		var healthProbeSetting storage.HealthProbeParameters
		err := group.HealthProbeSettings.AssignProperties_To_HealthProbeParameters(&healthProbeSetting)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_HealthProbeParameters() to populate field HealthProbeSettings")
		}
		destination.HealthProbeSettings = &healthProbeSetting
	} else {
		destination.HealthProbeSettings = nil
	}

	// LoadBalancingSettings
	if group.LoadBalancingSettings != nil {
		var loadBalancingSetting storage.LoadBalancingSettingsParameters
		err := group.LoadBalancingSettings.AssignProperties_To_LoadBalancingSettingsParameters(&loadBalancingSetting)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_LoadBalancingSettingsParameters() to populate field LoadBalancingSettings")
		}
		destination.LoadBalancingSettings = &loadBalancingSetting
	} else {
		destination.LoadBalancingSettings = nil
	}

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

	// OriginalVersion
	destination.OriginalVersion = group.OriginalVersion()

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

	// SessionAffinityState
	if group.SessionAffinityState != nil {
		sessionAffinityState := string(*group.SessionAffinityState)
		destination.SessionAffinityState = &sessionAffinityState
	} else {
		destination.SessionAffinityState = nil
	}

	// TrafficRestorationTimeToHealedOrNewEndpointsInMinutes
	destination.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes = genruntime.ClonePointerToInt(group.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes)

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

	// No error
	return nil
}

// Initialize_From_AfdOriginGroup_STATUS populates our AfdOriginGroup_Spec from the provided source AfdOriginGroup_STATUS
func (group *AfdOriginGroup_Spec) Initialize_From_AfdOriginGroup_STATUS(source *AfdOriginGroup_STATUS) error {

	// HealthProbeSettings
	if source.HealthProbeSettings != nil {
		var healthProbeSetting HealthProbeParameters
		err := healthProbeSetting.Initialize_From_HealthProbeParameters_STATUS(source.HealthProbeSettings)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_HealthProbeParameters_STATUS() to populate field HealthProbeSettings")
		}
		group.HealthProbeSettings = &healthProbeSetting
	} else {
		group.HealthProbeSettings = nil
	}

	// LoadBalancingSettings
	if source.LoadBalancingSettings != nil {
		var loadBalancingSetting LoadBalancingSettingsParameters
		err := loadBalancingSetting.Initialize_From_LoadBalancingSettingsParameters_STATUS(source.LoadBalancingSettings)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_LoadBalancingSettingsParameters_STATUS() to populate field LoadBalancingSettings")
		}
		group.LoadBalancingSettings = &loadBalancingSetting
	} else {
		group.LoadBalancingSettings = nil
	}

	// SessionAffinityState
	if source.SessionAffinityState != nil {
		sessionAffinityState := genruntime.ToEnum(string(*source.SessionAffinityState), aFDOriginGroupProperties_SessionAffinityState_Values)
		group.SessionAffinityState = &sessionAffinityState
	} else {
		group.SessionAffinityState = nil
	}

	// TrafficRestorationTimeToHealedOrNewEndpointsInMinutes
	group.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes = genruntime.ClonePointerToInt(source.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes)

	// No error
	return nil
}

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

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

type AfdOriginGroup_STATUS struct {
	// Conditions: The observed state of the resource
	Conditions       []conditions.Condition                            `json:"conditions,omitempty"`
	DeploymentStatus *AFDOriginGroupProperties_DeploymentStatus_STATUS `json:"deploymentStatus,omitempty"`

	// HealthProbeSettings: Health probe settings to the origin that is used to determine the health of the origin.
	HealthProbeSettings *HealthProbeParameters_STATUS `json:"healthProbeSettings,omitempty"`

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

	// LoadBalancingSettings: Load balancing settings for a backend pool
	LoadBalancingSettings *LoadBalancingSettingsParameters_STATUS `json:"loadBalancingSettings,omitempty"`

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

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

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

	// SessionAffinityState: Whether to allow session affinity on this host. Valid options are 'Enabled' or 'Disabled'
	SessionAffinityState *AFDOriginGroupProperties_SessionAffinityState_STATUS `json:"sessionAffinityState,omitempty"`

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

	// TrafficRestorationTimeToHealedOrNewEndpointsInMinutes: Time in minutes to shift the traffic to the endpoint gradually
	// when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not
	// supported.
	TrafficRestorationTimeToHealedOrNewEndpointsInMinutes *int `json:"trafficRestorationTimeToHealedOrNewEndpointsInMinutes,omitempty"`

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

var _ genruntime.ConvertibleStatus = &AfdOriginGroup_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.AfdOriginGroup_STATUS{}
	err := group.AssignProperties_To_AfdOriginGroup_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 = &AfdOriginGroup_STATUS{}

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

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

	// no assignment for property "Conditions"

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

	// Set property "HealthProbeSettings":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.HealthProbeSettings != nil {
			var healthProbeSettings1 HealthProbeParameters_STATUS
			err := healthProbeSettings1.PopulateFromARM(owner, *typedInput.Properties.HealthProbeSettings)
			if err != nil {
				return err
			}
			healthProbeSettings := healthProbeSettings1
			group.HealthProbeSettings = &healthProbeSettings
		}
	}

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

	// Set property "LoadBalancingSettings":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.LoadBalancingSettings != nil {
			var loadBalancingSettings1 LoadBalancingSettingsParameters_STATUS
			err := loadBalancingSettings1.PopulateFromARM(owner, *typedInput.Properties.LoadBalancingSettings)
			if err != nil {
				return err
			}
			loadBalancingSettings := loadBalancingSettings1
			group.LoadBalancingSettings = &loadBalancingSettings
		}
	}

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

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

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

	// Set property "SessionAffinityState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SessionAffinityState != nil {
			var temp string
			temp = string(*typedInput.Properties.SessionAffinityState)
			sessionAffinityState := AFDOriginGroupProperties_SessionAffinityState_STATUS(temp)
			group.SessionAffinityState = &sessionAffinityState
		}
	}

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

	// Set property "TrafficRestorationTimeToHealedOrNewEndpointsInMinutes":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes != nil {
			trafficRestorationTimeToHealedOrNewEndpointsInMinutes := *typedInput.Properties.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes
			group.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes = &trafficRestorationTimeToHealedOrNewEndpointsInMinutes
		}
	}

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

	// No error
	return nil
}

// AssignProperties_From_AfdOriginGroup_STATUS populates our AfdOriginGroup_STATUS from the provided source AfdOriginGroup_STATUS
func (group *AfdOriginGroup_STATUS) AssignProperties_From_AfdOriginGroup_STATUS(source *storage.AfdOriginGroup_STATUS) error {

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

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

	// HealthProbeSettings
	if source.HealthProbeSettings != nil {
		var healthProbeSetting HealthProbeParameters_STATUS
		err := healthProbeSetting.AssignProperties_From_HealthProbeParameters_STATUS(source.HealthProbeSettings)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_HealthProbeParameters_STATUS() to populate field HealthProbeSettings")
		}
		group.HealthProbeSettings = &healthProbeSetting
	} else {
		group.HealthProbeSettings = nil
	}

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

	// LoadBalancingSettings
	if source.LoadBalancingSettings != nil {
		var loadBalancingSetting LoadBalancingSettingsParameters_STATUS
		err := loadBalancingSetting.AssignProperties_From_LoadBalancingSettingsParameters_STATUS(source.LoadBalancingSettings)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_LoadBalancingSettingsParameters_STATUS() to populate field LoadBalancingSettings")
		}
		group.LoadBalancingSettings = &loadBalancingSetting
	} else {
		group.LoadBalancingSettings = nil
	}

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

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

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

	// SessionAffinityState
	if source.SessionAffinityState != nil {
		sessionAffinityState := *source.SessionAffinityState
		sessionAffinityStateTemp := genruntime.ToEnum(sessionAffinityState, aFDOriginGroupProperties_SessionAffinityState_STATUS_Values)
		group.SessionAffinityState = &sessionAffinityStateTemp
	} else {
		group.SessionAffinityState = 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")
		}
		group.SystemData = &systemDatum
	} else {
		group.SystemData = nil
	}

	// TrafficRestorationTimeToHealedOrNewEndpointsInMinutes
	group.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes = genruntime.ClonePointerToInt(source.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes)

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

	// No error
	return nil
}

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

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

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

	// HealthProbeSettings
	if group.HealthProbeSettings != nil {
		var healthProbeSetting storage.HealthProbeParameters_STATUS
		err := group.HealthProbeSettings.AssignProperties_To_HealthProbeParameters_STATUS(&healthProbeSetting)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_HealthProbeParameters_STATUS() to populate field HealthProbeSettings")
		}
		destination.HealthProbeSettings = &healthProbeSetting
	} else {
		destination.HealthProbeSettings = nil
	}

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

	// LoadBalancingSettings
	if group.LoadBalancingSettings != nil {
		var loadBalancingSetting storage.LoadBalancingSettingsParameters_STATUS
		err := group.LoadBalancingSettings.AssignProperties_To_LoadBalancingSettingsParameters_STATUS(&loadBalancingSetting)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_LoadBalancingSettingsParameters_STATUS() to populate field LoadBalancingSettings")
		}
		destination.LoadBalancingSettings = &loadBalancingSetting
	} else {
		destination.LoadBalancingSettings = nil
	}

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

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

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

	// SessionAffinityState
	if group.SessionAffinityState != nil {
		sessionAffinityState := string(*group.SessionAffinityState)
		destination.SessionAffinityState = &sessionAffinityState
	} else {
		destination.SessionAffinityState = nil
	}

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

	// TrafficRestorationTimeToHealedOrNewEndpointsInMinutes
	destination.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes = genruntime.ClonePointerToInt(group.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes)

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

	// 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 AfdOriginGroupOperatorSpec 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_AfdOriginGroupOperatorSpec populates our AfdOriginGroupOperatorSpec from the provided source AfdOriginGroupOperatorSpec
func (operator *AfdOriginGroupOperatorSpec) AssignProperties_From_AfdOriginGroupOperatorSpec(source *storage.AfdOriginGroupOperatorSpec) 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_AfdOriginGroupOperatorSpec populates the provided destination AfdOriginGroupOperatorSpec from our AfdOriginGroupOperatorSpec
func (operator *AfdOriginGroupOperatorSpec) AssignProperties_To_AfdOriginGroupOperatorSpec(destination *storage.AfdOriginGroupOperatorSpec) 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 AFDOriginGroupProperties_DeploymentStatus_STATUS string

const (
	AFDOriginGroupProperties_DeploymentStatus_STATUS_Failed     = AFDOriginGroupProperties_DeploymentStatus_STATUS("Failed")
	AFDOriginGroupProperties_DeploymentStatus_STATUS_InProgress = AFDOriginGroupProperties_DeploymentStatus_STATUS("InProgress")
	AFDOriginGroupProperties_DeploymentStatus_STATUS_NotStarted = AFDOriginGroupProperties_DeploymentStatus_STATUS("NotStarted")
	AFDOriginGroupProperties_DeploymentStatus_STATUS_Succeeded  = AFDOriginGroupProperties_DeploymentStatus_STATUS("Succeeded")
)

// Mapping from string to AFDOriginGroupProperties_DeploymentStatus_STATUS
var aFDOriginGroupProperties_DeploymentStatus_STATUS_Values = map[string]AFDOriginGroupProperties_DeploymentStatus_STATUS{
	"failed":     AFDOriginGroupProperties_DeploymentStatus_STATUS_Failed,
	"inprogress": AFDOriginGroupProperties_DeploymentStatus_STATUS_InProgress,
	"notstarted": AFDOriginGroupProperties_DeploymentStatus_STATUS_NotStarted,
	"succeeded":  AFDOriginGroupProperties_DeploymentStatus_STATUS_Succeeded,
}

type AFDOriginGroupProperties_ProvisioningState_STATUS string

const (
	AFDOriginGroupProperties_ProvisioningState_STATUS_Creating  = AFDOriginGroupProperties_ProvisioningState_STATUS("Creating")
	AFDOriginGroupProperties_ProvisioningState_STATUS_Deleting  = AFDOriginGroupProperties_ProvisioningState_STATUS("Deleting")
	AFDOriginGroupProperties_ProvisioningState_STATUS_Failed    = AFDOriginGroupProperties_ProvisioningState_STATUS("Failed")
	AFDOriginGroupProperties_ProvisioningState_STATUS_Succeeded = AFDOriginGroupProperties_ProvisioningState_STATUS("Succeeded")
	AFDOriginGroupProperties_ProvisioningState_STATUS_Updating  = AFDOriginGroupProperties_ProvisioningState_STATUS("Updating")
)

// Mapping from string to AFDOriginGroupProperties_ProvisioningState_STATUS
var aFDOriginGroupProperties_ProvisioningState_STATUS_Values = map[string]AFDOriginGroupProperties_ProvisioningState_STATUS{
	"creating":  AFDOriginGroupProperties_ProvisioningState_STATUS_Creating,
	"deleting":  AFDOriginGroupProperties_ProvisioningState_STATUS_Deleting,
	"failed":    AFDOriginGroupProperties_ProvisioningState_STATUS_Failed,
	"succeeded": AFDOriginGroupProperties_ProvisioningState_STATUS_Succeeded,
	"updating":  AFDOriginGroupProperties_ProvisioningState_STATUS_Updating,
}

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

const (
	AFDOriginGroupProperties_SessionAffinityState_Disabled = AFDOriginGroupProperties_SessionAffinityState("Disabled")
	AFDOriginGroupProperties_SessionAffinityState_Enabled  = AFDOriginGroupProperties_SessionAffinityState("Enabled")
)

// Mapping from string to AFDOriginGroupProperties_SessionAffinityState
var aFDOriginGroupProperties_SessionAffinityState_Values = map[string]AFDOriginGroupProperties_SessionAffinityState{
	"disabled": AFDOriginGroupProperties_SessionAffinityState_Disabled,
	"enabled":  AFDOriginGroupProperties_SessionAffinityState_Enabled,
}

type AFDOriginGroupProperties_SessionAffinityState_STATUS string

const (
	AFDOriginGroupProperties_SessionAffinityState_STATUS_Disabled = AFDOriginGroupProperties_SessionAffinityState_STATUS("Disabled")
	AFDOriginGroupProperties_SessionAffinityState_STATUS_Enabled  = AFDOriginGroupProperties_SessionAffinityState_STATUS("Enabled")
)

// Mapping from string to AFDOriginGroupProperties_SessionAffinityState_STATUS
var aFDOriginGroupProperties_SessionAffinityState_STATUS_Values = map[string]AFDOriginGroupProperties_SessionAffinityState_STATUS{
	"disabled": AFDOriginGroupProperties_SessionAffinityState_STATUS_Disabled,
	"enabled":  AFDOriginGroupProperties_SessionAffinityState_STATUS_Enabled,
}

// The JSON object that contains the properties to send health probes to origin.
type HealthProbeParameters struct {
	// +kubebuilder:validation:Maximum=255
	// +kubebuilder:validation:Minimum=1
	// ProbeIntervalInSeconds: The number of seconds between health probes.Default is 240sec.
	ProbeIntervalInSeconds *int `json:"probeIntervalInSeconds,omitempty"`

	// ProbePath: The path relative to the origin that is used to determine the health of the origin.
	ProbePath *string `json:"probePath,omitempty"`

	// ProbeProtocol: Protocol to use for health probe.
	ProbeProtocol *HealthProbeParameters_ProbeProtocol `json:"probeProtocol,omitempty"`

	// ProbeRequestType: The type of health probe request that is made.
	ProbeRequestType *HealthProbeParameters_ProbeRequestType `json:"probeRequestType,omitempty"`
}

var _ genruntime.ARMTransformer = &HealthProbeParameters{}

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

	// Set property "ProbeIntervalInSeconds":
	if parameters.ProbeIntervalInSeconds != nil {
		probeIntervalInSeconds := *parameters.ProbeIntervalInSeconds
		result.ProbeIntervalInSeconds = &probeIntervalInSeconds
	}

	// Set property "ProbePath":
	if parameters.ProbePath != nil {
		probePath := *parameters.ProbePath
		result.ProbePath = &probePath
	}

	// Set property "ProbeProtocol":
	if parameters.ProbeProtocol != nil {
		var temp string
		temp = string(*parameters.ProbeProtocol)
		probeProtocol := arm.HealthProbeParameters_ProbeProtocol(temp)
		result.ProbeProtocol = &probeProtocol
	}

	// Set property "ProbeRequestType":
	if parameters.ProbeRequestType != nil {
		var temp string
		temp = string(*parameters.ProbeRequestType)
		probeRequestType := arm.HealthProbeParameters_ProbeRequestType(temp)
		result.ProbeRequestType = &probeRequestType
	}
	return result, nil
}

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

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

	// Set property "ProbeIntervalInSeconds":
	if typedInput.ProbeIntervalInSeconds != nil {
		probeIntervalInSeconds := *typedInput.ProbeIntervalInSeconds
		parameters.ProbeIntervalInSeconds = &probeIntervalInSeconds
	}

	// Set property "ProbePath":
	if typedInput.ProbePath != nil {
		probePath := *typedInput.ProbePath
		parameters.ProbePath = &probePath
	}

	// Set property "ProbeProtocol":
	if typedInput.ProbeProtocol != nil {
		var temp string
		temp = string(*typedInput.ProbeProtocol)
		probeProtocol := HealthProbeParameters_ProbeProtocol(temp)
		parameters.ProbeProtocol = &probeProtocol
	}

	// Set property "ProbeRequestType":
	if typedInput.ProbeRequestType != nil {
		var temp string
		temp = string(*typedInput.ProbeRequestType)
		probeRequestType := HealthProbeParameters_ProbeRequestType(temp)
		parameters.ProbeRequestType = &probeRequestType
	}

	// No error
	return nil
}

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

	// ProbeIntervalInSeconds
	parameters.ProbeIntervalInSeconds = genruntime.ClonePointerToInt(source.ProbeIntervalInSeconds)

	// ProbePath
	parameters.ProbePath = genruntime.ClonePointerToString(source.ProbePath)

	// ProbeProtocol
	if source.ProbeProtocol != nil {
		probeProtocol := *source.ProbeProtocol
		probeProtocolTemp := genruntime.ToEnum(probeProtocol, healthProbeParameters_ProbeProtocol_Values)
		parameters.ProbeProtocol = &probeProtocolTemp
	} else {
		parameters.ProbeProtocol = nil
	}

	// ProbeRequestType
	if source.ProbeRequestType != nil {
		probeRequestType := *source.ProbeRequestType
		probeRequestTypeTemp := genruntime.ToEnum(probeRequestType, healthProbeParameters_ProbeRequestType_Values)
		parameters.ProbeRequestType = &probeRequestTypeTemp
	} else {
		parameters.ProbeRequestType = nil
	}

	// No error
	return nil
}

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

	// ProbeIntervalInSeconds
	destination.ProbeIntervalInSeconds = genruntime.ClonePointerToInt(parameters.ProbeIntervalInSeconds)

	// ProbePath
	destination.ProbePath = genruntime.ClonePointerToString(parameters.ProbePath)

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

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

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

	// No error
	return nil
}

// Initialize_From_HealthProbeParameters_STATUS populates our HealthProbeParameters from the provided source HealthProbeParameters_STATUS
func (parameters *HealthProbeParameters) Initialize_From_HealthProbeParameters_STATUS(source *HealthProbeParameters_STATUS) error {

	// ProbeIntervalInSeconds
	parameters.ProbeIntervalInSeconds = genruntime.ClonePointerToInt(source.ProbeIntervalInSeconds)

	// ProbePath
	parameters.ProbePath = genruntime.ClonePointerToString(source.ProbePath)

	// ProbeProtocol
	if source.ProbeProtocol != nil {
		probeProtocol := genruntime.ToEnum(string(*source.ProbeProtocol), healthProbeParameters_ProbeProtocol_Values)
		parameters.ProbeProtocol = &probeProtocol
	} else {
		parameters.ProbeProtocol = nil
	}

	// ProbeRequestType
	if source.ProbeRequestType != nil {
		probeRequestType := genruntime.ToEnum(string(*source.ProbeRequestType), healthProbeParameters_ProbeRequestType_Values)
		parameters.ProbeRequestType = &probeRequestType
	} else {
		parameters.ProbeRequestType = nil
	}

	// No error
	return nil
}

// The JSON object that contains the properties to send health probes to origin.
type HealthProbeParameters_STATUS struct {
	// ProbeIntervalInSeconds: The number of seconds between health probes.Default is 240sec.
	ProbeIntervalInSeconds *int `json:"probeIntervalInSeconds,omitempty"`

	// ProbePath: The path relative to the origin that is used to determine the health of the origin.
	ProbePath *string `json:"probePath,omitempty"`

	// ProbeProtocol: Protocol to use for health probe.
	ProbeProtocol *HealthProbeParameters_ProbeProtocol_STATUS `json:"probeProtocol,omitempty"`

	// ProbeRequestType: The type of health probe request that is made.
	ProbeRequestType *HealthProbeParameters_ProbeRequestType_STATUS `json:"probeRequestType,omitempty"`
}

var _ genruntime.FromARMConverter = &HealthProbeParameters_STATUS{}

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

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

	// Set property "ProbeIntervalInSeconds":
	if typedInput.ProbeIntervalInSeconds != nil {
		probeIntervalInSeconds := *typedInput.ProbeIntervalInSeconds
		parameters.ProbeIntervalInSeconds = &probeIntervalInSeconds
	}

	// Set property "ProbePath":
	if typedInput.ProbePath != nil {
		probePath := *typedInput.ProbePath
		parameters.ProbePath = &probePath
	}

	// Set property "ProbeProtocol":
	if typedInput.ProbeProtocol != nil {
		var temp string
		temp = string(*typedInput.ProbeProtocol)
		probeProtocol := HealthProbeParameters_ProbeProtocol_STATUS(temp)
		parameters.ProbeProtocol = &probeProtocol
	}

	// Set property "ProbeRequestType":
	if typedInput.ProbeRequestType != nil {
		var temp string
		temp = string(*typedInput.ProbeRequestType)
		probeRequestType := HealthProbeParameters_ProbeRequestType_STATUS(temp)
		parameters.ProbeRequestType = &probeRequestType
	}

	// No error
	return nil
}

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

	// ProbeIntervalInSeconds
	parameters.ProbeIntervalInSeconds = genruntime.ClonePointerToInt(source.ProbeIntervalInSeconds)

	// ProbePath
	parameters.ProbePath = genruntime.ClonePointerToString(source.ProbePath)

	// ProbeProtocol
	if source.ProbeProtocol != nil {
		probeProtocol := *source.ProbeProtocol
		probeProtocolTemp := genruntime.ToEnum(probeProtocol, healthProbeParameters_ProbeProtocol_STATUS_Values)
		parameters.ProbeProtocol = &probeProtocolTemp
	} else {
		parameters.ProbeProtocol = nil
	}

	// ProbeRequestType
	if source.ProbeRequestType != nil {
		probeRequestType := *source.ProbeRequestType
		probeRequestTypeTemp := genruntime.ToEnum(probeRequestType, healthProbeParameters_ProbeRequestType_STATUS_Values)
		parameters.ProbeRequestType = &probeRequestTypeTemp
	} else {
		parameters.ProbeRequestType = nil
	}

	// No error
	return nil
}

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

	// ProbeIntervalInSeconds
	destination.ProbeIntervalInSeconds = genruntime.ClonePointerToInt(parameters.ProbeIntervalInSeconds)

	// ProbePath
	destination.ProbePath = genruntime.ClonePointerToString(parameters.ProbePath)

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

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

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

	// No error
	return nil
}

// Round-Robin load balancing settings for a backend pool
type LoadBalancingSettingsParameters struct {
	// AdditionalLatencyInMilliseconds: The additional latency in milliseconds for probes to fall into the lowest latency bucket
	AdditionalLatencyInMilliseconds *int `json:"additionalLatencyInMilliseconds,omitempty"`

	// SampleSize: The number of samples to consider for load balancing decisions
	SampleSize *int `json:"sampleSize,omitempty"`

	// SuccessfulSamplesRequired: The number of samples within the sample period that must succeed
	SuccessfulSamplesRequired *int `json:"successfulSamplesRequired,omitempty"`
}

var _ genruntime.ARMTransformer = &LoadBalancingSettingsParameters{}

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

	// Set property "AdditionalLatencyInMilliseconds":
	if parameters.AdditionalLatencyInMilliseconds != nil {
		additionalLatencyInMilliseconds := *parameters.AdditionalLatencyInMilliseconds
		result.AdditionalLatencyInMilliseconds = &additionalLatencyInMilliseconds
	}

	// Set property "SampleSize":
	if parameters.SampleSize != nil {
		sampleSize := *parameters.SampleSize
		result.SampleSize = &sampleSize
	}

	// Set property "SuccessfulSamplesRequired":
	if parameters.SuccessfulSamplesRequired != nil {
		successfulSamplesRequired := *parameters.SuccessfulSamplesRequired
		result.SuccessfulSamplesRequired = &successfulSamplesRequired
	}
	return result, nil
}

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

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

	// Set property "AdditionalLatencyInMilliseconds":
	if typedInput.AdditionalLatencyInMilliseconds != nil {
		additionalLatencyInMilliseconds := *typedInput.AdditionalLatencyInMilliseconds
		parameters.AdditionalLatencyInMilliseconds = &additionalLatencyInMilliseconds
	}

	// Set property "SampleSize":
	if typedInput.SampleSize != nil {
		sampleSize := *typedInput.SampleSize
		parameters.SampleSize = &sampleSize
	}

	// Set property "SuccessfulSamplesRequired":
	if typedInput.SuccessfulSamplesRequired != nil {
		successfulSamplesRequired := *typedInput.SuccessfulSamplesRequired
		parameters.SuccessfulSamplesRequired = &successfulSamplesRequired
	}

	// No error
	return nil
}

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

	// AdditionalLatencyInMilliseconds
	parameters.AdditionalLatencyInMilliseconds = genruntime.ClonePointerToInt(source.AdditionalLatencyInMilliseconds)

	// SampleSize
	parameters.SampleSize = genruntime.ClonePointerToInt(source.SampleSize)

	// SuccessfulSamplesRequired
	parameters.SuccessfulSamplesRequired = genruntime.ClonePointerToInt(source.SuccessfulSamplesRequired)

	// No error
	return nil
}

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

	// AdditionalLatencyInMilliseconds
	destination.AdditionalLatencyInMilliseconds = genruntime.ClonePointerToInt(parameters.AdditionalLatencyInMilliseconds)

	// SampleSize
	destination.SampleSize = genruntime.ClonePointerToInt(parameters.SampleSize)

	// SuccessfulSamplesRequired
	destination.SuccessfulSamplesRequired = genruntime.ClonePointerToInt(parameters.SuccessfulSamplesRequired)

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

	// No error
	return nil
}

// Initialize_From_LoadBalancingSettingsParameters_STATUS populates our LoadBalancingSettingsParameters from the provided source LoadBalancingSettingsParameters_STATUS
func (parameters *LoadBalancingSettingsParameters) Initialize_From_LoadBalancingSettingsParameters_STATUS(source *LoadBalancingSettingsParameters_STATUS) error {

	// AdditionalLatencyInMilliseconds
	parameters.AdditionalLatencyInMilliseconds = genruntime.ClonePointerToInt(source.AdditionalLatencyInMilliseconds)

	// SampleSize
	parameters.SampleSize = genruntime.ClonePointerToInt(source.SampleSize)

	// SuccessfulSamplesRequired
	parameters.SuccessfulSamplesRequired = genruntime.ClonePointerToInt(source.SuccessfulSamplesRequired)

	// No error
	return nil
}

// Round-Robin load balancing settings for a backend pool
type LoadBalancingSettingsParameters_STATUS struct {
	// AdditionalLatencyInMilliseconds: The additional latency in milliseconds for probes to fall into the lowest latency bucket
	AdditionalLatencyInMilliseconds *int `json:"additionalLatencyInMilliseconds,omitempty"`

	// SampleSize: The number of samples to consider for load balancing decisions
	SampleSize *int `json:"sampleSize,omitempty"`

	// SuccessfulSamplesRequired: The number of samples within the sample period that must succeed
	SuccessfulSamplesRequired *int `json:"successfulSamplesRequired,omitempty"`
}

var _ genruntime.FromARMConverter = &LoadBalancingSettingsParameters_STATUS{}

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

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

	// Set property "AdditionalLatencyInMilliseconds":
	if typedInput.AdditionalLatencyInMilliseconds != nil {
		additionalLatencyInMilliseconds := *typedInput.AdditionalLatencyInMilliseconds
		parameters.AdditionalLatencyInMilliseconds = &additionalLatencyInMilliseconds
	}

	// Set property "SampleSize":
	if typedInput.SampleSize != nil {
		sampleSize := *typedInput.SampleSize
		parameters.SampleSize = &sampleSize
	}

	// Set property "SuccessfulSamplesRequired":
	if typedInput.SuccessfulSamplesRequired != nil {
		successfulSamplesRequired := *typedInput.SuccessfulSamplesRequired
		parameters.SuccessfulSamplesRequired = &successfulSamplesRequired
	}

	// No error
	return nil
}

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

	// AdditionalLatencyInMilliseconds
	parameters.AdditionalLatencyInMilliseconds = genruntime.ClonePointerToInt(source.AdditionalLatencyInMilliseconds)

	// SampleSize
	parameters.SampleSize = genruntime.ClonePointerToInt(source.SampleSize)

	// SuccessfulSamplesRequired
	parameters.SuccessfulSamplesRequired = genruntime.ClonePointerToInt(source.SuccessfulSamplesRequired)

	// No error
	return nil
}

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

	// AdditionalLatencyInMilliseconds
	destination.AdditionalLatencyInMilliseconds = genruntime.ClonePointerToInt(parameters.AdditionalLatencyInMilliseconds)

	// SampleSize
	destination.SampleSize = genruntime.ClonePointerToInt(parameters.SampleSize)

	// SuccessfulSamplesRequired
	destination.SuccessfulSamplesRequired = genruntime.ClonePointerToInt(parameters.SuccessfulSamplesRequired)

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"Http","Https","NotSet"}
type HealthProbeParameters_ProbeProtocol string

const (
	HealthProbeParameters_ProbeProtocol_Http   = HealthProbeParameters_ProbeProtocol("Http")
	HealthProbeParameters_ProbeProtocol_Https  = HealthProbeParameters_ProbeProtocol("Https")
	HealthProbeParameters_ProbeProtocol_NotSet = HealthProbeParameters_ProbeProtocol("NotSet")
)

// Mapping from string to HealthProbeParameters_ProbeProtocol
var healthProbeParameters_ProbeProtocol_Values = map[string]HealthProbeParameters_ProbeProtocol{
	"http":   HealthProbeParameters_ProbeProtocol_Http,
	"https":  HealthProbeParameters_ProbeProtocol_Https,
	"notset": HealthProbeParameters_ProbeProtocol_NotSet,
}

type HealthProbeParameters_ProbeProtocol_STATUS string

const (
	HealthProbeParameters_ProbeProtocol_STATUS_Http   = HealthProbeParameters_ProbeProtocol_STATUS("Http")
	HealthProbeParameters_ProbeProtocol_STATUS_Https  = HealthProbeParameters_ProbeProtocol_STATUS("Https")
	HealthProbeParameters_ProbeProtocol_STATUS_NotSet = HealthProbeParameters_ProbeProtocol_STATUS("NotSet")
)

// Mapping from string to HealthProbeParameters_ProbeProtocol_STATUS
var healthProbeParameters_ProbeProtocol_STATUS_Values = map[string]HealthProbeParameters_ProbeProtocol_STATUS{
	"http":   HealthProbeParameters_ProbeProtocol_STATUS_Http,
	"https":  HealthProbeParameters_ProbeProtocol_STATUS_Https,
	"notset": HealthProbeParameters_ProbeProtocol_STATUS_NotSet,
}

// +kubebuilder:validation:Enum={"GET","HEAD","NotSet"}
type HealthProbeParameters_ProbeRequestType string

const (
	HealthProbeParameters_ProbeRequestType_GET    = HealthProbeParameters_ProbeRequestType("GET")
	HealthProbeParameters_ProbeRequestType_HEAD   = HealthProbeParameters_ProbeRequestType("HEAD")
	HealthProbeParameters_ProbeRequestType_NotSet = HealthProbeParameters_ProbeRequestType("NotSet")
)

// Mapping from string to HealthProbeParameters_ProbeRequestType
var healthProbeParameters_ProbeRequestType_Values = map[string]HealthProbeParameters_ProbeRequestType{
	"get":    HealthProbeParameters_ProbeRequestType_GET,
	"head":   HealthProbeParameters_ProbeRequestType_HEAD,
	"notset": HealthProbeParameters_ProbeRequestType_NotSet,
}

type HealthProbeParameters_ProbeRequestType_STATUS string

const (
	HealthProbeParameters_ProbeRequestType_STATUS_GET    = HealthProbeParameters_ProbeRequestType_STATUS("GET")
	HealthProbeParameters_ProbeRequestType_STATUS_HEAD   = HealthProbeParameters_ProbeRequestType_STATUS("HEAD")
	HealthProbeParameters_ProbeRequestType_STATUS_NotSet = HealthProbeParameters_ProbeRequestType_STATUS("NotSet")
)

// Mapping from string to HealthProbeParameters_ProbeRequestType_STATUS
var healthProbeParameters_ProbeRequestType_STATUS_Values = map[string]HealthProbeParameters_ProbeRequestType_STATUS{
	"get":    HealthProbeParameters_ProbeRequestType_STATUS_GET,
	"head":   HealthProbeParameters_ProbeRequestType_STATUS_HEAD,
	"notset": HealthProbeParameters_ProbeRequestType_STATUS_NotSet,
}

func init() {
	SchemeBuilder.Register(&AfdOriginGroup{}, &AfdOriginGroupList{})
}
