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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/network/v1api20240301/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/network/v1api20240301/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,network}
// +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: /network/resource-manager/Microsoft.Network/stable/2024-03-01/firewallPolicy.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}
type FirewallPoliciesRuleCollectionGroup struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              FirewallPoliciesRuleCollectionGroup_Spec   `json:"spec,omitempty"`
	Status            FirewallPoliciesRuleCollectionGroup_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &FirewallPoliciesRuleCollectionGroup{}

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

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

var _ conversion.Convertible = &FirewallPoliciesRuleCollectionGroup{}

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

	return group.AssignProperties_From_FirewallPoliciesRuleCollectionGroup(source)
}

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

	return group.AssignProperties_To_FirewallPoliciesRuleCollectionGroup(destination)
}

var _ configmaps.Exporter = &FirewallPoliciesRuleCollectionGroup{}

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

var _ secrets.Exporter = &FirewallPoliciesRuleCollectionGroup{}

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

var _ genruntime.ImportableResource = &FirewallPoliciesRuleCollectionGroup{}

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

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

var _ genruntime.KubernetesResource = &FirewallPoliciesRuleCollectionGroup{}

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

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

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.Network/firewallPolicies/ruleCollectionGroups"
func (group *FirewallPoliciesRuleCollectionGroup) GetType() string {
	return "Microsoft.Network/firewallPolicies/ruleCollectionGroups"
}

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

// Owner returns the ResourceReference of the owner
func (group *FirewallPoliciesRuleCollectionGroup) 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 *FirewallPoliciesRuleCollectionGroup) SetStatus(status genruntime.ConvertibleStatus) error {
	// If we have exactly the right type of status, assign it
	if st, ok := status.(*FirewallPoliciesRuleCollectionGroup_STATUS); ok {
		group.Status = *st
		return nil
	}

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

	group.Status = st
	return nil
}

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

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

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

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

	// No error
	return nil
}

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

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /network/resource-manager/Microsoft.Network/stable/2024-03-01/firewallPolicy.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}
type FirewallPoliciesRuleCollectionGroupList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []FirewallPoliciesRuleCollectionGroup `json:"items"`
}

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

	// OperatorSpec: The specification for configuring operator behavior. This field is interpreted by the operator and not
	// passed directly to Azure
	OperatorSpec *FirewallPoliciesRuleCollectionGroupOperatorSpec `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 network.azure.com/FirewallPolicy resource
	Owner *genruntime.KnownResourceReference `group:"network.azure.com" json:"owner,omitempty" kind:"FirewallPolicy"`

	// +kubebuilder:validation:Maximum=65000
	// +kubebuilder:validation:Minimum=100
	// Priority: Priority of the Firewall Policy Rule Collection Group resource.
	Priority *int `json:"priority,omitempty"`

	// RuleCollections: Group of Firewall Policy rule collections.
	RuleCollections []FirewallPolicyRuleCollection `json:"ruleCollections,omitempty"`
}

var _ genruntime.ARMTransformer = &FirewallPoliciesRuleCollectionGroup_Spec{}

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

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

	// Set property "Properties":
	if group.Priority != nil || group.RuleCollections != nil {
		result.Properties = &arm.FirewallPolicyRuleCollectionGroupProperties{}
	}
	if group.Priority != nil {
		priority := *group.Priority
		result.Properties.Priority = &priority
	}
	for _, item := range group.RuleCollections {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.RuleCollections = append(result.Properties.RuleCollections, *item_ARM.(*arm.FirewallPolicyRuleCollection))
	}
	return result, nil
}

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

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

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

	// no assignment for property "OperatorSpec"

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

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

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

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &FirewallPoliciesRuleCollectionGroup_Spec{}

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

	// Convert to an intermediate form
	src = &storage.FirewallPoliciesRuleCollectionGroup_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_FirewallPoliciesRuleCollectionGroup_Spec(src)
	if err != nil {
		return eris.Wrap(err, "final step of conversion in ConvertSpecFrom()")
	}

	return nil
}

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

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

	// AzureName
	group.AzureName = source.AzureName

	// OperatorSpec
	if source.OperatorSpec != nil {
		var operatorSpec FirewallPoliciesRuleCollectionGroupOperatorSpec
		err := operatorSpec.AssignProperties_From_FirewallPoliciesRuleCollectionGroupOperatorSpec(source.OperatorSpec)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_FirewallPoliciesRuleCollectionGroupOperatorSpec() 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
	}

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

	// RuleCollections
	if source.RuleCollections != nil {
		ruleCollectionList := make([]FirewallPolicyRuleCollection, len(source.RuleCollections))
		for ruleCollectionIndex, ruleCollectionItem := range source.RuleCollections {
			var ruleCollection FirewallPolicyRuleCollection
			err := ruleCollection.AssignProperties_From_FirewallPolicyRuleCollection(&ruleCollectionItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_FirewallPolicyRuleCollection() to populate field RuleCollections")
			}
			ruleCollectionList[ruleCollectionIndex] = ruleCollection
		}
		group.RuleCollections = ruleCollectionList
	} else {
		group.RuleCollections = nil
	}

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = group.AzureName

	// OperatorSpec
	if group.OperatorSpec != nil {
		var operatorSpec storage.FirewallPoliciesRuleCollectionGroupOperatorSpec
		err := group.OperatorSpec.AssignProperties_To_FirewallPoliciesRuleCollectionGroupOperatorSpec(&operatorSpec)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_FirewallPoliciesRuleCollectionGroupOperatorSpec() 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
	}

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

	// RuleCollections
	if group.RuleCollections != nil {
		ruleCollectionList := make([]storage.FirewallPolicyRuleCollection, len(group.RuleCollections))
		for ruleCollectionIndex, ruleCollectionItem := range group.RuleCollections {
			var ruleCollection storage.FirewallPolicyRuleCollection
			err := ruleCollectionItem.AssignProperties_To_FirewallPolicyRuleCollection(&ruleCollection)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_FirewallPolicyRuleCollection() to populate field RuleCollections")
			}
			ruleCollectionList[ruleCollectionIndex] = ruleCollection
		}
		destination.RuleCollections = ruleCollectionList
	} else {
		destination.RuleCollections = nil
	}

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

	// No error
	return nil
}

// Initialize_From_FirewallPoliciesRuleCollectionGroup_STATUS populates our FirewallPoliciesRuleCollectionGroup_Spec from the provided source FirewallPoliciesRuleCollectionGroup_STATUS
func (group *FirewallPoliciesRuleCollectionGroup_Spec) Initialize_From_FirewallPoliciesRuleCollectionGroup_STATUS(source *FirewallPoliciesRuleCollectionGroup_STATUS) error {

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

	// RuleCollections
	if source.RuleCollections != nil {
		ruleCollectionList := make([]FirewallPolicyRuleCollection, len(source.RuleCollections))
		for ruleCollectionIndex, ruleCollectionItem := range source.RuleCollections {
			var ruleCollection FirewallPolicyRuleCollection
			err := ruleCollection.Initialize_From_FirewallPolicyRuleCollection_STATUS(&ruleCollectionItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_FirewallPolicyRuleCollection_STATUS() to populate field RuleCollections")
			}
			ruleCollectionList[ruleCollectionIndex] = ruleCollection
		}
		group.RuleCollections = ruleCollectionList
	} else {
		group.RuleCollections = nil
	}

	// No error
	return nil
}

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

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

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

	// Etag: A unique read-only string that changes whenever the resource is updated.
	Etag *string `json:"etag,omitempty"`

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

	// Name: The name of the resource that is unique within a resource group. This name can be used to access the resource.
	Name *string `json:"name,omitempty"`

	// Priority: Priority of the Firewall Policy Rule Collection Group resource.
	Priority *int `json:"priority,omitempty"`

	// ProvisioningState: The provisioning state of the firewall policy rule collection group resource.
	ProvisioningState *ProvisioningState_STATUS `json:"provisioningState,omitempty"`

	// RuleCollections: Group of Firewall Policy rule collections.
	RuleCollections []FirewallPolicyRuleCollection_STATUS `json:"ruleCollections,omitempty"`

	// Size: A read-only string that represents the size of the FirewallPolicyRuleCollectionGroupProperties in MB. (ex 1.2MB)
	Size *string `json:"size,omitempty"`

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

var _ genruntime.ConvertibleStatus = &FirewallPoliciesRuleCollectionGroup_STATUS{}

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

	// Convert to an intermediate form
	src = &storage.FirewallPoliciesRuleCollectionGroup_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_FirewallPoliciesRuleCollectionGroup_STATUS(src)
	if err != nil {
		return eris.Wrap(err, "final step of conversion in ConvertStatusFrom()")
	}

	return nil
}

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

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

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

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

	// no assignment for property "Conditions"

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

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

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

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

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

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

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

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

	// No error
	return nil
}

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

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

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

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

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

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

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

	// RuleCollections
	if source.RuleCollections != nil {
		ruleCollectionList := make([]FirewallPolicyRuleCollection_STATUS, len(source.RuleCollections))
		for ruleCollectionIndex, ruleCollectionItem := range source.RuleCollections {
			var ruleCollection FirewallPolicyRuleCollection_STATUS
			err := ruleCollection.AssignProperties_From_FirewallPolicyRuleCollection_STATUS(&ruleCollectionItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_FirewallPolicyRuleCollection_STATUS() to populate field RuleCollections")
			}
			ruleCollectionList[ruleCollectionIndex] = ruleCollection
		}
		group.RuleCollections = ruleCollectionList
	} else {
		group.RuleCollections = nil
	}

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

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

	// No error
	return nil
}

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

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

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

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

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

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

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

	// RuleCollections
	if group.RuleCollections != nil {
		ruleCollectionList := make([]storage.FirewallPolicyRuleCollection_STATUS, len(group.RuleCollections))
		for ruleCollectionIndex, ruleCollectionItem := range group.RuleCollections {
			var ruleCollection storage.FirewallPolicyRuleCollection_STATUS
			err := ruleCollectionItem.AssignProperties_To_FirewallPolicyRuleCollection_STATUS(&ruleCollection)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_FirewallPolicyRuleCollection_STATUS() to populate field RuleCollections")
			}
			ruleCollectionList[ruleCollectionIndex] = ruleCollection
		}
		destination.RuleCollections = ruleCollectionList
	} else {
		destination.RuleCollections = nil
	}

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

	// 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 FirewallPoliciesRuleCollectionGroupOperatorSpec 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_FirewallPoliciesRuleCollectionGroupOperatorSpec populates our FirewallPoliciesRuleCollectionGroupOperatorSpec from the provided source FirewallPoliciesRuleCollectionGroupOperatorSpec
func (operator *FirewallPoliciesRuleCollectionGroupOperatorSpec) AssignProperties_From_FirewallPoliciesRuleCollectionGroupOperatorSpec(source *storage.FirewallPoliciesRuleCollectionGroupOperatorSpec) 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_FirewallPoliciesRuleCollectionGroupOperatorSpec populates the provided destination FirewallPoliciesRuleCollectionGroupOperatorSpec from our FirewallPoliciesRuleCollectionGroupOperatorSpec
func (operator *FirewallPoliciesRuleCollectionGroupOperatorSpec) AssignProperties_To_FirewallPoliciesRuleCollectionGroupOperatorSpec(destination *storage.FirewallPoliciesRuleCollectionGroupOperatorSpec) 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 FirewallPolicyRuleCollection struct {
	// FirewallPolicyFilter: Mutually exclusive with all other properties
	FirewallPolicyFilter *FirewallPolicyFilterRuleCollection `json:"firewallPolicyFilterRuleCollection,omitempty"`

	// FirewallPolicyNat: Mutually exclusive with all other properties
	FirewallPolicyNat *FirewallPolicyNatRuleCollection `json:"firewallPolicyNatRuleCollection,omitempty"`
}

var _ genruntime.ARMTransformer = &FirewallPolicyRuleCollection{}

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

	// Set property "FirewallPolicyFilter":
	if collection.FirewallPolicyFilter != nil {
		firewallPolicyFilter_ARM, err := collection.FirewallPolicyFilter.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		firewallPolicyFilter := *firewallPolicyFilter_ARM.(*arm.FirewallPolicyFilterRuleCollection)
		result.FirewallPolicyFilter = &firewallPolicyFilter
	}

	// Set property "FirewallPolicyNat":
	if collection.FirewallPolicyNat != nil {
		firewallPolicyNat_ARM, err := collection.FirewallPolicyNat.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		firewallPolicyNat := *firewallPolicyNat_ARM.(*arm.FirewallPolicyNatRuleCollection)
		result.FirewallPolicyNat = &firewallPolicyNat
	}
	return result, nil
}

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

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

	// Set property "FirewallPolicyFilter":
	if typedInput.FirewallPolicyFilter != nil {
		var firewallPolicyFilter1 FirewallPolicyFilterRuleCollection
		err := firewallPolicyFilter1.PopulateFromARM(owner, *typedInput.FirewallPolicyFilter)
		if err != nil {
			return err
		}
		firewallPolicyFilter := firewallPolicyFilter1
		collection.FirewallPolicyFilter = &firewallPolicyFilter
	}

	// Set property "FirewallPolicyNat":
	if typedInput.FirewallPolicyNat != nil {
		var firewallPolicyNat1 FirewallPolicyNatRuleCollection
		err := firewallPolicyNat1.PopulateFromARM(owner, *typedInput.FirewallPolicyNat)
		if err != nil {
			return err
		}
		firewallPolicyNat := firewallPolicyNat1
		collection.FirewallPolicyNat = &firewallPolicyNat
	}

	// No error
	return nil
}

// AssignProperties_From_FirewallPolicyRuleCollection populates our FirewallPolicyRuleCollection from the provided source FirewallPolicyRuleCollection
func (collection *FirewallPolicyRuleCollection) AssignProperties_From_FirewallPolicyRuleCollection(source *storage.FirewallPolicyRuleCollection) error {

	// FirewallPolicyFilter
	if source.FirewallPolicyFilter != nil {
		var firewallPolicyFilter FirewallPolicyFilterRuleCollection
		err := firewallPolicyFilter.AssignProperties_From_FirewallPolicyFilterRuleCollection(source.FirewallPolicyFilter)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_FirewallPolicyFilterRuleCollection() to populate field FirewallPolicyFilter")
		}
		collection.FirewallPolicyFilter = &firewallPolicyFilter
	} else {
		collection.FirewallPolicyFilter = nil
	}

	// FirewallPolicyNat
	if source.FirewallPolicyNat != nil {
		var firewallPolicyNat FirewallPolicyNatRuleCollection
		err := firewallPolicyNat.AssignProperties_From_FirewallPolicyNatRuleCollection(source.FirewallPolicyNat)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_FirewallPolicyNatRuleCollection() to populate field FirewallPolicyNat")
		}
		collection.FirewallPolicyNat = &firewallPolicyNat
	} else {
		collection.FirewallPolicyNat = nil
	}

	// No error
	return nil
}

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

	// FirewallPolicyFilter
	if collection.FirewallPolicyFilter != nil {
		var firewallPolicyFilter storage.FirewallPolicyFilterRuleCollection
		err := collection.FirewallPolicyFilter.AssignProperties_To_FirewallPolicyFilterRuleCollection(&firewallPolicyFilter)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_FirewallPolicyFilterRuleCollection() to populate field FirewallPolicyFilter")
		}
		destination.FirewallPolicyFilter = &firewallPolicyFilter
	} else {
		destination.FirewallPolicyFilter = nil
	}

	// FirewallPolicyNat
	if collection.FirewallPolicyNat != nil {
		var firewallPolicyNat storage.FirewallPolicyNatRuleCollection
		err := collection.FirewallPolicyNat.AssignProperties_To_FirewallPolicyNatRuleCollection(&firewallPolicyNat)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_FirewallPolicyNatRuleCollection() to populate field FirewallPolicyNat")
		}
		destination.FirewallPolicyNat = &firewallPolicyNat
	} else {
		destination.FirewallPolicyNat = nil
	}

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

	// No error
	return nil
}

// Initialize_From_FirewallPolicyRuleCollection_STATUS populates our FirewallPolicyRuleCollection from the provided source FirewallPolicyRuleCollection_STATUS
func (collection *FirewallPolicyRuleCollection) Initialize_From_FirewallPolicyRuleCollection_STATUS(source *FirewallPolicyRuleCollection_STATUS) error {

	// FirewallPolicyFilter
	if source.FirewallPolicyFilter != nil {
		var firewallPolicyFilter FirewallPolicyFilterRuleCollection
		err := firewallPolicyFilter.Initialize_From_FirewallPolicyFilterRuleCollection_STATUS(source.FirewallPolicyFilter)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_FirewallPolicyFilterRuleCollection_STATUS() to populate field FirewallPolicyFilter")
		}
		collection.FirewallPolicyFilter = &firewallPolicyFilter
	} else {
		collection.FirewallPolicyFilter = nil
	}

	// FirewallPolicyNat
	if source.FirewallPolicyNat != nil {
		var firewallPolicyNat FirewallPolicyNatRuleCollection
		err := firewallPolicyNat.Initialize_From_FirewallPolicyNatRuleCollection_STATUS(source.FirewallPolicyNat)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_FirewallPolicyNatRuleCollection_STATUS() to populate field FirewallPolicyNat")
		}
		collection.FirewallPolicyNat = &firewallPolicyNat
	} else {
		collection.FirewallPolicyNat = nil
	}

	// No error
	return nil
}

type FirewallPolicyRuleCollection_STATUS struct {
	// FirewallPolicyFilter: Mutually exclusive with all other properties
	FirewallPolicyFilter *FirewallPolicyFilterRuleCollection_STATUS `json:"firewallPolicyFilterRuleCollection,omitempty"`

	// FirewallPolicyNat: Mutually exclusive with all other properties
	FirewallPolicyNat *FirewallPolicyNatRuleCollection_STATUS `json:"firewallPolicyNatRuleCollection,omitempty"`
}

var _ genruntime.FromARMConverter = &FirewallPolicyRuleCollection_STATUS{}

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

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

	// Set property "FirewallPolicyFilter":
	if typedInput.FirewallPolicyFilter != nil {
		var firewallPolicyFilter1 FirewallPolicyFilterRuleCollection_STATUS
		err := firewallPolicyFilter1.PopulateFromARM(owner, *typedInput.FirewallPolicyFilter)
		if err != nil {
			return err
		}
		firewallPolicyFilter := firewallPolicyFilter1
		collection.FirewallPolicyFilter = &firewallPolicyFilter
	}

	// Set property "FirewallPolicyNat":
	if typedInput.FirewallPolicyNat != nil {
		var firewallPolicyNat1 FirewallPolicyNatRuleCollection_STATUS
		err := firewallPolicyNat1.PopulateFromARM(owner, *typedInput.FirewallPolicyNat)
		if err != nil {
			return err
		}
		firewallPolicyNat := firewallPolicyNat1
		collection.FirewallPolicyNat = &firewallPolicyNat
	}

	// No error
	return nil
}

// AssignProperties_From_FirewallPolicyRuleCollection_STATUS populates our FirewallPolicyRuleCollection_STATUS from the provided source FirewallPolicyRuleCollection_STATUS
func (collection *FirewallPolicyRuleCollection_STATUS) AssignProperties_From_FirewallPolicyRuleCollection_STATUS(source *storage.FirewallPolicyRuleCollection_STATUS) error {

	// FirewallPolicyFilter
	if source.FirewallPolicyFilter != nil {
		var firewallPolicyFilter FirewallPolicyFilterRuleCollection_STATUS
		err := firewallPolicyFilter.AssignProperties_From_FirewallPolicyFilterRuleCollection_STATUS(source.FirewallPolicyFilter)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_FirewallPolicyFilterRuleCollection_STATUS() to populate field FirewallPolicyFilter")
		}
		collection.FirewallPolicyFilter = &firewallPolicyFilter
	} else {
		collection.FirewallPolicyFilter = nil
	}

	// FirewallPolicyNat
	if source.FirewallPolicyNat != nil {
		var firewallPolicyNat FirewallPolicyNatRuleCollection_STATUS
		err := firewallPolicyNat.AssignProperties_From_FirewallPolicyNatRuleCollection_STATUS(source.FirewallPolicyNat)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_FirewallPolicyNatRuleCollection_STATUS() to populate field FirewallPolicyNat")
		}
		collection.FirewallPolicyNat = &firewallPolicyNat
	} else {
		collection.FirewallPolicyNat = nil
	}

	// No error
	return nil
}

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

	// FirewallPolicyFilter
	if collection.FirewallPolicyFilter != nil {
		var firewallPolicyFilter storage.FirewallPolicyFilterRuleCollection_STATUS
		err := collection.FirewallPolicyFilter.AssignProperties_To_FirewallPolicyFilterRuleCollection_STATUS(&firewallPolicyFilter)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_FirewallPolicyFilterRuleCollection_STATUS() to populate field FirewallPolicyFilter")
		}
		destination.FirewallPolicyFilter = &firewallPolicyFilter
	} else {
		destination.FirewallPolicyFilter = nil
	}

	// FirewallPolicyNat
	if collection.FirewallPolicyNat != nil {
		var firewallPolicyNat storage.FirewallPolicyNatRuleCollection_STATUS
		err := collection.FirewallPolicyNat.AssignProperties_To_FirewallPolicyNatRuleCollection_STATUS(&firewallPolicyNat)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_FirewallPolicyNatRuleCollection_STATUS() to populate field FirewallPolicyNat")
		}
		destination.FirewallPolicyNat = &firewallPolicyNat
	} else {
		destination.FirewallPolicyNat = nil
	}

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

	// No error
	return nil
}

type FirewallPolicyFilterRuleCollection struct {
	// Action: The action type of a Filter rule collection.
	Action *FirewallPolicyFilterRuleCollectionAction `json:"action,omitempty"`

	// Name: The name of the rule collection.
	Name *string `json:"name,omitempty"`

	// +kubebuilder:validation:Maximum=65000
	// +kubebuilder:validation:Minimum=100
	// Priority: Priority of the Firewall Policy Rule Collection resource.
	Priority *int `json:"priority,omitempty"`

	// +kubebuilder:validation:Required
	// RuleCollectionType: The type of the rule collection.
	RuleCollectionType *FirewallPolicyFilterRuleCollection_RuleCollectionType `json:"ruleCollectionType,omitempty"`

	// Rules: List of rules included in a rule collection.
	Rules []FirewallPolicyRule `json:"rules,omitempty"`
}

var _ genruntime.ARMTransformer = &FirewallPolicyFilterRuleCollection{}

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

	// Set property "Action":
	if collection.Action != nil {
		action_ARM, err := collection.Action.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		action := *action_ARM.(*arm.FirewallPolicyFilterRuleCollectionAction)
		result.Action = &action
	}

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

	// Set property "Priority":
	if collection.Priority != nil {
		priority := *collection.Priority
		result.Priority = &priority
	}

	// Set property "RuleCollectionType":
	if collection.RuleCollectionType != nil {
		var temp arm.FirewallPolicyFilterRuleCollection_RuleCollectionType
		var temp1 string
		temp1 = string(*collection.RuleCollectionType)
		temp = arm.FirewallPolicyFilterRuleCollection_RuleCollectionType(temp1)
		result.RuleCollectionType = temp
	}

	// Set property "Rules":
	for _, item := range collection.Rules {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Rules = append(result.Rules, *item_ARM.(*arm.FirewallPolicyRule))
	}
	return result, nil
}

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

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

	// Set property "Action":
	if typedInput.Action != nil {
		var action1 FirewallPolicyFilterRuleCollectionAction
		err := action1.PopulateFromARM(owner, *typedInput.Action)
		if err != nil {
			return err
		}
		action := action1
		collection.Action = &action
	}

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

	// Set property "Priority":
	if typedInput.Priority != nil {
		priority := *typedInput.Priority
		collection.Priority = &priority
	}

	// Set property "RuleCollectionType":
	var temp FirewallPolicyFilterRuleCollection_RuleCollectionType
	var temp1 string
	temp1 = string(typedInput.RuleCollectionType)
	temp = FirewallPolicyFilterRuleCollection_RuleCollectionType(temp1)
	collection.RuleCollectionType = &temp

	// Set property "Rules":
	for _, item := range typedInput.Rules {
		var item1 FirewallPolicyRule
		err := item1.PopulateFromARM(owner, item)
		if err != nil {
			return err
		}
		collection.Rules = append(collection.Rules, item1)
	}

	// No error
	return nil
}

// AssignProperties_From_FirewallPolicyFilterRuleCollection populates our FirewallPolicyFilterRuleCollection from the provided source FirewallPolicyFilterRuleCollection
func (collection *FirewallPolicyFilterRuleCollection) AssignProperties_From_FirewallPolicyFilterRuleCollection(source *storage.FirewallPolicyFilterRuleCollection) error {

	// Action
	if source.Action != nil {
		var action FirewallPolicyFilterRuleCollectionAction
		err := action.AssignProperties_From_FirewallPolicyFilterRuleCollectionAction(source.Action)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_FirewallPolicyFilterRuleCollectionAction() to populate field Action")
		}
		collection.Action = &action
	} else {
		collection.Action = nil
	}

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

	// Priority
	collection.Priority = genruntime.ClonePointerToInt(source.Priority)

	// RuleCollectionType
	if source.RuleCollectionType != nil {
		ruleCollectionType := *source.RuleCollectionType
		ruleCollectionTypeTemp := genruntime.ToEnum(ruleCollectionType, firewallPolicyFilterRuleCollection_RuleCollectionType_Values)
		collection.RuleCollectionType = &ruleCollectionTypeTemp
	} else {
		collection.RuleCollectionType = nil
	}

	// Rules
	if source.Rules != nil {
		ruleList := make([]FirewallPolicyRule, len(source.Rules))
		for ruleIndex, ruleItem := range source.Rules {
			var rule FirewallPolicyRule
			err := rule.AssignProperties_From_FirewallPolicyRule(&ruleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_FirewallPolicyRule() to populate field Rules")
			}
			ruleList[ruleIndex] = rule
		}
		collection.Rules = ruleList
	} else {
		collection.Rules = nil
	}

	// No error
	return nil
}

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

	// Action
	if collection.Action != nil {
		var action storage.FirewallPolicyFilterRuleCollectionAction
		err := collection.Action.AssignProperties_To_FirewallPolicyFilterRuleCollectionAction(&action)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_FirewallPolicyFilterRuleCollectionAction() to populate field Action")
		}
		destination.Action = &action
	} else {
		destination.Action = nil
	}

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

	// Priority
	destination.Priority = genruntime.ClonePointerToInt(collection.Priority)

	// RuleCollectionType
	if collection.RuleCollectionType != nil {
		ruleCollectionType := string(*collection.RuleCollectionType)
		destination.RuleCollectionType = &ruleCollectionType
	} else {
		destination.RuleCollectionType = nil
	}

	// Rules
	if collection.Rules != nil {
		ruleList := make([]storage.FirewallPolicyRule, len(collection.Rules))
		for ruleIndex, ruleItem := range collection.Rules {
			var rule storage.FirewallPolicyRule
			err := ruleItem.AssignProperties_To_FirewallPolicyRule(&rule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_FirewallPolicyRule() to populate field Rules")
			}
			ruleList[ruleIndex] = rule
		}
		destination.Rules = ruleList
	} else {
		destination.Rules = nil
	}

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

	// No error
	return nil
}

// Initialize_From_FirewallPolicyFilterRuleCollection_STATUS populates our FirewallPolicyFilterRuleCollection from the provided source FirewallPolicyFilterRuleCollection_STATUS
func (collection *FirewallPolicyFilterRuleCollection) Initialize_From_FirewallPolicyFilterRuleCollection_STATUS(source *FirewallPolicyFilterRuleCollection_STATUS) error {

	// Action
	if source.Action != nil {
		var action FirewallPolicyFilterRuleCollectionAction
		err := action.Initialize_From_FirewallPolicyFilterRuleCollectionAction_STATUS(source.Action)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_FirewallPolicyFilterRuleCollectionAction_STATUS() to populate field Action")
		}
		collection.Action = &action
	} else {
		collection.Action = nil
	}

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

	// Priority
	collection.Priority = genruntime.ClonePointerToInt(source.Priority)

	// RuleCollectionType
	if source.RuleCollectionType != nil {
		ruleCollectionType := genruntime.ToEnum(string(*source.RuleCollectionType), firewallPolicyFilterRuleCollection_RuleCollectionType_Values)
		collection.RuleCollectionType = &ruleCollectionType
	} else {
		collection.RuleCollectionType = nil
	}

	// Rules
	if source.Rules != nil {
		ruleList := make([]FirewallPolicyRule, len(source.Rules))
		for ruleIndex, ruleItem := range source.Rules {
			var rule FirewallPolicyRule
			err := rule.Initialize_From_FirewallPolicyRule_STATUS(&ruleItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_FirewallPolicyRule_STATUS() to populate field Rules")
			}
			ruleList[ruleIndex] = rule
		}
		collection.Rules = ruleList
	} else {
		collection.Rules = nil
	}

	// No error
	return nil
}

type FirewallPolicyFilterRuleCollection_STATUS struct {
	// Action: The action type of a Filter rule collection.
	Action *FirewallPolicyFilterRuleCollectionAction_STATUS `json:"action,omitempty"`

	// Name: The name of the rule collection.
	Name *string `json:"name,omitempty"`

	// Priority: Priority of the Firewall Policy Rule Collection resource.
	Priority *int `json:"priority,omitempty"`

	// RuleCollectionType: The type of the rule collection.
	RuleCollectionType *FirewallPolicyFilterRuleCollection_RuleCollectionType_STATUS `json:"ruleCollectionType,omitempty"`

	// Rules: List of rules included in a rule collection.
	Rules []FirewallPolicyRule_STATUS `json:"rules,omitempty"`
}

var _ genruntime.FromARMConverter = &FirewallPolicyFilterRuleCollection_STATUS{}

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

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

	// Set property "Action":
	if typedInput.Action != nil {
		var action1 FirewallPolicyFilterRuleCollectionAction_STATUS
		err := action1.PopulateFromARM(owner, *typedInput.Action)
		if err != nil {
			return err
		}
		action := action1
		collection.Action = &action
	}

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

	// Set property "Priority":
	if typedInput.Priority != nil {
		priority := *typedInput.Priority
		collection.Priority = &priority
	}

	// Set property "RuleCollectionType":
	var temp FirewallPolicyFilterRuleCollection_RuleCollectionType_STATUS
	var temp1 string
	temp1 = string(typedInput.RuleCollectionType)
	temp = FirewallPolicyFilterRuleCollection_RuleCollectionType_STATUS(temp1)
	collection.RuleCollectionType = &temp

	// Set property "Rules":
	for _, item := range typedInput.Rules {
		var item1 FirewallPolicyRule_STATUS
		err := item1.PopulateFromARM(owner, item)
		if err != nil {
			return err
		}
		collection.Rules = append(collection.Rules, item1)
	}

	// No error
	return nil
}

// AssignProperties_From_FirewallPolicyFilterRuleCollection_STATUS populates our FirewallPolicyFilterRuleCollection_STATUS from the provided source FirewallPolicyFilterRuleCollection_STATUS
func (collection *FirewallPolicyFilterRuleCollection_STATUS) AssignProperties_From_FirewallPolicyFilterRuleCollection_STATUS(source *storage.FirewallPolicyFilterRuleCollection_STATUS) error {

	// Action
	if source.Action != nil {
		var action FirewallPolicyFilterRuleCollectionAction_STATUS
		err := action.AssignProperties_From_FirewallPolicyFilterRuleCollectionAction_STATUS(source.Action)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_FirewallPolicyFilterRuleCollectionAction_STATUS() to populate field Action")
		}
		collection.Action = &action
	} else {
		collection.Action = nil
	}

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

	// Priority
	collection.Priority = genruntime.ClonePointerToInt(source.Priority)

	// RuleCollectionType
	if source.RuleCollectionType != nil {
		ruleCollectionType := *source.RuleCollectionType
		ruleCollectionTypeTemp := genruntime.ToEnum(ruleCollectionType, firewallPolicyFilterRuleCollection_RuleCollectionType_STATUS_Values)
		collection.RuleCollectionType = &ruleCollectionTypeTemp
	} else {
		collection.RuleCollectionType = nil
	}

	// Rules
	if source.Rules != nil {
		ruleList := make([]FirewallPolicyRule_STATUS, len(source.Rules))
		for ruleIndex, ruleItem := range source.Rules {
			var rule FirewallPolicyRule_STATUS
			err := rule.AssignProperties_From_FirewallPolicyRule_STATUS(&ruleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_FirewallPolicyRule_STATUS() to populate field Rules")
			}
			ruleList[ruleIndex] = rule
		}
		collection.Rules = ruleList
	} else {
		collection.Rules = nil
	}

	// No error
	return nil
}

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

	// Action
	if collection.Action != nil {
		var action storage.FirewallPolicyFilterRuleCollectionAction_STATUS
		err := collection.Action.AssignProperties_To_FirewallPolicyFilterRuleCollectionAction_STATUS(&action)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_FirewallPolicyFilterRuleCollectionAction_STATUS() to populate field Action")
		}
		destination.Action = &action
	} else {
		destination.Action = nil
	}

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

	// Priority
	destination.Priority = genruntime.ClonePointerToInt(collection.Priority)

	// RuleCollectionType
	if collection.RuleCollectionType != nil {
		ruleCollectionType := string(*collection.RuleCollectionType)
		destination.RuleCollectionType = &ruleCollectionType
	} else {
		destination.RuleCollectionType = nil
	}

	// Rules
	if collection.Rules != nil {
		ruleList := make([]storage.FirewallPolicyRule_STATUS, len(collection.Rules))
		for ruleIndex, ruleItem := range collection.Rules {
			var rule storage.FirewallPolicyRule_STATUS
			err := ruleItem.AssignProperties_To_FirewallPolicyRule_STATUS(&rule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_FirewallPolicyRule_STATUS() to populate field Rules")
			}
			ruleList[ruleIndex] = rule
		}
		destination.Rules = ruleList
	} else {
		destination.Rules = nil
	}

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

	// No error
	return nil
}

type FirewallPolicyNatRuleCollection struct {
	// Action: The action type of a Nat rule collection.
	Action *FirewallPolicyNatRuleCollectionAction `json:"action,omitempty"`

	// Name: The name of the rule collection.
	Name *string `json:"name,omitempty"`

	// +kubebuilder:validation:Maximum=65000
	// +kubebuilder:validation:Minimum=100
	// Priority: Priority of the Firewall Policy Rule Collection resource.
	Priority *int `json:"priority,omitempty"`

	// +kubebuilder:validation:Required
	// RuleCollectionType: The type of the rule collection.
	RuleCollectionType *FirewallPolicyNatRuleCollection_RuleCollectionType `json:"ruleCollectionType,omitempty"`

	// Rules: List of rules included in a rule collection.
	Rules []FirewallPolicyRule `json:"rules,omitempty"`
}

var _ genruntime.ARMTransformer = &FirewallPolicyNatRuleCollection{}

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

	// Set property "Action":
	if collection.Action != nil {
		action_ARM, err := collection.Action.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		action := *action_ARM.(*arm.FirewallPolicyNatRuleCollectionAction)
		result.Action = &action
	}

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

	// Set property "Priority":
	if collection.Priority != nil {
		priority := *collection.Priority
		result.Priority = &priority
	}

	// Set property "RuleCollectionType":
	if collection.RuleCollectionType != nil {
		var temp arm.FirewallPolicyNatRuleCollection_RuleCollectionType
		var temp1 string
		temp1 = string(*collection.RuleCollectionType)
		temp = arm.FirewallPolicyNatRuleCollection_RuleCollectionType(temp1)
		result.RuleCollectionType = temp
	}

	// Set property "Rules":
	for _, item := range collection.Rules {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Rules = append(result.Rules, *item_ARM.(*arm.FirewallPolicyRule))
	}
	return result, nil
}

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

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

	// Set property "Action":
	if typedInput.Action != nil {
		var action1 FirewallPolicyNatRuleCollectionAction
		err := action1.PopulateFromARM(owner, *typedInput.Action)
		if err != nil {
			return err
		}
		action := action1
		collection.Action = &action
	}

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

	// Set property "Priority":
	if typedInput.Priority != nil {
		priority := *typedInput.Priority
		collection.Priority = &priority
	}

	// Set property "RuleCollectionType":
	var temp FirewallPolicyNatRuleCollection_RuleCollectionType
	var temp1 string
	temp1 = string(typedInput.RuleCollectionType)
	temp = FirewallPolicyNatRuleCollection_RuleCollectionType(temp1)
	collection.RuleCollectionType = &temp

	// Set property "Rules":
	for _, item := range typedInput.Rules {
		var item1 FirewallPolicyRule
		err := item1.PopulateFromARM(owner, item)
		if err != nil {
			return err
		}
		collection.Rules = append(collection.Rules, item1)
	}

	// No error
	return nil
}

// AssignProperties_From_FirewallPolicyNatRuleCollection populates our FirewallPolicyNatRuleCollection from the provided source FirewallPolicyNatRuleCollection
func (collection *FirewallPolicyNatRuleCollection) AssignProperties_From_FirewallPolicyNatRuleCollection(source *storage.FirewallPolicyNatRuleCollection) error {

	// Action
	if source.Action != nil {
		var action FirewallPolicyNatRuleCollectionAction
		err := action.AssignProperties_From_FirewallPolicyNatRuleCollectionAction(source.Action)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_FirewallPolicyNatRuleCollectionAction() to populate field Action")
		}
		collection.Action = &action
	} else {
		collection.Action = nil
	}

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

	// Priority
	collection.Priority = genruntime.ClonePointerToInt(source.Priority)

	// RuleCollectionType
	if source.RuleCollectionType != nil {
		ruleCollectionType := *source.RuleCollectionType
		ruleCollectionTypeTemp := genruntime.ToEnum(ruleCollectionType, firewallPolicyNatRuleCollection_RuleCollectionType_Values)
		collection.RuleCollectionType = &ruleCollectionTypeTemp
	} else {
		collection.RuleCollectionType = nil
	}

	// Rules
	if source.Rules != nil {
		ruleList := make([]FirewallPolicyRule, len(source.Rules))
		for ruleIndex, ruleItem := range source.Rules {
			var rule FirewallPolicyRule
			err := rule.AssignProperties_From_FirewallPolicyRule(&ruleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_FirewallPolicyRule() to populate field Rules")
			}
			ruleList[ruleIndex] = rule
		}
		collection.Rules = ruleList
	} else {
		collection.Rules = nil
	}

	// No error
	return nil
}

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

	// Action
	if collection.Action != nil {
		var action storage.FirewallPolicyNatRuleCollectionAction
		err := collection.Action.AssignProperties_To_FirewallPolicyNatRuleCollectionAction(&action)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_FirewallPolicyNatRuleCollectionAction() to populate field Action")
		}
		destination.Action = &action
	} else {
		destination.Action = nil
	}

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

	// Priority
	destination.Priority = genruntime.ClonePointerToInt(collection.Priority)

	// RuleCollectionType
	if collection.RuleCollectionType != nil {
		ruleCollectionType := string(*collection.RuleCollectionType)
		destination.RuleCollectionType = &ruleCollectionType
	} else {
		destination.RuleCollectionType = nil
	}

	// Rules
	if collection.Rules != nil {
		ruleList := make([]storage.FirewallPolicyRule, len(collection.Rules))
		for ruleIndex, ruleItem := range collection.Rules {
			var rule storage.FirewallPolicyRule
			err := ruleItem.AssignProperties_To_FirewallPolicyRule(&rule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_FirewallPolicyRule() to populate field Rules")
			}
			ruleList[ruleIndex] = rule
		}
		destination.Rules = ruleList
	} else {
		destination.Rules = nil
	}

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

	// No error
	return nil
}

// Initialize_From_FirewallPolicyNatRuleCollection_STATUS populates our FirewallPolicyNatRuleCollection from the provided source FirewallPolicyNatRuleCollection_STATUS
func (collection *FirewallPolicyNatRuleCollection) Initialize_From_FirewallPolicyNatRuleCollection_STATUS(source *FirewallPolicyNatRuleCollection_STATUS) error {

	// Action
	if source.Action != nil {
		var action FirewallPolicyNatRuleCollectionAction
		err := action.Initialize_From_FirewallPolicyNatRuleCollectionAction_STATUS(source.Action)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_FirewallPolicyNatRuleCollectionAction_STATUS() to populate field Action")
		}
		collection.Action = &action
	} else {
		collection.Action = nil
	}

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

	// Priority
	collection.Priority = genruntime.ClonePointerToInt(source.Priority)

	// RuleCollectionType
	if source.RuleCollectionType != nil {
		ruleCollectionType := genruntime.ToEnum(string(*source.RuleCollectionType), firewallPolicyNatRuleCollection_RuleCollectionType_Values)
		collection.RuleCollectionType = &ruleCollectionType
	} else {
		collection.RuleCollectionType = nil
	}

	// Rules
	if source.Rules != nil {
		ruleList := make([]FirewallPolicyRule, len(source.Rules))
		for ruleIndex, ruleItem := range source.Rules {
			var rule FirewallPolicyRule
			err := rule.Initialize_From_FirewallPolicyRule_STATUS(&ruleItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_FirewallPolicyRule_STATUS() to populate field Rules")
			}
			ruleList[ruleIndex] = rule
		}
		collection.Rules = ruleList
	} else {
		collection.Rules = nil
	}

	// No error
	return nil
}

type FirewallPolicyNatRuleCollection_STATUS struct {
	// Action: The action type of a Nat rule collection.
	Action *FirewallPolicyNatRuleCollectionAction_STATUS `json:"action,omitempty"`

	// Name: The name of the rule collection.
	Name *string `json:"name,omitempty"`

	// Priority: Priority of the Firewall Policy Rule Collection resource.
	Priority *int `json:"priority,omitempty"`

	// RuleCollectionType: The type of the rule collection.
	RuleCollectionType *FirewallPolicyNatRuleCollection_RuleCollectionType_STATUS `json:"ruleCollectionType,omitempty"`

	// Rules: List of rules included in a rule collection.
	Rules []FirewallPolicyRule_STATUS `json:"rules,omitempty"`
}

var _ genruntime.FromARMConverter = &FirewallPolicyNatRuleCollection_STATUS{}

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

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

	// Set property "Action":
	if typedInput.Action != nil {
		var action1 FirewallPolicyNatRuleCollectionAction_STATUS
		err := action1.PopulateFromARM(owner, *typedInput.Action)
		if err != nil {
			return err
		}
		action := action1
		collection.Action = &action
	}

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

	// Set property "Priority":
	if typedInput.Priority != nil {
		priority := *typedInput.Priority
		collection.Priority = &priority
	}

	// Set property "RuleCollectionType":
	var temp FirewallPolicyNatRuleCollection_RuleCollectionType_STATUS
	var temp1 string
	temp1 = string(typedInput.RuleCollectionType)
	temp = FirewallPolicyNatRuleCollection_RuleCollectionType_STATUS(temp1)
	collection.RuleCollectionType = &temp

	// Set property "Rules":
	for _, item := range typedInput.Rules {
		var item1 FirewallPolicyRule_STATUS
		err := item1.PopulateFromARM(owner, item)
		if err != nil {
			return err
		}
		collection.Rules = append(collection.Rules, item1)
	}

	// No error
	return nil
}

// AssignProperties_From_FirewallPolicyNatRuleCollection_STATUS populates our FirewallPolicyNatRuleCollection_STATUS from the provided source FirewallPolicyNatRuleCollection_STATUS
func (collection *FirewallPolicyNatRuleCollection_STATUS) AssignProperties_From_FirewallPolicyNatRuleCollection_STATUS(source *storage.FirewallPolicyNatRuleCollection_STATUS) error {

	// Action
	if source.Action != nil {
		var action FirewallPolicyNatRuleCollectionAction_STATUS
		err := action.AssignProperties_From_FirewallPolicyNatRuleCollectionAction_STATUS(source.Action)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_FirewallPolicyNatRuleCollectionAction_STATUS() to populate field Action")
		}
		collection.Action = &action
	} else {
		collection.Action = nil
	}

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

	// Priority
	collection.Priority = genruntime.ClonePointerToInt(source.Priority)

	// RuleCollectionType
	if source.RuleCollectionType != nil {
		ruleCollectionType := *source.RuleCollectionType
		ruleCollectionTypeTemp := genruntime.ToEnum(ruleCollectionType, firewallPolicyNatRuleCollection_RuleCollectionType_STATUS_Values)
		collection.RuleCollectionType = &ruleCollectionTypeTemp
	} else {
		collection.RuleCollectionType = nil
	}

	// Rules
	if source.Rules != nil {
		ruleList := make([]FirewallPolicyRule_STATUS, len(source.Rules))
		for ruleIndex, ruleItem := range source.Rules {
			var rule FirewallPolicyRule_STATUS
			err := rule.AssignProperties_From_FirewallPolicyRule_STATUS(&ruleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_FirewallPolicyRule_STATUS() to populate field Rules")
			}
			ruleList[ruleIndex] = rule
		}
		collection.Rules = ruleList
	} else {
		collection.Rules = nil
	}

	// No error
	return nil
}

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

	// Action
	if collection.Action != nil {
		var action storage.FirewallPolicyNatRuleCollectionAction_STATUS
		err := collection.Action.AssignProperties_To_FirewallPolicyNatRuleCollectionAction_STATUS(&action)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_FirewallPolicyNatRuleCollectionAction_STATUS() to populate field Action")
		}
		destination.Action = &action
	} else {
		destination.Action = nil
	}

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

	// Priority
	destination.Priority = genruntime.ClonePointerToInt(collection.Priority)

	// RuleCollectionType
	if collection.RuleCollectionType != nil {
		ruleCollectionType := string(*collection.RuleCollectionType)
		destination.RuleCollectionType = &ruleCollectionType
	} else {
		destination.RuleCollectionType = nil
	}

	// Rules
	if collection.Rules != nil {
		ruleList := make([]storage.FirewallPolicyRule_STATUS, len(collection.Rules))
		for ruleIndex, ruleItem := range collection.Rules {
			var rule storage.FirewallPolicyRule_STATUS
			err := ruleItem.AssignProperties_To_FirewallPolicyRule_STATUS(&rule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_FirewallPolicyRule_STATUS() to populate field Rules")
			}
			ruleList[ruleIndex] = rule
		}
		destination.Rules = ruleList
	} else {
		destination.Rules = nil
	}

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"FirewallPolicyFilterRuleCollection"}
type FirewallPolicyFilterRuleCollection_RuleCollectionType string

const FirewallPolicyFilterRuleCollection_RuleCollectionType_FirewallPolicyFilterRuleCollection = FirewallPolicyFilterRuleCollection_RuleCollectionType("FirewallPolicyFilterRuleCollection")

// Mapping from string to FirewallPolicyFilterRuleCollection_RuleCollectionType
var firewallPolicyFilterRuleCollection_RuleCollectionType_Values = map[string]FirewallPolicyFilterRuleCollection_RuleCollectionType{
	"firewallpolicyfilterrulecollection": FirewallPolicyFilterRuleCollection_RuleCollectionType_FirewallPolicyFilterRuleCollection,
}

type FirewallPolicyFilterRuleCollection_RuleCollectionType_STATUS string

const FirewallPolicyFilterRuleCollection_RuleCollectionType_STATUS_FirewallPolicyFilterRuleCollection = FirewallPolicyFilterRuleCollection_RuleCollectionType_STATUS("FirewallPolicyFilterRuleCollection")

// Mapping from string to FirewallPolicyFilterRuleCollection_RuleCollectionType_STATUS
var firewallPolicyFilterRuleCollection_RuleCollectionType_STATUS_Values = map[string]FirewallPolicyFilterRuleCollection_RuleCollectionType_STATUS{
	"firewallpolicyfilterrulecollection": FirewallPolicyFilterRuleCollection_RuleCollectionType_STATUS_FirewallPolicyFilterRuleCollection,
}

// Properties of the FirewallPolicyFilterRuleCollectionAction.
type FirewallPolicyFilterRuleCollectionAction struct {
	// Type: The type of action.
	Type *FirewallPolicyFilterRuleCollectionActionType `json:"type,omitempty"`
}

var _ genruntime.ARMTransformer = &FirewallPolicyFilterRuleCollectionAction{}

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

	// Set property "Type":
	if action.Type != nil {
		var temp string
		temp = string(*action.Type)
		typeVar := arm.FirewallPolicyFilterRuleCollectionActionType(temp)
		result.Type = &typeVar
	}
	return result, nil
}

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

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

	// Set property "Type":
	if typedInput.Type != nil {
		var temp string
		temp = string(*typedInput.Type)
		typeVar := FirewallPolicyFilterRuleCollectionActionType(temp)
		action.Type = &typeVar
	}

	// No error
	return nil
}

// AssignProperties_From_FirewallPolicyFilterRuleCollectionAction populates our FirewallPolicyFilterRuleCollectionAction from the provided source FirewallPolicyFilterRuleCollectionAction
func (action *FirewallPolicyFilterRuleCollectionAction) AssignProperties_From_FirewallPolicyFilterRuleCollectionAction(source *storage.FirewallPolicyFilterRuleCollectionAction) error {

	// Type
	if source.Type != nil {
		typeVar := *source.Type
		typeTemp := genruntime.ToEnum(typeVar, firewallPolicyFilterRuleCollectionActionType_Values)
		action.Type = &typeTemp
	} else {
		action.Type = nil
	}

	// No error
	return nil
}

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

	// Type
	if action.Type != nil {
		typeVar := string(*action.Type)
		destination.Type = &typeVar
	} else {
		destination.Type = nil
	}

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

	// No error
	return nil
}

// Initialize_From_FirewallPolicyFilterRuleCollectionAction_STATUS populates our FirewallPolicyFilterRuleCollectionAction from the provided source FirewallPolicyFilterRuleCollectionAction_STATUS
func (action *FirewallPolicyFilterRuleCollectionAction) Initialize_From_FirewallPolicyFilterRuleCollectionAction_STATUS(source *FirewallPolicyFilterRuleCollectionAction_STATUS) error {

	// Type
	if source.Type != nil {
		typeVar := genruntime.ToEnum(string(*source.Type), firewallPolicyFilterRuleCollectionActionType_Values)
		action.Type = &typeVar
	} else {
		action.Type = nil
	}

	// No error
	return nil
}

// Properties of the FirewallPolicyFilterRuleCollectionAction.
type FirewallPolicyFilterRuleCollectionAction_STATUS struct {
	// Type: The type of action.
	Type *FirewallPolicyFilterRuleCollectionActionType_STATUS `json:"type,omitempty"`
}

var _ genruntime.FromARMConverter = &FirewallPolicyFilterRuleCollectionAction_STATUS{}

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

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

	// Set property "Type":
	if typedInput.Type != nil {
		var temp string
		temp = string(*typedInput.Type)
		typeVar := FirewallPolicyFilterRuleCollectionActionType_STATUS(temp)
		action.Type = &typeVar
	}

	// No error
	return nil
}

// AssignProperties_From_FirewallPolicyFilterRuleCollectionAction_STATUS populates our FirewallPolicyFilterRuleCollectionAction_STATUS from the provided source FirewallPolicyFilterRuleCollectionAction_STATUS
func (action *FirewallPolicyFilterRuleCollectionAction_STATUS) AssignProperties_From_FirewallPolicyFilterRuleCollectionAction_STATUS(source *storage.FirewallPolicyFilterRuleCollectionAction_STATUS) error {

	// Type
	if source.Type != nil {
		typeVar := *source.Type
		typeTemp := genruntime.ToEnum(typeVar, firewallPolicyFilterRuleCollectionActionType_STATUS_Values)
		action.Type = &typeTemp
	} else {
		action.Type = nil
	}

	// No error
	return nil
}

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

	// Type
	if action.Type != nil {
		typeVar := string(*action.Type)
		destination.Type = &typeVar
	} else {
		destination.Type = nil
	}

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"FirewallPolicyNatRuleCollection"}
type FirewallPolicyNatRuleCollection_RuleCollectionType string

const FirewallPolicyNatRuleCollection_RuleCollectionType_FirewallPolicyNatRuleCollection = FirewallPolicyNatRuleCollection_RuleCollectionType("FirewallPolicyNatRuleCollection")

// Mapping from string to FirewallPolicyNatRuleCollection_RuleCollectionType
var firewallPolicyNatRuleCollection_RuleCollectionType_Values = map[string]FirewallPolicyNatRuleCollection_RuleCollectionType{
	"firewallpolicynatrulecollection": FirewallPolicyNatRuleCollection_RuleCollectionType_FirewallPolicyNatRuleCollection,
}

type FirewallPolicyNatRuleCollection_RuleCollectionType_STATUS string

const FirewallPolicyNatRuleCollection_RuleCollectionType_STATUS_FirewallPolicyNatRuleCollection = FirewallPolicyNatRuleCollection_RuleCollectionType_STATUS("FirewallPolicyNatRuleCollection")

// Mapping from string to FirewallPolicyNatRuleCollection_RuleCollectionType_STATUS
var firewallPolicyNatRuleCollection_RuleCollectionType_STATUS_Values = map[string]FirewallPolicyNatRuleCollection_RuleCollectionType_STATUS{
	"firewallpolicynatrulecollection": FirewallPolicyNatRuleCollection_RuleCollectionType_STATUS_FirewallPolicyNatRuleCollection,
}

// Properties of the FirewallPolicyNatRuleCollectionAction.
type FirewallPolicyNatRuleCollectionAction struct {
	// Type: The type of action.
	Type *FirewallPolicyNatRuleCollectionActionType `json:"type,omitempty"`
}

var _ genruntime.ARMTransformer = &FirewallPolicyNatRuleCollectionAction{}

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

	// Set property "Type":
	if action.Type != nil {
		var temp string
		temp = string(*action.Type)
		typeVar := arm.FirewallPolicyNatRuleCollectionActionType(temp)
		result.Type = &typeVar
	}
	return result, nil
}

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

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

	// Set property "Type":
	if typedInput.Type != nil {
		var temp string
		temp = string(*typedInput.Type)
		typeVar := FirewallPolicyNatRuleCollectionActionType(temp)
		action.Type = &typeVar
	}

	// No error
	return nil
}

// AssignProperties_From_FirewallPolicyNatRuleCollectionAction populates our FirewallPolicyNatRuleCollectionAction from the provided source FirewallPolicyNatRuleCollectionAction
func (action *FirewallPolicyNatRuleCollectionAction) AssignProperties_From_FirewallPolicyNatRuleCollectionAction(source *storage.FirewallPolicyNatRuleCollectionAction) error {

	// Type
	if source.Type != nil {
		typeVar := *source.Type
		typeTemp := genruntime.ToEnum(typeVar, firewallPolicyNatRuleCollectionActionType_Values)
		action.Type = &typeTemp
	} else {
		action.Type = nil
	}

	// No error
	return nil
}

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

	// Type
	if action.Type != nil {
		typeVar := string(*action.Type)
		destination.Type = &typeVar
	} else {
		destination.Type = nil
	}

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

	// No error
	return nil
}

// Initialize_From_FirewallPolicyNatRuleCollectionAction_STATUS populates our FirewallPolicyNatRuleCollectionAction from the provided source FirewallPolicyNatRuleCollectionAction_STATUS
func (action *FirewallPolicyNatRuleCollectionAction) Initialize_From_FirewallPolicyNatRuleCollectionAction_STATUS(source *FirewallPolicyNatRuleCollectionAction_STATUS) error {

	// Type
	if source.Type != nil {
		typeVar := genruntime.ToEnum(string(*source.Type), firewallPolicyNatRuleCollectionActionType_Values)
		action.Type = &typeVar
	} else {
		action.Type = nil
	}

	// No error
	return nil
}

// Properties of the FirewallPolicyNatRuleCollectionAction.
type FirewallPolicyNatRuleCollectionAction_STATUS struct {
	// Type: The type of action.
	Type *FirewallPolicyNatRuleCollectionActionType_STATUS `json:"type,omitempty"`
}

var _ genruntime.FromARMConverter = &FirewallPolicyNatRuleCollectionAction_STATUS{}

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

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

	// Set property "Type":
	if typedInput.Type != nil {
		var temp string
		temp = string(*typedInput.Type)
		typeVar := FirewallPolicyNatRuleCollectionActionType_STATUS(temp)
		action.Type = &typeVar
	}

	// No error
	return nil
}

// AssignProperties_From_FirewallPolicyNatRuleCollectionAction_STATUS populates our FirewallPolicyNatRuleCollectionAction_STATUS from the provided source FirewallPolicyNatRuleCollectionAction_STATUS
func (action *FirewallPolicyNatRuleCollectionAction_STATUS) AssignProperties_From_FirewallPolicyNatRuleCollectionAction_STATUS(source *storage.FirewallPolicyNatRuleCollectionAction_STATUS) error {

	// Type
	if source.Type != nil {
		typeVar := *source.Type
		typeTemp := genruntime.ToEnum(typeVar, firewallPolicyNatRuleCollectionActionType_STATUS_Values)
		action.Type = &typeTemp
	} else {
		action.Type = nil
	}

	// No error
	return nil
}

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

	// Type
	if action.Type != nil {
		typeVar := string(*action.Type)
		destination.Type = &typeVar
	} else {
		destination.Type = nil
	}

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

	// No error
	return nil
}

type FirewallPolicyRule struct {
	// Application: Mutually exclusive with all other properties
	Application *ApplicationRule `json:"applicationRule,omitempty"`

	// Nat: Mutually exclusive with all other properties
	Nat *NatRule `json:"natRule,omitempty"`

	// Network: Mutually exclusive with all other properties
	Network *NetworkRule `json:"networkRule,omitempty"`
}

var _ genruntime.ARMTransformer = &FirewallPolicyRule{}

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

	// Set property "Application":
	if rule.Application != nil {
		application_ARM, err := rule.Application.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		application := *application_ARM.(*arm.ApplicationRule)
		result.Application = &application
	}

	// Set property "Nat":
	if rule.Nat != nil {
		nat_ARM, err := rule.Nat.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		nat := *nat_ARM.(*arm.NatRule)
		result.Nat = &nat
	}

	// Set property "Network":
	if rule.Network != nil {
		network_ARM, err := rule.Network.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		network := *network_ARM.(*arm.NetworkRule)
		result.Network = &network
	}
	return result, nil
}

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

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

	// Set property "Application":
	if typedInput.Application != nil {
		var application1 ApplicationRule
		err := application1.PopulateFromARM(owner, *typedInput.Application)
		if err != nil {
			return err
		}
		application := application1
		rule.Application = &application
	}

	// Set property "Nat":
	if typedInput.Nat != nil {
		var nat1 NatRule
		err := nat1.PopulateFromARM(owner, *typedInput.Nat)
		if err != nil {
			return err
		}
		nat := nat1
		rule.Nat = &nat
	}

	// Set property "Network":
	if typedInput.Network != nil {
		var network1 NetworkRule
		err := network1.PopulateFromARM(owner, *typedInput.Network)
		if err != nil {
			return err
		}
		network := network1
		rule.Network = &network
	}

	// No error
	return nil
}

// AssignProperties_From_FirewallPolicyRule populates our FirewallPolicyRule from the provided source FirewallPolicyRule
func (rule *FirewallPolicyRule) AssignProperties_From_FirewallPolicyRule(source *storage.FirewallPolicyRule) error {

	// Application
	if source.Application != nil {
		var application ApplicationRule
		err := application.AssignProperties_From_ApplicationRule(source.Application)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ApplicationRule() to populate field Application")
		}
		rule.Application = &application
	} else {
		rule.Application = nil
	}

	// Nat
	if source.Nat != nil {
		var nat NatRule
		err := nat.AssignProperties_From_NatRule(source.Nat)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_NatRule() to populate field Nat")
		}
		rule.Nat = &nat
	} else {
		rule.Nat = nil
	}

	// Network
	if source.Network != nil {
		var network NetworkRule
		err := network.AssignProperties_From_NetworkRule(source.Network)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_NetworkRule() to populate field Network")
		}
		rule.Network = &network
	} else {
		rule.Network = nil
	}

	// No error
	return nil
}

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

	// Application
	if rule.Application != nil {
		var application storage.ApplicationRule
		err := rule.Application.AssignProperties_To_ApplicationRule(&application)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ApplicationRule() to populate field Application")
		}
		destination.Application = &application
	} else {
		destination.Application = nil
	}

	// Nat
	if rule.Nat != nil {
		var nat storage.NatRule
		err := rule.Nat.AssignProperties_To_NatRule(&nat)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_NatRule() to populate field Nat")
		}
		destination.Nat = &nat
	} else {
		destination.Nat = nil
	}

	// Network
	if rule.Network != nil {
		var network storage.NetworkRule
		err := rule.Network.AssignProperties_To_NetworkRule(&network)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_NetworkRule() to populate field Network")
		}
		destination.Network = &network
	} else {
		destination.Network = nil
	}

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

	// No error
	return nil
}

// Initialize_From_FirewallPolicyRule_STATUS populates our FirewallPolicyRule from the provided source FirewallPolicyRule_STATUS
func (rule *FirewallPolicyRule) Initialize_From_FirewallPolicyRule_STATUS(source *FirewallPolicyRule_STATUS) error {

	// Application
	if source.Application != nil {
		var application ApplicationRule
		err := application.Initialize_From_ApplicationRule_STATUS(source.Application)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_ApplicationRule_STATUS() to populate field Application")
		}
		rule.Application = &application
	} else {
		rule.Application = nil
	}

	// Nat
	if source.Nat != nil {
		var nat NatRule
		err := nat.Initialize_From_NatRule_STATUS(source.Nat)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_NatRule_STATUS() to populate field Nat")
		}
		rule.Nat = &nat
	} else {
		rule.Nat = nil
	}

	// Network
	if source.Network != nil {
		var network NetworkRule
		err := network.Initialize_From_NetworkRule_STATUS(source.Network)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_NetworkRule_STATUS() to populate field Network")
		}
		rule.Network = &network
	} else {
		rule.Network = nil
	}

	// No error
	return nil
}

type FirewallPolicyRule_STATUS struct {
	// Application: Mutually exclusive with all other properties
	Application *ApplicationRule_STATUS `json:"applicationRule,omitempty"`

	// Nat: Mutually exclusive with all other properties
	Nat *NatRule_STATUS `json:"natRule,omitempty"`

	// Network: Mutually exclusive with all other properties
	Network *NetworkRule_STATUS `json:"networkRule,omitempty"`
}

var _ genruntime.FromARMConverter = &FirewallPolicyRule_STATUS{}

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

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

	// Set property "Application":
	if typedInput.Application != nil {
		var application1 ApplicationRule_STATUS
		err := application1.PopulateFromARM(owner, *typedInput.Application)
		if err != nil {
			return err
		}
		application := application1
		rule.Application = &application
	}

	// Set property "Nat":
	if typedInput.Nat != nil {
		var nat1 NatRule_STATUS
		err := nat1.PopulateFromARM(owner, *typedInput.Nat)
		if err != nil {
			return err
		}
		nat := nat1
		rule.Nat = &nat
	}

	// Set property "Network":
	if typedInput.Network != nil {
		var network1 NetworkRule_STATUS
		err := network1.PopulateFromARM(owner, *typedInput.Network)
		if err != nil {
			return err
		}
		network := network1
		rule.Network = &network
	}

	// No error
	return nil
}

// AssignProperties_From_FirewallPolicyRule_STATUS populates our FirewallPolicyRule_STATUS from the provided source FirewallPolicyRule_STATUS
func (rule *FirewallPolicyRule_STATUS) AssignProperties_From_FirewallPolicyRule_STATUS(source *storage.FirewallPolicyRule_STATUS) error {

	// Application
	if source.Application != nil {
		var application ApplicationRule_STATUS
		err := application.AssignProperties_From_ApplicationRule_STATUS(source.Application)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ApplicationRule_STATUS() to populate field Application")
		}
		rule.Application = &application
	} else {
		rule.Application = nil
	}

	// Nat
	if source.Nat != nil {
		var nat NatRule_STATUS
		err := nat.AssignProperties_From_NatRule_STATUS(source.Nat)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_NatRule_STATUS() to populate field Nat")
		}
		rule.Nat = &nat
	} else {
		rule.Nat = nil
	}

	// Network
	if source.Network != nil {
		var network NetworkRule_STATUS
		err := network.AssignProperties_From_NetworkRule_STATUS(source.Network)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_NetworkRule_STATUS() to populate field Network")
		}
		rule.Network = &network
	} else {
		rule.Network = nil
	}

	// No error
	return nil
}

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

	// Application
	if rule.Application != nil {
		var application storage.ApplicationRule_STATUS
		err := rule.Application.AssignProperties_To_ApplicationRule_STATUS(&application)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ApplicationRule_STATUS() to populate field Application")
		}
		destination.Application = &application
	} else {
		destination.Application = nil
	}

	// Nat
	if rule.Nat != nil {
		var nat storage.NatRule_STATUS
		err := rule.Nat.AssignProperties_To_NatRule_STATUS(&nat)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_NatRule_STATUS() to populate field Nat")
		}
		destination.Nat = &nat
	} else {
		destination.Nat = nil
	}

	// Network
	if rule.Network != nil {
		var network storage.NetworkRule_STATUS
		err := rule.Network.AssignProperties_To_NetworkRule_STATUS(&network)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_NetworkRule_STATUS() to populate field Network")
		}
		destination.Network = &network
	} else {
		destination.Network = nil
	}

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

	// No error
	return nil
}

type ApplicationRule struct {
	// Description: Description of the rule.
	Description *string `json:"description,omitempty"`

	// DestinationAddresses: List of destination IP addresses or Service Tags.
	DestinationAddresses []string `json:"destinationAddresses,omitempty"`

	// FqdnTags: List of FQDN Tags for this rule.
	FqdnTags []string `json:"fqdnTags,omitempty"`

	// HttpHeadersToInsert: List of HTTP/S headers to insert.
	HttpHeadersToInsert []FirewallPolicyHttpHeaderToInsert `json:"httpHeadersToInsert,omitempty"`

	// Name: Name of the rule.
	Name *string `json:"name,omitempty"`

	// Protocols: Array of Application Protocols.
	Protocols []FirewallPolicyRuleApplicationProtocol `json:"protocols,omitempty"`

	// +kubebuilder:validation:Required
	// RuleType: Rule Type.
	RuleType *ApplicationRule_RuleType `json:"ruleType,omitempty"`

	// SourceAddresses: List of source IP addresses for this rule.
	SourceAddresses []string `json:"sourceAddresses,omitempty"`

	// SourceIpGroups: List of source IpGroups for this rule.
	SourceIpGroups []string `json:"sourceIpGroups,omitempty"`

	// TargetFqdns: List of FQDNs for this rule.
	TargetFqdns []string `json:"targetFqdns,omitempty"`

	// TargetUrls: List of Urls for this rule condition.
	TargetUrls []string `json:"targetUrls,omitempty"`

	// TerminateTLS: Terminate TLS connections for this rule.
	TerminateTLS *bool `json:"terminateTLS,omitempty"`

	// WebCategories: List of destination azure web categories.
	WebCategories []string `json:"webCategories,omitempty"`
}

var _ genruntime.ARMTransformer = &ApplicationRule{}

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

	// Set property "Description":
	if rule.Description != nil {
		description := *rule.Description
		result.Description = &description
	}

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

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

	// Set property "HttpHeadersToInsert":
	for _, item := range rule.HttpHeadersToInsert {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.HttpHeadersToInsert = append(result.HttpHeadersToInsert, *item_ARM.(*arm.FirewallPolicyHttpHeaderToInsert))
	}

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

	// Set property "Protocols":
	for _, item := range rule.Protocols {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Protocols = append(result.Protocols, *item_ARM.(*arm.FirewallPolicyRuleApplicationProtocol))
	}

	// Set property "RuleType":
	if rule.RuleType != nil {
		var temp arm.ApplicationRule_RuleType
		var temp1 string
		temp1 = string(*rule.RuleType)
		temp = arm.ApplicationRule_RuleType(temp1)
		result.RuleType = temp
	}

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

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

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

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

	// Set property "TerminateTLS":
	if rule.TerminateTLS != nil {
		terminateTLS := *rule.TerminateTLS
		result.TerminateTLS = &terminateTLS
	}

	// Set property "WebCategories":
	for _, item := range rule.WebCategories {
		result.WebCategories = append(result.WebCategories, item)
	}
	return result, nil
}

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

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

	// Set property "Description":
	if typedInput.Description != nil {
		description := *typedInput.Description
		rule.Description = &description
	}

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

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

	// Set property "HttpHeadersToInsert":
	for _, item := range typedInput.HttpHeadersToInsert {
		var item1 FirewallPolicyHttpHeaderToInsert
		err := item1.PopulateFromARM(owner, item)
		if err != nil {
			return err
		}
		rule.HttpHeadersToInsert = append(rule.HttpHeadersToInsert, item1)
	}

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

	// Set property "Protocols":
	for _, item := range typedInput.Protocols {
		var item1 FirewallPolicyRuleApplicationProtocol
		err := item1.PopulateFromARM(owner, item)
		if err != nil {
			return err
		}
		rule.Protocols = append(rule.Protocols, item1)
	}

	// Set property "RuleType":
	var temp ApplicationRule_RuleType
	var temp1 string
	temp1 = string(typedInput.RuleType)
	temp = ApplicationRule_RuleType(temp1)
	rule.RuleType = &temp

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

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

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

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

	// Set property "TerminateTLS":
	if typedInput.TerminateTLS != nil {
		terminateTLS := *typedInput.TerminateTLS
		rule.TerminateTLS = &terminateTLS
	}

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

	// No error
	return nil
}

// AssignProperties_From_ApplicationRule populates our ApplicationRule from the provided source ApplicationRule
func (rule *ApplicationRule) AssignProperties_From_ApplicationRule(source *storage.ApplicationRule) error {

	// Description
	rule.Description = genruntime.ClonePointerToString(source.Description)

	// DestinationAddresses
	rule.DestinationAddresses = genruntime.CloneSliceOfString(source.DestinationAddresses)

	// FqdnTags
	rule.FqdnTags = genruntime.CloneSliceOfString(source.FqdnTags)

	// HttpHeadersToInsert
	if source.HttpHeadersToInsert != nil {
		httpHeadersToInsertList := make([]FirewallPolicyHttpHeaderToInsert, len(source.HttpHeadersToInsert))
		for httpHeadersToInsertIndex, httpHeadersToInsertItem := range source.HttpHeadersToInsert {
			var httpHeadersToInsert FirewallPolicyHttpHeaderToInsert
			err := httpHeadersToInsert.AssignProperties_From_FirewallPolicyHttpHeaderToInsert(&httpHeadersToInsertItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_FirewallPolicyHttpHeaderToInsert() to populate field HttpHeadersToInsert")
			}
			httpHeadersToInsertList[httpHeadersToInsertIndex] = httpHeadersToInsert
		}
		rule.HttpHeadersToInsert = httpHeadersToInsertList
	} else {
		rule.HttpHeadersToInsert = nil
	}

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

	// Protocols
	if source.Protocols != nil {
		protocolList := make([]FirewallPolicyRuleApplicationProtocol, len(source.Protocols))
		for protocolIndex, protocolItem := range source.Protocols {
			var protocol FirewallPolicyRuleApplicationProtocol
			err := protocol.AssignProperties_From_FirewallPolicyRuleApplicationProtocol(&protocolItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_FirewallPolicyRuleApplicationProtocol() to populate field Protocols")
			}
			protocolList[protocolIndex] = protocol
		}
		rule.Protocols = protocolList
	} else {
		rule.Protocols = nil
	}

	// RuleType
	if source.RuleType != nil {
		ruleType := *source.RuleType
		ruleTypeTemp := genruntime.ToEnum(ruleType, applicationRule_RuleType_Values)
		rule.RuleType = &ruleTypeTemp
	} else {
		rule.RuleType = nil
	}

	// SourceAddresses
	rule.SourceAddresses = genruntime.CloneSliceOfString(source.SourceAddresses)

	// SourceIpGroups
	rule.SourceIpGroups = genruntime.CloneSliceOfString(source.SourceIpGroups)

	// TargetFqdns
	rule.TargetFqdns = genruntime.CloneSliceOfString(source.TargetFqdns)

	// TargetUrls
	rule.TargetUrls = genruntime.CloneSliceOfString(source.TargetUrls)

	// TerminateTLS
	if source.TerminateTLS != nil {
		terminateTLS := *source.TerminateTLS
		rule.TerminateTLS = &terminateTLS
	} else {
		rule.TerminateTLS = nil
	}

	// WebCategories
	rule.WebCategories = genruntime.CloneSliceOfString(source.WebCategories)

	// No error
	return nil
}

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

	// Description
	destination.Description = genruntime.ClonePointerToString(rule.Description)

	// DestinationAddresses
	destination.DestinationAddresses = genruntime.CloneSliceOfString(rule.DestinationAddresses)

	// FqdnTags
	destination.FqdnTags = genruntime.CloneSliceOfString(rule.FqdnTags)

	// HttpHeadersToInsert
	if rule.HttpHeadersToInsert != nil {
		httpHeadersToInsertList := make([]storage.FirewallPolicyHttpHeaderToInsert, len(rule.HttpHeadersToInsert))
		for httpHeadersToInsertIndex, httpHeadersToInsertItem := range rule.HttpHeadersToInsert {
			var httpHeadersToInsert storage.FirewallPolicyHttpHeaderToInsert
			err := httpHeadersToInsertItem.AssignProperties_To_FirewallPolicyHttpHeaderToInsert(&httpHeadersToInsert)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_FirewallPolicyHttpHeaderToInsert() to populate field HttpHeadersToInsert")
			}
			httpHeadersToInsertList[httpHeadersToInsertIndex] = httpHeadersToInsert
		}
		destination.HttpHeadersToInsert = httpHeadersToInsertList
	} else {
		destination.HttpHeadersToInsert = nil
	}

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

	// Protocols
	if rule.Protocols != nil {
		protocolList := make([]storage.FirewallPolicyRuleApplicationProtocol, len(rule.Protocols))
		for protocolIndex, protocolItem := range rule.Protocols {
			var protocol storage.FirewallPolicyRuleApplicationProtocol
			err := protocolItem.AssignProperties_To_FirewallPolicyRuleApplicationProtocol(&protocol)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_FirewallPolicyRuleApplicationProtocol() to populate field Protocols")
			}
			protocolList[protocolIndex] = protocol
		}
		destination.Protocols = protocolList
	} else {
		destination.Protocols = nil
	}

	// RuleType
	if rule.RuleType != nil {
		ruleType := string(*rule.RuleType)
		destination.RuleType = &ruleType
	} else {
		destination.RuleType = nil
	}

	// SourceAddresses
	destination.SourceAddresses = genruntime.CloneSliceOfString(rule.SourceAddresses)

	// SourceIpGroups
	destination.SourceIpGroups = genruntime.CloneSliceOfString(rule.SourceIpGroups)

	// TargetFqdns
	destination.TargetFqdns = genruntime.CloneSliceOfString(rule.TargetFqdns)

	// TargetUrls
	destination.TargetUrls = genruntime.CloneSliceOfString(rule.TargetUrls)

	// TerminateTLS
	if rule.TerminateTLS != nil {
		terminateTLS := *rule.TerminateTLS
		destination.TerminateTLS = &terminateTLS
	} else {
		destination.TerminateTLS = nil
	}

	// WebCategories
	destination.WebCategories = genruntime.CloneSliceOfString(rule.WebCategories)

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

	// No error
	return nil
}

// Initialize_From_ApplicationRule_STATUS populates our ApplicationRule from the provided source ApplicationRule_STATUS
func (rule *ApplicationRule) Initialize_From_ApplicationRule_STATUS(source *ApplicationRule_STATUS) error {

	// Description
	rule.Description = genruntime.ClonePointerToString(source.Description)

	// DestinationAddresses
	rule.DestinationAddresses = genruntime.CloneSliceOfString(source.DestinationAddresses)

	// FqdnTags
	rule.FqdnTags = genruntime.CloneSliceOfString(source.FqdnTags)

	// HttpHeadersToInsert
	if source.HttpHeadersToInsert != nil {
		httpHeadersToInsertList := make([]FirewallPolicyHttpHeaderToInsert, len(source.HttpHeadersToInsert))
		for httpHeadersToInsertIndex, httpHeadersToInsertItem := range source.HttpHeadersToInsert {
			var httpHeadersToInsert FirewallPolicyHttpHeaderToInsert
			err := httpHeadersToInsert.Initialize_From_FirewallPolicyHttpHeaderToInsert_STATUS(&httpHeadersToInsertItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_FirewallPolicyHttpHeaderToInsert_STATUS() to populate field HttpHeadersToInsert")
			}
			httpHeadersToInsertList[httpHeadersToInsertIndex] = httpHeadersToInsert
		}
		rule.HttpHeadersToInsert = httpHeadersToInsertList
	} else {
		rule.HttpHeadersToInsert = nil
	}

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

	// Protocols
	if source.Protocols != nil {
		protocolList := make([]FirewallPolicyRuleApplicationProtocol, len(source.Protocols))
		for protocolIndex, protocolItem := range source.Protocols {
			var protocol FirewallPolicyRuleApplicationProtocol
			err := protocol.Initialize_From_FirewallPolicyRuleApplicationProtocol_STATUS(&protocolItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_FirewallPolicyRuleApplicationProtocol_STATUS() to populate field Protocols")
			}
			protocolList[protocolIndex] = protocol
		}
		rule.Protocols = protocolList
	} else {
		rule.Protocols = nil
	}

	// RuleType
	if source.RuleType != nil {
		ruleType := genruntime.ToEnum(string(*source.RuleType), applicationRule_RuleType_Values)
		rule.RuleType = &ruleType
	} else {
		rule.RuleType = nil
	}

	// SourceAddresses
	rule.SourceAddresses = genruntime.CloneSliceOfString(source.SourceAddresses)

	// SourceIpGroups
	rule.SourceIpGroups = genruntime.CloneSliceOfString(source.SourceIpGroups)

	// TargetFqdns
	rule.TargetFqdns = genruntime.CloneSliceOfString(source.TargetFqdns)

	// TargetUrls
	rule.TargetUrls = genruntime.CloneSliceOfString(source.TargetUrls)

	// TerminateTLS
	if source.TerminateTLS != nil {
		terminateTLS := *source.TerminateTLS
		rule.TerminateTLS = &terminateTLS
	} else {
		rule.TerminateTLS = nil
	}

	// WebCategories
	rule.WebCategories = genruntime.CloneSliceOfString(source.WebCategories)

	// No error
	return nil
}

type ApplicationRule_STATUS struct {
	// Description: Description of the rule.
	Description *string `json:"description,omitempty"`

	// DestinationAddresses: List of destination IP addresses or Service Tags.
	DestinationAddresses []string `json:"destinationAddresses,omitempty"`

	// FqdnTags: List of FQDN Tags for this rule.
	FqdnTags []string `json:"fqdnTags,omitempty"`

	// HttpHeadersToInsert: List of HTTP/S headers to insert.
	HttpHeadersToInsert []FirewallPolicyHttpHeaderToInsert_STATUS `json:"httpHeadersToInsert,omitempty"`

	// Name: Name of the rule.
	Name *string `json:"name,omitempty"`

	// Protocols: Array of Application Protocols.
	Protocols []FirewallPolicyRuleApplicationProtocol_STATUS `json:"protocols,omitempty"`

	// RuleType: Rule Type.
	RuleType *ApplicationRule_RuleType_STATUS `json:"ruleType,omitempty"`

	// SourceAddresses: List of source IP addresses for this rule.
	SourceAddresses []string `json:"sourceAddresses,omitempty"`

	// SourceIpGroups: List of source IpGroups for this rule.
	SourceIpGroups []string `json:"sourceIpGroups,omitempty"`

	// TargetFqdns: List of FQDNs for this rule.
	TargetFqdns []string `json:"targetFqdns,omitempty"`

	// TargetUrls: List of Urls for this rule condition.
	TargetUrls []string `json:"targetUrls,omitempty"`

	// TerminateTLS: Terminate TLS connections for this rule.
	TerminateTLS *bool `json:"terminateTLS,omitempty"`

	// WebCategories: List of destination azure web categories.
	WebCategories []string `json:"webCategories,omitempty"`
}

var _ genruntime.FromARMConverter = &ApplicationRule_STATUS{}

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

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

	// Set property "Description":
	if typedInput.Description != nil {
		description := *typedInput.Description
		rule.Description = &description
	}

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

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

	// Set property "HttpHeadersToInsert":
	for _, item := range typedInput.HttpHeadersToInsert {
		var item1 FirewallPolicyHttpHeaderToInsert_STATUS
		err := item1.PopulateFromARM(owner, item)
		if err != nil {
			return err
		}
		rule.HttpHeadersToInsert = append(rule.HttpHeadersToInsert, item1)
	}

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

	// Set property "Protocols":
	for _, item := range typedInput.Protocols {
		var item1 FirewallPolicyRuleApplicationProtocol_STATUS
		err := item1.PopulateFromARM(owner, item)
		if err != nil {
			return err
		}
		rule.Protocols = append(rule.Protocols, item1)
	}

	// Set property "RuleType":
	var temp ApplicationRule_RuleType_STATUS
	var temp1 string
	temp1 = string(typedInput.RuleType)
	temp = ApplicationRule_RuleType_STATUS(temp1)
	rule.RuleType = &temp

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

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

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

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

	// Set property "TerminateTLS":
	if typedInput.TerminateTLS != nil {
		terminateTLS := *typedInput.TerminateTLS
		rule.TerminateTLS = &terminateTLS
	}

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

	// No error
	return nil
}

// AssignProperties_From_ApplicationRule_STATUS populates our ApplicationRule_STATUS from the provided source ApplicationRule_STATUS
func (rule *ApplicationRule_STATUS) AssignProperties_From_ApplicationRule_STATUS(source *storage.ApplicationRule_STATUS) error {

	// Description
	rule.Description = genruntime.ClonePointerToString(source.Description)

	// DestinationAddresses
	rule.DestinationAddresses = genruntime.CloneSliceOfString(source.DestinationAddresses)

	// FqdnTags
	rule.FqdnTags = genruntime.CloneSliceOfString(source.FqdnTags)

	// HttpHeadersToInsert
	if source.HttpHeadersToInsert != nil {
		httpHeadersToInsertList := make([]FirewallPolicyHttpHeaderToInsert_STATUS, len(source.HttpHeadersToInsert))
		for httpHeadersToInsertIndex, httpHeadersToInsertItem := range source.HttpHeadersToInsert {
			var httpHeadersToInsert FirewallPolicyHttpHeaderToInsert_STATUS
			err := httpHeadersToInsert.AssignProperties_From_FirewallPolicyHttpHeaderToInsert_STATUS(&httpHeadersToInsertItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_FirewallPolicyHttpHeaderToInsert_STATUS() to populate field HttpHeadersToInsert")
			}
			httpHeadersToInsertList[httpHeadersToInsertIndex] = httpHeadersToInsert
		}
		rule.HttpHeadersToInsert = httpHeadersToInsertList
	} else {
		rule.HttpHeadersToInsert = nil
	}

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

	// Protocols
	if source.Protocols != nil {
		protocolList := make([]FirewallPolicyRuleApplicationProtocol_STATUS, len(source.Protocols))
		for protocolIndex, protocolItem := range source.Protocols {
			var protocol FirewallPolicyRuleApplicationProtocol_STATUS
			err := protocol.AssignProperties_From_FirewallPolicyRuleApplicationProtocol_STATUS(&protocolItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_FirewallPolicyRuleApplicationProtocol_STATUS() to populate field Protocols")
			}
			protocolList[protocolIndex] = protocol
		}
		rule.Protocols = protocolList
	} else {
		rule.Protocols = nil
	}

	// RuleType
	if source.RuleType != nil {
		ruleType := *source.RuleType
		ruleTypeTemp := genruntime.ToEnum(ruleType, applicationRule_RuleType_STATUS_Values)
		rule.RuleType = &ruleTypeTemp
	} else {
		rule.RuleType = nil
	}

	// SourceAddresses
	rule.SourceAddresses = genruntime.CloneSliceOfString(source.SourceAddresses)

	// SourceIpGroups
	rule.SourceIpGroups = genruntime.CloneSliceOfString(source.SourceIpGroups)

	// TargetFqdns
	rule.TargetFqdns = genruntime.CloneSliceOfString(source.TargetFqdns)

	// TargetUrls
	rule.TargetUrls = genruntime.CloneSliceOfString(source.TargetUrls)

	// TerminateTLS
	if source.TerminateTLS != nil {
		terminateTLS := *source.TerminateTLS
		rule.TerminateTLS = &terminateTLS
	} else {
		rule.TerminateTLS = nil
	}

	// WebCategories
	rule.WebCategories = genruntime.CloneSliceOfString(source.WebCategories)

	// No error
	return nil
}

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

	// Description
	destination.Description = genruntime.ClonePointerToString(rule.Description)

	// DestinationAddresses
	destination.DestinationAddresses = genruntime.CloneSliceOfString(rule.DestinationAddresses)

	// FqdnTags
	destination.FqdnTags = genruntime.CloneSliceOfString(rule.FqdnTags)

	// HttpHeadersToInsert
	if rule.HttpHeadersToInsert != nil {
		httpHeadersToInsertList := make([]storage.FirewallPolicyHttpHeaderToInsert_STATUS, len(rule.HttpHeadersToInsert))
		for httpHeadersToInsertIndex, httpHeadersToInsertItem := range rule.HttpHeadersToInsert {
			var httpHeadersToInsert storage.FirewallPolicyHttpHeaderToInsert_STATUS
			err := httpHeadersToInsertItem.AssignProperties_To_FirewallPolicyHttpHeaderToInsert_STATUS(&httpHeadersToInsert)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_FirewallPolicyHttpHeaderToInsert_STATUS() to populate field HttpHeadersToInsert")
			}
			httpHeadersToInsertList[httpHeadersToInsertIndex] = httpHeadersToInsert
		}
		destination.HttpHeadersToInsert = httpHeadersToInsertList
	} else {
		destination.HttpHeadersToInsert = nil
	}

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

	// Protocols
	if rule.Protocols != nil {
		protocolList := make([]storage.FirewallPolicyRuleApplicationProtocol_STATUS, len(rule.Protocols))
		for protocolIndex, protocolItem := range rule.Protocols {
			var protocol storage.FirewallPolicyRuleApplicationProtocol_STATUS
			err := protocolItem.AssignProperties_To_FirewallPolicyRuleApplicationProtocol_STATUS(&protocol)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_FirewallPolicyRuleApplicationProtocol_STATUS() to populate field Protocols")
			}
			protocolList[protocolIndex] = protocol
		}
		destination.Protocols = protocolList
	} else {
		destination.Protocols = nil
	}

	// RuleType
	if rule.RuleType != nil {
		ruleType := string(*rule.RuleType)
		destination.RuleType = &ruleType
	} else {
		destination.RuleType = nil
	}

	// SourceAddresses
	destination.SourceAddresses = genruntime.CloneSliceOfString(rule.SourceAddresses)

	// SourceIpGroups
	destination.SourceIpGroups = genruntime.CloneSliceOfString(rule.SourceIpGroups)

	// TargetFqdns
	destination.TargetFqdns = genruntime.CloneSliceOfString(rule.TargetFqdns)

	// TargetUrls
	destination.TargetUrls = genruntime.CloneSliceOfString(rule.TargetUrls)

	// TerminateTLS
	if rule.TerminateTLS != nil {
		terminateTLS := *rule.TerminateTLS
		destination.TerminateTLS = &terminateTLS
	} else {
		destination.TerminateTLS = nil
	}

	// WebCategories
	destination.WebCategories = genruntime.CloneSliceOfString(rule.WebCategories)

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

	// No error
	return nil
}

// The action type of a rule.
// +kubebuilder:validation:Enum={"Allow","Deny"}
type FirewallPolicyFilterRuleCollectionActionType string

const (
	FirewallPolicyFilterRuleCollectionActionType_Allow = FirewallPolicyFilterRuleCollectionActionType("Allow")
	FirewallPolicyFilterRuleCollectionActionType_Deny  = FirewallPolicyFilterRuleCollectionActionType("Deny")
)

// Mapping from string to FirewallPolicyFilterRuleCollectionActionType
var firewallPolicyFilterRuleCollectionActionType_Values = map[string]FirewallPolicyFilterRuleCollectionActionType{
	"allow": FirewallPolicyFilterRuleCollectionActionType_Allow,
	"deny":  FirewallPolicyFilterRuleCollectionActionType_Deny,
}

// The action type of a rule.
type FirewallPolicyFilterRuleCollectionActionType_STATUS string

const (
	FirewallPolicyFilterRuleCollectionActionType_STATUS_Allow = FirewallPolicyFilterRuleCollectionActionType_STATUS("Allow")
	FirewallPolicyFilterRuleCollectionActionType_STATUS_Deny  = FirewallPolicyFilterRuleCollectionActionType_STATUS("Deny")
)

// Mapping from string to FirewallPolicyFilterRuleCollectionActionType_STATUS
var firewallPolicyFilterRuleCollectionActionType_STATUS_Values = map[string]FirewallPolicyFilterRuleCollectionActionType_STATUS{
	"allow": FirewallPolicyFilterRuleCollectionActionType_STATUS_Allow,
	"deny":  FirewallPolicyFilterRuleCollectionActionType_STATUS_Deny,
}

// The action type of a rule.
// +kubebuilder:validation:Enum={"DNAT"}
type FirewallPolicyNatRuleCollectionActionType string

const FirewallPolicyNatRuleCollectionActionType_DNAT = FirewallPolicyNatRuleCollectionActionType("DNAT")

// Mapping from string to FirewallPolicyNatRuleCollectionActionType
var firewallPolicyNatRuleCollectionActionType_Values = map[string]FirewallPolicyNatRuleCollectionActionType{
	"dnat": FirewallPolicyNatRuleCollectionActionType_DNAT,
}

// The action type of a rule.
type FirewallPolicyNatRuleCollectionActionType_STATUS string

const FirewallPolicyNatRuleCollectionActionType_STATUS_DNAT = FirewallPolicyNatRuleCollectionActionType_STATUS("DNAT")

// Mapping from string to FirewallPolicyNatRuleCollectionActionType_STATUS
var firewallPolicyNatRuleCollectionActionType_STATUS_Values = map[string]FirewallPolicyNatRuleCollectionActionType_STATUS{
	"dnat": FirewallPolicyNatRuleCollectionActionType_STATUS_DNAT,
}

type NatRule struct {
	// Description: Description of the rule.
	Description *string `json:"description,omitempty"`

	// DestinationAddresses: List of destination IP addresses or Service Tags.
	DestinationAddresses []string `json:"destinationAddresses,omitempty"`

	// DestinationPorts: List of destination ports.
	DestinationPorts []string `json:"destinationPorts,omitempty"`

	// IpProtocols: Array of FirewallPolicyRuleNetworkProtocols.
	IpProtocols []FirewallPolicyRuleNetworkProtocol `json:"ipProtocols,omitempty"`

	// Name: Name of the rule.
	Name *string `json:"name,omitempty"`

	// +kubebuilder:validation:Required
	// RuleType: Rule Type.
	RuleType *NatRule_RuleType `json:"ruleType,omitempty"`

	// SourceAddresses: List of source IP addresses for this rule.
	SourceAddresses []string `json:"sourceAddresses,omitempty"`

	// SourceIpGroups: List of source IpGroups for this rule.
	SourceIpGroups []string `json:"sourceIpGroups,omitempty"`

	// TranslatedAddress: The translated address for this NAT rule.
	TranslatedAddress *string `json:"translatedAddress,omitempty"`

	// TranslatedFqdn: The translated FQDN for this NAT rule.
	TranslatedFqdn *string `json:"translatedFqdn,omitempty"`

	// TranslatedPort: The translated port for this NAT rule.
	TranslatedPort *string `json:"translatedPort,omitempty"`
}

var _ genruntime.ARMTransformer = &NatRule{}

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

	// Set property "Description":
	if rule.Description != nil {
		description := *rule.Description
		result.Description = &description
	}

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

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

	// Set property "IpProtocols":
	for _, item := range rule.IpProtocols {
		var temp string
		temp = string(item)
		result.IpProtocols = append(result.IpProtocols, arm.FirewallPolicyRuleNetworkProtocol(temp))
	}

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

	// Set property "RuleType":
	if rule.RuleType != nil {
		var temp arm.NatRule_RuleType
		var temp1 string
		temp1 = string(*rule.RuleType)
		temp = arm.NatRule_RuleType(temp1)
		result.RuleType = temp
	}

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

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

	// Set property "TranslatedAddress":
	if rule.TranslatedAddress != nil {
		translatedAddress := *rule.TranslatedAddress
		result.TranslatedAddress = &translatedAddress
	}

	// Set property "TranslatedFqdn":
	if rule.TranslatedFqdn != nil {
		translatedFqdn := *rule.TranslatedFqdn
		result.TranslatedFqdn = &translatedFqdn
	}

	// Set property "TranslatedPort":
	if rule.TranslatedPort != nil {
		translatedPort := *rule.TranslatedPort
		result.TranslatedPort = &translatedPort
	}
	return result, nil
}

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

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

	// Set property "Description":
	if typedInput.Description != nil {
		description := *typedInput.Description
		rule.Description = &description
	}

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

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

	// Set property "IpProtocols":
	for _, item := range typedInput.IpProtocols {
		var temp string
		temp = string(item)
		rule.IpProtocols = append(rule.IpProtocols, FirewallPolicyRuleNetworkProtocol(temp))
	}

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

	// Set property "RuleType":
	var temp NatRule_RuleType
	var temp1 string
	temp1 = string(typedInput.RuleType)
	temp = NatRule_RuleType(temp1)
	rule.RuleType = &temp

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

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

	// Set property "TranslatedAddress":
	if typedInput.TranslatedAddress != nil {
		translatedAddress := *typedInput.TranslatedAddress
		rule.TranslatedAddress = &translatedAddress
	}

	// Set property "TranslatedFqdn":
	if typedInput.TranslatedFqdn != nil {
		translatedFqdn := *typedInput.TranslatedFqdn
		rule.TranslatedFqdn = &translatedFqdn
	}

	// Set property "TranslatedPort":
	if typedInput.TranslatedPort != nil {
		translatedPort := *typedInput.TranslatedPort
		rule.TranslatedPort = &translatedPort
	}

	// No error
	return nil
}

// AssignProperties_From_NatRule populates our NatRule from the provided source NatRule
func (rule *NatRule) AssignProperties_From_NatRule(source *storage.NatRule) error {

	// Description
	rule.Description = genruntime.ClonePointerToString(source.Description)

	// DestinationAddresses
	rule.DestinationAddresses = genruntime.CloneSliceOfString(source.DestinationAddresses)

	// DestinationPorts
	rule.DestinationPorts = genruntime.CloneSliceOfString(source.DestinationPorts)

	// IpProtocols
	if source.IpProtocols != nil {
		ipProtocolList := make([]FirewallPolicyRuleNetworkProtocol, len(source.IpProtocols))
		for ipProtocolIndex, ipProtocolItem := range source.IpProtocols {
			ipProtocolList[ipProtocolIndex] = genruntime.ToEnum(ipProtocolItem, firewallPolicyRuleNetworkProtocol_Values)
		}
		rule.IpProtocols = ipProtocolList
	} else {
		rule.IpProtocols = nil
	}

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

	// RuleType
	if source.RuleType != nil {
		ruleType := *source.RuleType
		ruleTypeTemp := genruntime.ToEnum(ruleType, natRule_RuleType_Values)
		rule.RuleType = &ruleTypeTemp
	} else {
		rule.RuleType = nil
	}

	// SourceAddresses
	rule.SourceAddresses = genruntime.CloneSliceOfString(source.SourceAddresses)

	// SourceIpGroups
	rule.SourceIpGroups = genruntime.CloneSliceOfString(source.SourceIpGroups)

	// TranslatedAddress
	rule.TranslatedAddress = genruntime.ClonePointerToString(source.TranslatedAddress)

	// TranslatedFqdn
	rule.TranslatedFqdn = genruntime.ClonePointerToString(source.TranslatedFqdn)

	// TranslatedPort
	rule.TranslatedPort = genruntime.ClonePointerToString(source.TranslatedPort)

	// No error
	return nil
}

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

	// Description
	destination.Description = genruntime.ClonePointerToString(rule.Description)

	// DestinationAddresses
	destination.DestinationAddresses = genruntime.CloneSliceOfString(rule.DestinationAddresses)

	// DestinationPorts
	destination.DestinationPorts = genruntime.CloneSliceOfString(rule.DestinationPorts)

	// IpProtocols
	if rule.IpProtocols != nil {
		ipProtocolList := make([]string, len(rule.IpProtocols))
		for ipProtocolIndex, ipProtocolItem := range rule.IpProtocols {
			ipProtocolList[ipProtocolIndex] = string(ipProtocolItem)
		}
		destination.IpProtocols = ipProtocolList
	} else {
		destination.IpProtocols = nil
	}

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

	// RuleType
	if rule.RuleType != nil {
		ruleType := string(*rule.RuleType)
		destination.RuleType = &ruleType
	} else {
		destination.RuleType = nil
	}

	// SourceAddresses
	destination.SourceAddresses = genruntime.CloneSliceOfString(rule.SourceAddresses)

	// SourceIpGroups
	destination.SourceIpGroups = genruntime.CloneSliceOfString(rule.SourceIpGroups)

	// TranslatedAddress
	destination.TranslatedAddress = genruntime.ClonePointerToString(rule.TranslatedAddress)

	// TranslatedFqdn
	destination.TranslatedFqdn = genruntime.ClonePointerToString(rule.TranslatedFqdn)

	// TranslatedPort
	destination.TranslatedPort = genruntime.ClonePointerToString(rule.TranslatedPort)

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

	// No error
	return nil
}

// Initialize_From_NatRule_STATUS populates our NatRule from the provided source NatRule_STATUS
func (rule *NatRule) Initialize_From_NatRule_STATUS(source *NatRule_STATUS) error {

	// Description
	rule.Description = genruntime.ClonePointerToString(source.Description)

	// DestinationAddresses
	rule.DestinationAddresses = genruntime.CloneSliceOfString(source.DestinationAddresses)

	// DestinationPorts
	rule.DestinationPorts = genruntime.CloneSliceOfString(source.DestinationPorts)

	// IpProtocols
	if source.IpProtocols != nil {
		ipProtocolList := make([]FirewallPolicyRuleNetworkProtocol, len(source.IpProtocols))
		for ipProtocolIndex, ipProtocolItem := range source.IpProtocols {
			ipProtocol := genruntime.ToEnum(string(ipProtocolItem), firewallPolicyRuleNetworkProtocol_Values)
			ipProtocolList[ipProtocolIndex] = ipProtocol
		}
		rule.IpProtocols = ipProtocolList
	} else {
		rule.IpProtocols = nil
	}

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

	// RuleType
	if source.RuleType != nil {
		ruleType := genruntime.ToEnum(string(*source.RuleType), natRule_RuleType_Values)
		rule.RuleType = &ruleType
	} else {
		rule.RuleType = nil
	}

	// SourceAddresses
	rule.SourceAddresses = genruntime.CloneSliceOfString(source.SourceAddresses)

	// SourceIpGroups
	rule.SourceIpGroups = genruntime.CloneSliceOfString(source.SourceIpGroups)

	// TranslatedAddress
	rule.TranslatedAddress = genruntime.ClonePointerToString(source.TranslatedAddress)

	// TranslatedFqdn
	rule.TranslatedFqdn = genruntime.ClonePointerToString(source.TranslatedFqdn)

	// TranslatedPort
	rule.TranslatedPort = genruntime.ClonePointerToString(source.TranslatedPort)

	// No error
	return nil
}

type NatRule_STATUS struct {
	// Description: Description of the rule.
	Description *string `json:"description,omitempty"`

	// DestinationAddresses: List of destination IP addresses or Service Tags.
	DestinationAddresses []string `json:"destinationAddresses,omitempty"`

	// DestinationPorts: List of destination ports.
	DestinationPorts []string `json:"destinationPorts,omitempty"`

	// IpProtocols: Array of FirewallPolicyRuleNetworkProtocols.
	IpProtocols []FirewallPolicyRuleNetworkProtocol_STATUS `json:"ipProtocols,omitempty"`

	// Name: Name of the rule.
	Name *string `json:"name,omitempty"`

	// RuleType: Rule Type.
	RuleType *NatRule_RuleType_STATUS `json:"ruleType,omitempty"`

	// SourceAddresses: List of source IP addresses for this rule.
	SourceAddresses []string `json:"sourceAddresses,omitempty"`

	// SourceIpGroups: List of source IpGroups for this rule.
	SourceIpGroups []string `json:"sourceIpGroups,omitempty"`

	// TranslatedAddress: The translated address for this NAT rule.
	TranslatedAddress *string `json:"translatedAddress,omitempty"`

	// TranslatedFqdn: The translated FQDN for this NAT rule.
	TranslatedFqdn *string `json:"translatedFqdn,omitempty"`

	// TranslatedPort: The translated port for this NAT rule.
	TranslatedPort *string `json:"translatedPort,omitempty"`
}

var _ genruntime.FromARMConverter = &NatRule_STATUS{}

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

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

	// Set property "Description":
	if typedInput.Description != nil {
		description := *typedInput.Description
		rule.Description = &description
	}

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

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

	// Set property "IpProtocols":
	for _, item := range typedInput.IpProtocols {
		var temp string
		temp = string(item)
		rule.IpProtocols = append(rule.IpProtocols, FirewallPolicyRuleNetworkProtocol_STATUS(temp))
	}

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

	// Set property "RuleType":
	var temp NatRule_RuleType_STATUS
	var temp1 string
	temp1 = string(typedInput.RuleType)
	temp = NatRule_RuleType_STATUS(temp1)
	rule.RuleType = &temp

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

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

	// Set property "TranslatedAddress":
	if typedInput.TranslatedAddress != nil {
		translatedAddress := *typedInput.TranslatedAddress
		rule.TranslatedAddress = &translatedAddress
	}

	// Set property "TranslatedFqdn":
	if typedInput.TranslatedFqdn != nil {
		translatedFqdn := *typedInput.TranslatedFqdn
		rule.TranslatedFqdn = &translatedFqdn
	}

	// Set property "TranslatedPort":
	if typedInput.TranslatedPort != nil {
		translatedPort := *typedInput.TranslatedPort
		rule.TranslatedPort = &translatedPort
	}

	// No error
	return nil
}

// AssignProperties_From_NatRule_STATUS populates our NatRule_STATUS from the provided source NatRule_STATUS
func (rule *NatRule_STATUS) AssignProperties_From_NatRule_STATUS(source *storage.NatRule_STATUS) error {

	// Description
	rule.Description = genruntime.ClonePointerToString(source.Description)

	// DestinationAddresses
	rule.DestinationAddresses = genruntime.CloneSliceOfString(source.DestinationAddresses)

	// DestinationPorts
	rule.DestinationPorts = genruntime.CloneSliceOfString(source.DestinationPorts)

	// IpProtocols
	if source.IpProtocols != nil {
		ipProtocolList := make([]FirewallPolicyRuleNetworkProtocol_STATUS, len(source.IpProtocols))
		for ipProtocolIndex, ipProtocolItem := range source.IpProtocols {
			ipProtocolList[ipProtocolIndex] = genruntime.ToEnum(ipProtocolItem, firewallPolicyRuleNetworkProtocol_STATUS_Values)
		}
		rule.IpProtocols = ipProtocolList
	} else {
		rule.IpProtocols = nil
	}

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

	// RuleType
	if source.RuleType != nil {
		ruleType := *source.RuleType
		ruleTypeTemp := genruntime.ToEnum(ruleType, natRule_RuleType_STATUS_Values)
		rule.RuleType = &ruleTypeTemp
	} else {
		rule.RuleType = nil
	}

	// SourceAddresses
	rule.SourceAddresses = genruntime.CloneSliceOfString(source.SourceAddresses)

	// SourceIpGroups
	rule.SourceIpGroups = genruntime.CloneSliceOfString(source.SourceIpGroups)

	// TranslatedAddress
	rule.TranslatedAddress = genruntime.ClonePointerToString(source.TranslatedAddress)

	// TranslatedFqdn
	rule.TranslatedFqdn = genruntime.ClonePointerToString(source.TranslatedFqdn)

	// TranslatedPort
	rule.TranslatedPort = genruntime.ClonePointerToString(source.TranslatedPort)

	// No error
	return nil
}

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

	// Description
	destination.Description = genruntime.ClonePointerToString(rule.Description)

	// DestinationAddresses
	destination.DestinationAddresses = genruntime.CloneSliceOfString(rule.DestinationAddresses)

	// DestinationPorts
	destination.DestinationPorts = genruntime.CloneSliceOfString(rule.DestinationPorts)

	// IpProtocols
	if rule.IpProtocols != nil {
		ipProtocolList := make([]string, len(rule.IpProtocols))
		for ipProtocolIndex, ipProtocolItem := range rule.IpProtocols {
			ipProtocolList[ipProtocolIndex] = string(ipProtocolItem)
		}
		destination.IpProtocols = ipProtocolList
	} else {
		destination.IpProtocols = nil
	}

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

	// RuleType
	if rule.RuleType != nil {
		ruleType := string(*rule.RuleType)
		destination.RuleType = &ruleType
	} else {
		destination.RuleType = nil
	}

	// SourceAddresses
	destination.SourceAddresses = genruntime.CloneSliceOfString(rule.SourceAddresses)

	// SourceIpGroups
	destination.SourceIpGroups = genruntime.CloneSliceOfString(rule.SourceIpGroups)

	// TranslatedAddress
	destination.TranslatedAddress = genruntime.ClonePointerToString(rule.TranslatedAddress)

	// TranslatedFqdn
	destination.TranslatedFqdn = genruntime.ClonePointerToString(rule.TranslatedFqdn)

	// TranslatedPort
	destination.TranslatedPort = genruntime.ClonePointerToString(rule.TranslatedPort)

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

	// No error
	return nil
}

type NetworkRule struct {
	// Description: Description of the rule.
	Description *string `json:"description,omitempty"`

	// DestinationAddresses: List of destination IP addresses or Service Tags.
	DestinationAddresses []string `json:"destinationAddresses,omitempty"`

	// DestinationFqdns: List of destination FQDNs.
	DestinationFqdns []string `json:"destinationFqdns,omitempty"`

	// DestinationIpGroups: List of destination IpGroups for this rule.
	DestinationIpGroups []string `json:"destinationIpGroups,omitempty"`

	// DestinationPorts: List of destination ports.
	DestinationPorts []string `json:"destinationPorts,omitempty"`

	// IpProtocols: Array of FirewallPolicyRuleNetworkProtocols.
	IpProtocols []FirewallPolicyRuleNetworkProtocol `json:"ipProtocols,omitempty"`

	// Name: Name of the rule.
	Name *string `json:"name,omitempty"`

	// +kubebuilder:validation:Required
	// RuleType: Rule Type.
	RuleType *NetworkRule_RuleType `json:"ruleType,omitempty"`

	// SourceAddresses: List of source IP addresses for this rule.
	SourceAddresses []string `json:"sourceAddresses,omitempty"`

	// SourceIpGroups: List of source IpGroups for this rule.
	SourceIpGroups []string `json:"sourceIpGroups,omitempty"`
}

var _ genruntime.ARMTransformer = &NetworkRule{}

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

	// Set property "Description":
	if rule.Description != nil {
		description := *rule.Description
		result.Description = &description
	}

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

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

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

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

	// Set property "IpProtocols":
	for _, item := range rule.IpProtocols {
		var temp string
		temp = string(item)
		result.IpProtocols = append(result.IpProtocols, arm.FirewallPolicyRuleNetworkProtocol(temp))
	}

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

	// Set property "RuleType":
	if rule.RuleType != nil {
		var temp arm.NetworkRule_RuleType
		var temp1 string
		temp1 = string(*rule.RuleType)
		temp = arm.NetworkRule_RuleType(temp1)
		result.RuleType = temp
	}

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

	// Set property "SourceIpGroups":
	for _, item := range rule.SourceIpGroups {
		result.SourceIpGroups = append(result.SourceIpGroups, item)
	}
	return result, nil
}

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

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

	// Set property "Description":
	if typedInput.Description != nil {
		description := *typedInput.Description
		rule.Description = &description
	}

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

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

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

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

	// Set property "IpProtocols":
	for _, item := range typedInput.IpProtocols {
		var temp string
		temp = string(item)
		rule.IpProtocols = append(rule.IpProtocols, FirewallPolicyRuleNetworkProtocol(temp))
	}

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

	// Set property "RuleType":
	var temp NetworkRule_RuleType
	var temp1 string
	temp1 = string(typedInput.RuleType)
	temp = NetworkRule_RuleType(temp1)
	rule.RuleType = &temp

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

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

	// No error
	return nil
}

// AssignProperties_From_NetworkRule populates our NetworkRule from the provided source NetworkRule
func (rule *NetworkRule) AssignProperties_From_NetworkRule(source *storage.NetworkRule) error {

	// Description
	rule.Description = genruntime.ClonePointerToString(source.Description)

	// DestinationAddresses
	rule.DestinationAddresses = genruntime.CloneSliceOfString(source.DestinationAddresses)

	// DestinationFqdns
	rule.DestinationFqdns = genruntime.CloneSliceOfString(source.DestinationFqdns)

	// DestinationIpGroups
	rule.DestinationIpGroups = genruntime.CloneSliceOfString(source.DestinationIpGroups)

	// DestinationPorts
	rule.DestinationPorts = genruntime.CloneSliceOfString(source.DestinationPorts)

	// IpProtocols
	if source.IpProtocols != nil {
		ipProtocolList := make([]FirewallPolicyRuleNetworkProtocol, len(source.IpProtocols))
		for ipProtocolIndex, ipProtocolItem := range source.IpProtocols {
			ipProtocolList[ipProtocolIndex] = genruntime.ToEnum(ipProtocolItem, firewallPolicyRuleNetworkProtocol_Values)
		}
		rule.IpProtocols = ipProtocolList
	} else {
		rule.IpProtocols = nil
	}

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

	// RuleType
	if source.RuleType != nil {
		ruleType := *source.RuleType
		ruleTypeTemp := genruntime.ToEnum(ruleType, networkRule_RuleType_Values)
		rule.RuleType = &ruleTypeTemp
	} else {
		rule.RuleType = nil
	}

	// SourceAddresses
	rule.SourceAddresses = genruntime.CloneSliceOfString(source.SourceAddresses)

	// SourceIpGroups
	rule.SourceIpGroups = genruntime.CloneSliceOfString(source.SourceIpGroups)

	// No error
	return nil
}

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

	// Description
	destination.Description = genruntime.ClonePointerToString(rule.Description)

	// DestinationAddresses
	destination.DestinationAddresses = genruntime.CloneSliceOfString(rule.DestinationAddresses)

	// DestinationFqdns
	destination.DestinationFqdns = genruntime.CloneSliceOfString(rule.DestinationFqdns)

	// DestinationIpGroups
	destination.DestinationIpGroups = genruntime.CloneSliceOfString(rule.DestinationIpGroups)

	// DestinationPorts
	destination.DestinationPorts = genruntime.CloneSliceOfString(rule.DestinationPorts)

	// IpProtocols
	if rule.IpProtocols != nil {
		ipProtocolList := make([]string, len(rule.IpProtocols))
		for ipProtocolIndex, ipProtocolItem := range rule.IpProtocols {
			ipProtocolList[ipProtocolIndex] = string(ipProtocolItem)
		}
		destination.IpProtocols = ipProtocolList
	} else {
		destination.IpProtocols = nil
	}

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

	// RuleType
	if rule.RuleType != nil {
		ruleType := string(*rule.RuleType)
		destination.RuleType = &ruleType
	} else {
		destination.RuleType = nil
	}

	// SourceAddresses
	destination.SourceAddresses = genruntime.CloneSliceOfString(rule.SourceAddresses)

	// SourceIpGroups
	destination.SourceIpGroups = genruntime.CloneSliceOfString(rule.SourceIpGroups)

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

	// No error
	return nil
}

// Initialize_From_NetworkRule_STATUS populates our NetworkRule from the provided source NetworkRule_STATUS
func (rule *NetworkRule) Initialize_From_NetworkRule_STATUS(source *NetworkRule_STATUS) error {

	// Description
	rule.Description = genruntime.ClonePointerToString(source.Description)

	// DestinationAddresses
	rule.DestinationAddresses = genruntime.CloneSliceOfString(source.DestinationAddresses)

	// DestinationFqdns
	rule.DestinationFqdns = genruntime.CloneSliceOfString(source.DestinationFqdns)

	// DestinationIpGroups
	rule.DestinationIpGroups = genruntime.CloneSliceOfString(source.DestinationIpGroups)

	// DestinationPorts
	rule.DestinationPorts = genruntime.CloneSliceOfString(source.DestinationPorts)

	// IpProtocols
	if source.IpProtocols != nil {
		ipProtocolList := make([]FirewallPolicyRuleNetworkProtocol, len(source.IpProtocols))
		for ipProtocolIndex, ipProtocolItem := range source.IpProtocols {
			ipProtocol := genruntime.ToEnum(string(ipProtocolItem), firewallPolicyRuleNetworkProtocol_Values)
			ipProtocolList[ipProtocolIndex] = ipProtocol
		}
		rule.IpProtocols = ipProtocolList
	} else {
		rule.IpProtocols = nil
	}

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

	// RuleType
	if source.RuleType != nil {
		ruleType := genruntime.ToEnum(string(*source.RuleType), networkRule_RuleType_Values)
		rule.RuleType = &ruleType
	} else {
		rule.RuleType = nil
	}

	// SourceAddresses
	rule.SourceAddresses = genruntime.CloneSliceOfString(source.SourceAddresses)

	// SourceIpGroups
	rule.SourceIpGroups = genruntime.CloneSliceOfString(source.SourceIpGroups)

	// No error
	return nil
}

type NetworkRule_STATUS struct {
	// Description: Description of the rule.
	Description *string `json:"description,omitempty"`

	// DestinationAddresses: List of destination IP addresses or Service Tags.
	DestinationAddresses []string `json:"destinationAddresses,omitempty"`

	// DestinationFqdns: List of destination FQDNs.
	DestinationFqdns []string `json:"destinationFqdns,omitempty"`

	// DestinationIpGroups: List of destination IpGroups for this rule.
	DestinationIpGroups []string `json:"destinationIpGroups,omitempty"`

	// DestinationPorts: List of destination ports.
	DestinationPorts []string `json:"destinationPorts,omitempty"`

	// IpProtocols: Array of FirewallPolicyRuleNetworkProtocols.
	IpProtocols []FirewallPolicyRuleNetworkProtocol_STATUS `json:"ipProtocols,omitempty"`

	// Name: Name of the rule.
	Name *string `json:"name,omitempty"`

	// RuleType: Rule Type.
	RuleType *NetworkRule_RuleType_STATUS `json:"ruleType,omitempty"`

	// SourceAddresses: List of source IP addresses for this rule.
	SourceAddresses []string `json:"sourceAddresses,omitempty"`

	// SourceIpGroups: List of source IpGroups for this rule.
	SourceIpGroups []string `json:"sourceIpGroups,omitempty"`
}

var _ genruntime.FromARMConverter = &NetworkRule_STATUS{}

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

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

	// Set property "Description":
	if typedInput.Description != nil {
		description := *typedInput.Description
		rule.Description = &description
	}

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

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

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

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

	// Set property "IpProtocols":
	for _, item := range typedInput.IpProtocols {
		var temp string
		temp = string(item)
		rule.IpProtocols = append(rule.IpProtocols, FirewallPolicyRuleNetworkProtocol_STATUS(temp))
	}

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

	// Set property "RuleType":
	var temp NetworkRule_RuleType_STATUS
	var temp1 string
	temp1 = string(typedInput.RuleType)
	temp = NetworkRule_RuleType_STATUS(temp1)
	rule.RuleType = &temp

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

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

	// No error
	return nil
}

// AssignProperties_From_NetworkRule_STATUS populates our NetworkRule_STATUS from the provided source NetworkRule_STATUS
func (rule *NetworkRule_STATUS) AssignProperties_From_NetworkRule_STATUS(source *storage.NetworkRule_STATUS) error {

	// Description
	rule.Description = genruntime.ClonePointerToString(source.Description)

	// DestinationAddresses
	rule.DestinationAddresses = genruntime.CloneSliceOfString(source.DestinationAddresses)

	// DestinationFqdns
	rule.DestinationFqdns = genruntime.CloneSliceOfString(source.DestinationFqdns)

	// DestinationIpGroups
	rule.DestinationIpGroups = genruntime.CloneSliceOfString(source.DestinationIpGroups)

	// DestinationPorts
	rule.DestinationPorts = genruntime.CloneSliceOfString(source.DestinationPorts)

	// IpProtocols
	if source.IpProtocols != nil {
		ipProtocolList := make([]FirewallPolicyRuleNetworkProtocol_STATUS, len(source.IpProtocols))
		for ipProtocolIndex, ipProtocolItem := range source.IpProtocols {
			ipProtocolList[ipProtocolIndex] = genruntime.ToEnum(ipProtocolItem, firewallPolicyRuleNetworkProtocol_STATUS_Values)
		}
		rule.IpProtocols = ipProtocolList
	} else {
		rule.IpProtocols = nil
	}

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

	// RuleType
	if source.RuleType != nil {
		ruleType := *source.RuleType
		ruleTypeTemp := genruntime.ToEnum(ruleType, networkRule_RuleType_STATUS_Values)
		rule.RuleType = &ruleTypeTemp
	} else {
		rule.RuleType = nil
	}

	// SourceAddresses
	rule.SourceAddresses = genruntime.CloneSliceOfString(source.SourceAddresses)

	// SourceIpGroups
	rule.SourceIpGroups = genruntime.CloneSliceOfString(source.SourceIpGroups)

	// No error
	return nil
}

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

	// Description
	destination.Description = genruntime.ClonePointerToString(rule.Description)

	// DestinationAddresses
	destination.DestinationAddresses = genruntime.CloneSliceOfString(rule.DestinationAddresses)

	// DestinationFqdns
	destination.DestinationFqdns = genruntime.CloneSliceOfString(rule.DestinationFqdns)

	// DestinationIpGroups
	destination.DestinationIpGroups = genruntime.CloneSliceOfString(rule.DestinationIpGroups)

	// DestinationPorts
	destination.DestinationPorts = genruntime.CloneSliceOfString(rule.DestinationPorts)

	// IpProtocols
	if rule.IpProtocols != nil {
		ipProtocolList := make([]string, len(rule.IpProtocols))
		for ipProtocolIndex, ipProtocolItem := range rule.IpProtocols {
			ipProtocolList[ipProtocolIndex] = string(ipProtocolItem)
		}
		destination.IpProtocols = ipProtocolList
	} else {
		destination.IpProtocols = nil
	}

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

	// RuleType
	if rule.RuleType != nil {
		ruleType := string(*rule.RuleType)
		destination.RuleType = &ruleType
	} else {
		destination.RuleType = nil
	}

	// SourceAddresses
	destination.SourceAddresses = genruntime.CloneSliceOfString(rule.SourceAddresses)

	// SourceIpGroups
	destination.SourceIpGroups = genruntime.CloneSliceOfString(rule.SourceIpGroups)

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"ApplicationRule"}
type ApplicationRule_RuleType string

const ApplicationRule_RuleType_ApplicationRule = ApplicationRule_RuleType("ApplicationRule")

// Mapping from string to ApplicationRule_RuleType
var applicationRule_RuleType_Values = map[string]ApplicationRule_RuleType{
	"applicationrule": ApplicationRule_RuleType_ApplicationRule,
}

type ApplicationRule_RuleType_STATUS string

const ApplicationRule_RuleType_STATUS_ApplicationRule = ApplicationRule_RuleType_STATUS("ApplicationRule")

// Mapping from string to ApplicationRule_RuleType_STATUS
var applicationRule_RuleType_STATUS_Values = map[string]ApplicationRule_RuleType_STATUS{
	"applicationrule": ApplicationRule_RuleType_STATUS_ApplicationRule,
}

// name and value of HTTP/S header to insert
type FirewallPolicyHttpHeaderToInsert struct {
	// HeaderName: Contains the name of the header
	HeaderName *string `json:"headerName,omitempty"`

	// HeaderValue: Contains the value of the header
	HeaderValue *string `json:"headerValue,omitempty"`
}

var _ genruntime.ARMTransformer = &FirewallPolicyHttpHeaderToInsert{}

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

	// Set property "HeaderName":
	if insert.HeaderName != nil {
		headerName := *insert.HeaderName
		result.HeaderName = &headerName
	}

	// Set property "HeaderValue":
	if insert.HeaderValue != nil {
		headerValue := *insert.HeaderValue
		result.HeaderValue = &headerValue
	}
	return result, nil
}

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

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

	// Set property "HeaderName":
	if typedInput.HeaderName != nil {
		headerName := *typedInput.HeaderName
		insert.HeaderName = &headerName
	}

	// Set property "HeaderValue":
	if typedInput.HeaderValue != nil {
		headerValue := *typedInput.HeaderValue
		insert.HeaderValue = &headerValue
	}

	// No error
	return nil
}

// AssignProperties_From_FirewallPolicyHttpHeaderToInsert populates our FirewallPolicyHttpHeaderToInsert from the provided source FirewallPolicyHttpHeaderToInsert
func (insert *FirewallPolicyHttpHeaderToInsert) AssignProperties_From_FirewallPolicyHttpHeaderToInsert(source *storage.FirewallPolicyHttpHeaderToInsert) error {

	// HeaderName
	insert.HeaderName = genruntime.ClonePointerToString(source.HeaderName)

	// HeaderValue
	insert.HeaderValue = genruntime.ClonePointerToString(source.HeaderValue)

	// No error
	return nil
}

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

	// HeaderName
	destination.HeaderName = genruntime.ClonePointerToString(insert.HeaderName)

	// HeaderValue
	destination.HeaderValue = genruntime.ClonePointerToString(insert.HeaderValue)

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

	// No error
	return nil
}

// Initialize_From_FirewallPolicyHttpHeaderToInsert_STATUS populates our FirewallPolicyHttpHeaderToInsert from the provided source FirewallPolicyHttpHeaderToInsert_STATUS
func (insert *FirewallPolicyHttpHeaderToInsert) Initialize_From_FirewallPolicyHttpHeaderToInsert_STATUS(source *FirewallPolicyHttpHeaderToInsert_STATUS) error {

	// HeaderName
	insert.HeaderName = genruntime.ClonePointerToString(source.HeaderName)

	// HeaderValue
	insert.HeaderValue = genruntime.ClonePointerToString(source.HeaderValue)

	// No error
	return nil
}

// name and value of HTTP/S header to insert
type FirewallPolicyHttpHeaderToInsert_STATUS struct {
	// HeaderName: Contains the name of the header
	HeaderName *string `json:"headerName,omitempty"`

	// HeaderValue: Contains the value of the header
	HeaderValue *string `json:"headerValue,omitempty"`
}

var _ genruntime.FromARMConverter = &FirewallPolicyHttpHeaderToInsert_STATUS{}

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

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

	// Set property "HeaderName":
	if typedInput.HeaderName != nil {
		headerName := *typedInput.HeaderName
		insert.HeaderName = &headerName
	}

	// Set property "HeaderValue":
	if typedInput.HeaderValue != nil {
		headerValue := *typedInput.HeaderValue
		insert.HeaderValue = &headerValue
	}

	// No error
	return nil
}

// AssignProperties_From_FirewallPolicyHttpHeaderToInsert_STATUS populates our FirewallPolicyHttpHeaderToInsert_STATUS from the provided source FirewallPolicyHttpHeaderToInsert_STATUS
func (insert *FirewallPolicyHttpHeaderToInsert_STATUS) AssignProperties_From_FirewallPolicyHttpHeaderToInsert_STATUS(source *storage.FirewallPolicyHttpHeaderToInsert_STATUS) error {

	// HeaderName
	insert.HeaderName = genruntime.ClonePointerToString(source.HeaderName)

	// HeaderValue
	insert.HeaderValue = genruntime.ClonePointerToString(source.HeaderValue)

	// No error
	return nil
}

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

	// HeaderName
	destination.HeaderName = genruntime.ClonePointerToString(insert.HeaderName)

	// HeaderValue
	destination.HeaderValue = genruntime.ClonePointerToString(insert.HeaderValue)

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

	// No error
	return nil
}

// Properties of the application rule protocol.
type FirewallPolicyRuleApplicationProtocol struct {
	// +kubebuilder:validation:Maximum=64000
	// +kubebuilder:validation:Minimum=0
	// Port: Port number for the protocol, cannot be greater than 64000.
	Port *int `json:"port,omitempty"`

	// ProtocolType: Protocol type.
	ProtocolType *FirewallPolicyRuleApplicationProtocolType `json:"protocolType,omitempty"`
}

var _ genruntime.ARMTransformer = &FirewallPolicyRuleApplicationProtocol{}

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

	// Set property "Port":
	if protocol.Port != nil {
		port := *protocol.Port
		result.Port = &port
	}

	// Set property "ProtocolType":
	if protocol.ProtocolType != nil {
		var temp string
		temp = string(*protocol.ProtocolType)
		protocolType := arm.FirewallPolicyRuleApplicationProtocolType(temp)
		result.ProtocolType = &protocolType
	}
	return result, nil
}

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

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

	// Set property "Port":
	if typedInput.Port != nil {
		port := *typedInput.Port
		protocol.Port = &port
	}

	// Set property "ProtocolType":
	if typedInput.ProtocolType != nil {
		var temp string
		temp = string(*typedInput.ProtocolType)
		protocolType := FirewallPolicyRuleApplicationProtocolType(temp)
		protocol.ProtocolType = &protocolType
	}

	// No error
	return nil
}

// AssignProperties_From_FirewallPolicyRuleApplicationProtocol populates our FirewallPolicyRuleApplicationProtocol from the provided source FirewallPolicyRuleApplicationProtocol
func (protocol *FirewallPolicyRuleApplicationProtocol) AssignProperties_From_FirewallPolicyRuleApplicationProtocol(source *storage.FirewallPolicyRuleApplicationProtocol) error {

	// Port
	protocol.Port = genruntime.ClonePointerToInt(source.Port)

	// ProtocolType
	if source.ProtocolType != nil {
		protocolType := *source.ProtocolType
		protocolTypeTemp := genruntime.ToEnum(protocolType, firewallPolicyRuleApplicationProtocolType_Values)
		protocol.ProtocolType = &protocolTypeTemp
	} else {
		protocol.ProtocolType = nil
	}

	// No error
	return nil
}

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

	// Port
	destination.Port = genruntime.ClonePointerToInt(protocol.Port)

	// ProtocolType
	if protocol.ProtocolType != nil {
		protocolType := string(*protocol.ProtocolType)
		destination.ProtocolType = &protocolType
	} else {
		destination.ProtocolType = nil
	}

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

	// No error
	return nil
}

// Initialize_From_FirewallPolicyRuleApplicationProtocol_STATUS populates our FirewallPolicyRuleApplicationProtocol from the provided source FirewallPolicyRuleApplicationProtocol_STATUS
func (protocol *FirewallPolicyRuleApplicationProtocol) Initialize_From_FirewallPolicyRuleApplicationProtocol_STATUS(source *FirewallPolicyRuleApplicationProtocol_STATUS) error {

	// Port
	protocol.Port = genruntime.ClonePointerToInt(source.Port)

	// ProtocolType
	if source.ProtocolType != nil {
		protocolType := genruntime.ToEnum(string(*source.ProtocolType), firewallPolicyRuleApplicationProtocolType_Values)
		protocol.ProtocolType = &protocolType
	} else {
		protocol.ProtocolType = nil
	}

	// No error
	return nil
}

// Properties of the application rule protocol.
type FirewallPolicyRuleApplicationProtocol_STATUS struct {
	// Port: Port number for the protocol, cannot be greater than 64000.
	Port *int `json:"port,omitempty"`

	// ProtocolType: Protocol type.
	ProtocolType *FirewallPolicyRuleApplicationProtocolType_STATUS `json:"protocolType,omitempty"`
}

var _ genruntime.FromARMConverter = &FirewallPolicyRuleApplicationProtocol_STATUS{}

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

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

	// Set property "Port":
	if typedInput.Port != nil {
		port := *typedInput.Port
		protocol.Port = &port
	}

	// Set property "ProtocolType":
	if typedInput.ProtocolType != nil {
		var temp string
		temp = string(*typedInput.ProtocolType)
		protocolType := FirewallPolicyRuleApplicationProtocolType_STATUS(temp)
		protocol.ProtocolType = &protocolType
	}

	// No error
	return nil
}

// AssignProperties_From_FirewallPolicyRuleApplicationProtocol_STATUS populates our FirewallPolicyRuleApplicationProtocol_STATUS from the provided source FirewallPolicyRuleApplicationProtocol_STATUS
func (protocol *FirewallPolicyRuleApplicationProtocol_STATUS) AssignProperties_From_FirewallPolicyRuleApplicationProtocol_STATUS(source *storage.FirewallPolicyRuleApplicationProtocol_STATUS) error {

	// Port
	protocol.Port = genruntime.ClonePointerToInt(source.Port)

	// ProtocolType
	if source.ProtocolType != nil {
		protocolType := *source.ProtocolType
		protocolTypeTemp := genruntime.ToEnum(protocolType, firewallPolicyRuleApplicationProtocolType_STATUS_Values)
		protocol.ProtocolType = &protocolTypeTemp
	} else {
		protocol.ProtocolType = nil
	}

	// No error
	return nil
}

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

	// Port
	destination.Port = genruntime.ClonePointerToInt(protocol.Port)

	// ProtocolType
	if protocol.ProtocolType != nil {
		protocolType := string(*protocol.ProtocolType)
		destination.ProtocolType = &protocolType
	} else {
		destination.ProtocolType = nil
	}

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

	// No error
	return nil
}

// The Network protocol of a Rule.
// +kubebuilder:validation:Enum={"Any","ICMP","TCP","UDP"}
type FirewallPolicyRuleNetworkProtocol string

const (
	FirewallPolicyRuleNetworkProtocol_Any  = FirewallPolicyRuleNetworkProtocol("Any")
	FirewallPolicyRuleNetworkProtocol_ICMP = FirewallPolicyRuleNetworkProtocol("ICMP")
	FirewallPolicyRuleNetworkProtocol_TCP  = FirewallPolicyRuleNetworkProtocol("TCP")
	FirewallPolicyRuleNetworkProtocol_UDP  = FirewallPolicyRuleNetworkProtocol("UDP")
)

// Mapping from string to FirewallPolicyRuleNetworkProtocol
var firewallPolicyRuleNetworkProtocol_Values = map[string]FirewallPolicyRuleNetworkProtocol{
	"any":  FirewallPolicyRuleNetworkProtocol_Any,
	"icmp": FirewallPolicyRuleNetworkProtocol_ICMP,
	"tcp":  FirewallPolicyRuleNetworkProtocol_TCP,
	"udp":  FirewallPolicyRuleNetworkProtocol_UDP,
}

// The Network protocol of a Rule.
type FirewallPolicyRuleNetworkProtocol_STATUS string

const (
	FirewallPolicyRuleNetworkProtocol_STATUS_Any  = FirewallPolicyRuleNetworkProtocol_STATUS("Any")
	FirewallPolicyRuleNetworkProtocol_STATUS_ICMP = FirewallPolicyRuleNetworkProtocol_STATUS("ICMP")
	FirewallPolicyRuleNetworkProtocol_STATUS_TCP  = FirewallPolicyRuleNetworkProtocol_STATUS("TCP")
	FirewallPolicyRuleNetworkProtocol_STATUS_UDP  = FirewallPolicyRuleNetworkProtocol_STATUS("UDP")
)

// Mapping from string to FirewallPolicyRuleNetworkProtocol_STATUS
var firewallPolicyRuleNetworkProtocol_STATUS_Values = map[string]FirewallPolicyRuleNetworkProtocol_STATUS{
	"any":  FirewallPolicyRuleNetworkProtocol_STATUS_Any,
	"icmp": FirewallPolicyRuleNetworkProtocol_STATUS_ICMP,
	"tcp":  FirewallPolicyRuleNetworkProtocol_STATUS_TCP,
	"udp":  FirewallPolicyRuleNetworkProtocol_STATUS_UDP,
}

// +kubebuilder:validation:Enum={"NatRule"}
type NatRule_RuleType string

const NatRule_RuleType_NatRule = NatRule_RuleType("NatRule")

// Mapping from string to NatRule_RuleType
var natRule_RuleType_Values = map[string]NatRule_RuleType{
	"natrule": NatRule_RuleType_NatRule,
}

type NatRule_RuleType_STATUS string

const NatRule_RuleType_STATUS_NatRule = NatRule_RuleType_STATUS("NatRule")

// Mapping from string to NatRule_RuleType_STATUS
var natRule_RuleType_STATUS_Values = map[string]NatRule_RuleType_STATUS{
	"natrule": NatRule_RuleType_STATUS_NatRule,
}

// +kubebuilder:validation:Enum={"NetworkRule"}
type NetworkRule_RuleType string

const NetworkRule_RuleType_NetworkRule = NetworkRule_RuleType("NetworkRule")

// Mapping from string to NetworkRule_RuleType
var networkRule_RuleType_Values = map[string]NetworkRule_RuleType{
	"networkrule": NetworkRule_RuleType_NetworkRule,
}

type NetworkRule_RuleType_STATUS string

const NetworkRule_RuleType_STATUS_NetworkRule = NetworkRule_RuleType_STATUS("NetworkRule")

// Mapping from string to NetworkRule_RuleType_STATUS
var networkRule_RuleType_STATUS_Values = map[string]NetworkRule_RuleType_STATUS{
	"networkrule": NetworkRule_RuleType_STATUS_NetworkRule,
}

// The application protocol type of a Rule.
// +kubebuilder:validation:Enum={"Http","Https"}
type FirewallPolicyRuleApplicationProtocolType string

const (
	FirewallPolicyRuleApplicationProtocolType_Http  = FirewallPolicyRuleApplicationProtocolType("Http")
	FirewallPolicyRuleApplicationProtocolType_Https = FirewallPolicyRuleApplicationProtocolType("Https")
)

// Mapping from string to FirewallPolicyRuleApplicationProtocolType
var firewallPolicyRuleApplicationProtocolType_Values = map[string]FirewallPolicyRuleApplicationProtocolType{
	"http":  FirewallPolicyRuleApplicationProtocolType_Http,
	"https": FirewallPolicyRuleApplicationProtocolType_Https,
}

// The application protocol type of a Rule.
type FirewallPolicyRuleApplicationProtocolType_STATUS string

const (
	FirewallPolicyRuleApplicationProtocolType_STATUS_Http  = FirewallPolicyRuleApplicationProtocolType_STATUS("Http")
	FirewallPolicyRuleApplicationProtocolType_STATUS_Https = FirewallPolicyRuleApplicationProtocolType_STATUS("Https")
)

// Mapping from string to FirewallPolicyRuleApplicationProtocolType_STATUS
var firewallPolicyRuleApplicationProtocolType_STATUS_Values = map[string]FirewallPolicyRuleApplicationProtocolType_STATUS{
	"http":  FirewallPolicyRuleApplicationProtocolType_STATUS_Http,
	"https": FirewallPolicyRuleApplicationProtocolType_STATUS_Https,
}

func init() {
	SchemeBuilder.Register(&FirewallPoliciesRuleCollectionGroup{}, &FirewallPoliciesRuleCollectionGroupList{})
}
