// 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/publicIpPrefix.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}
type PublicIPPrefix struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              PublicIPPrefix_Spec   `json:"spec,omitempty"`
	Status            PublicIPPrefix_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &PublicIPPrefix{}

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

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

var _ conversion.Convertible = &PublicIPPrefix{}

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

	return prefix.AssignProperties_From_PublicIPPrefix(source)
}

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

	return prefix.AssignProperties_To_PublicIPPrefix(destination)
}

var _ configmaps.Exporter = &PublicIPPrefix{}

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

var _ secrets.Exporter = &PublicIPPrefix{}

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

var _ genruntime.ImportableResource = &PublicIPPrefix{}

// InitializeSpec initializes the spec for this resource from the given status
func (prefix *PublicIPPrefix) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*PublicIPPrefix_STATUS); ok {
		return prefix.Spec.Initialize_From_PublicIPPrefix_STATUS(s)
	}

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

var _ genruntime.KubernetesResource = &PublicIPPrefix{}

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

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

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

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

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

// GetSupportedOperations returns the operations supported by the resource
func (prefix *PublicIPPrefix) 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/publicIPPrefixes"
func (prefix *PublicIPPrefix) GetType() string {
	return "Microsoft.Network/publicIPPrefixes"
}

// NewEmptyStatus returns a new empty (blank) status
func (prefix *PublicIPPrefix) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &PublicIPPrefix_STATUS{}
}

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

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

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

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

	prefix.Status = st
	return nil
}

// AssignProperties_From_PublicIPPrefix populates our PublicIPPrefix from the provided source PublicIPPrefix
func (prefix *PublicIPPrefix) AssignProperties_From_PublicIPPrefix(source *storage.PublicIPPrefix) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_PublicIPPrefix populates the provided destination PublicIPPrefix from our PublicIPPrefix
func (prefix *PublicIPPrefix) AssignProperties_To_PublicIPPrefix(destination *storage.PublicIPPrefix) error {

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

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

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

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

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

	// CustomIPPrefix: The customIpPrefix that this prefix is associated with.
	CustomIPPrefix *SubResource `json:"customIPPrefix,omitempty"`

	// ExtendedLocation: The extended location of the public ip address.
	ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"`

	// IpTags: The list of tags associated with the public IP prefix.
	IpTags []IpTag `json:"ipTags,omitempty"`

	// Location: Resource location.
	Location *string `json:"location,omitempty"`

	// NatGateway: NatGateway of Public IP Prefix.
	NatGateway *NatGatewaySpec_PublicIPPrefix_SubResourceEmbedded `json:"natGateway,omitempty"`

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

	// PrefixLength: The Length of the Public IP Prefix.
	PrefixLength *int `json:"prefixLength,omitempty"`

	// PublicIPAddressVersion: The public IP address version.
	PublicIPAddressVersion *IPVersion `json:"publicIPAddressVersion,omitempty"`

	// Sku: The public IP prefix SKU.
	Sku *PublicIPPrefixSku `json:"sku,omitempty"`

	// Tags: Resource tags.
	Tags map[string]string `json:"tags,omitempty"`

	// Zones: A list of availability zones denoting the IP allocated for the resource needs to come from.
	Zones []string `json:"zones,omitempty"`
}

var _ genruntime.ARMTransformer = &PublicIPPrefix_Spec{}

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

	// Set property "ExtendedLocation":
	if prefix.ExtendedLocation != nil {
		extendedLocation_ARM, err := prefix.ExtendedLocation.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		extendedLocation := *extendedLocation_ARM.(*arm.ExtendedLocation)
		result.ExtendedLocation = &extendedLocation
	}

	// Set property "Location":
	if prefix.Location != nil {
		location := *prefix.Location
		result.Location = &location
	}

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

	// Set property "Properties":
	if prefix.CustomIPPrefix != nil ||
		prefix.IpTags != nil ||
		prefix.NatGateway != nil ||
		prefix.PrefixLength != nil ||
		prefix.PublicIPAddressVersion != nil {
		result.Properties = &arm.PublicIPPrefixPropertiesFormat{}
	}
	if prefix.CustomIPPrefix != nil {
		customIPPrefix_ARM, err := prefix.CustomIPPrefix.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		customIPPrefix := *customIPPrefix_ARM.(*arm.SubResource)
		result.Properties.CustomIPPrefix = &customIPPrefix
	}
	for _, item := range prefix.IpTags {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.IpTags = append(result.Properties.IpTags, *item_ARM.(*arm.IpTag))
	}
	if prefix.NatGateway != nil {
		natGateway_ARM, err := prefix.NatGateway.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		natGateway := *natGateway_ARM.(*arm.NatGatewaySpec_PublicIPPrefix_SubResourceEmbedded)
		result.Properties.NatGateway = &natGateway
	}
	if prefix.PrefixLength != nil {
		prefixLength := *prefix.PrefixLength
		result.Properties.PrefixLength = &prefixLength
	}
	if prefix.PublicIPAddressVersion != nil {
		var temp string
		temp = string(*prefix.PublicIPAddressVersion)
		publicIPAddressVersion := arm.IPVersion(temp)
		result.Properties.PublicIPAddressVersion = &publicIPAddressVersion
	}

	// Set property "Sku":
	if prefix.Sku != nil {
		sku_ARM, err := prefix.Sku.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		sku := *sku_ARM.(*arm.PublicIPPrefixSku)
		result.Sku = &sku
	}

	// Set property "Tags":
	if prefix.Tags != nil {
		result.Tags = make(map[string]string, len(prefix.Tags))
		for key, value := range prefix.Tags {
			result.Tags[key] = value
		}
	}

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

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

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

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

	// Set property "CustomIPPrefix":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CustomIPPrefix != nil {
			var customIPPrefix1 SubResource
			err := customIPPrefix1.PopulateFromARM(owner, *typedInput.Properties.CustomIPPrefix)
			if err != nil {
				return err
			}
			customIPPrefix := customIPPrefix1
			prefix.CustomIPPrefix = &customIPPrefix
		}
	}

	// Set property "ExtendedLocation":
	if typedInput.ExtendedLocation != nil {
		var extendedLocation1 ExtendedLocation
		err := extendedLocation1.PopulateFromARM(owner, *typedInput.ExtendedLocation)
		if err != nil {
			return err
		}
		extendedLocation := extendedLocation1
		prefix.ExtendedLocation = &extendedLocation
	}

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

	// Set property "Location":
	if typedInput.Location != nil {
		location := *typedInput.Location
		prefix.Location = &location
	}

	// Set property "NatGateway":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NatGateway != nil {
			var natGateway1 NatGatewaySpec_PublicIPPrefix_SubResourceEmbedded
			err := natGateway1.PopulateFromARM(owner, *typedInput.Properties.NatGateway)
			if err != nil {
				return err
			}
			natGateway := natGateway1
			prefix.NatGateway = &natGateway
		}
	}

	// no assignment for property "OperatorSpec"

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

	// Set property "PrefixLength":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PrefixLength != nil {
			prefixLength := *typedInput.Properties.PrefixLength
			prefix.PrefixLength = &prefixLength
		}
	}

	// Set property "PublicIPAddressVersion":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PublicIPAddressVersion != nil {
			var temp string
			temp = string(*typedInput.Properties.PublicIPAddressVersion)
			publicIPAddressVersion := IPVersion(temp)
			prefix.PublicIPAddressVersion = &publicIPAddressVersion
		}
	}

	// Set property "Sku":
	if typedInput.Sku != nil {
		var sku1 PublicIPPrefixSku
		err := sku1.PopulateFromARM(owner, *typedInput.Sku)
		if err != nil {
			return err
		}
		sku := sku1
		prefix.Sku = &sku
	}

	// Set property "Tags":
	if typedInput.Tags != nil {
		prefix.Tags = make(map[string]string, len(typedInput.Tags))
		for key, value := range typedInput.Tags {
			prefix.Tags[key] = value
		}
	}

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

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &PublicIPPrefix_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.PublicIPPrefix_Spec{}
	err := prefix.AssignProperties_To_PublicIPPrefix_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_PublicIPPrefix_Spec populates our PublicIPPrefix_Spec from the provided source PublicIPPrefix_Spec
func (prefix *PublicIPPrefix_Spec) AssignProperties_From_PublicIPPrefix_Spec(source *storage.PublicIPPrefix_Spec) error {

	// AzureName
	prefix.AzureName = source.AzureName

	// CustomIPPrefix
	if source.CustomIPPrefix != nil {
		var customIPPrefix SubResource
		err := customIPPrefix.AssignProperties_From_SubResource(source.CustomIPPrefix)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource() to populate field CustomIPPrefix")
		}
		prefix.CustomIPPrefix = &customIPPrefix
	} else {
		prefix.CustomIPPrefix = nil
	}

	// ExtendedLocation
	if source.ExtendedLocation != nil {
		var extendedLocation ExtendedLocation
		err := extendedLocation.AssignProperties_From_ExtendedLocation(source.ExtendedLocation)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ExtendedLocation() to populate field ExtendedLocation")
		}
		prefix.ExtendedLocation = &extendedLocation
	} else {
		prefix.ExtendedLocation = nil
	}

	// IpTags
	if source.IpTags != nil {
		ipTagList := make([]IpTag, len(source.IpTags))
		for ipTagIndex, ipTagItem := range source.IpTags {
			var ipTag IpTag
			err := ipTag.AssignProperties_From_IpTag(&ipTagItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_IpTag() to populate field IpTags")
			}
			ipTagList[ipTagIndex] = ipTag
		}
		prefix.IpTags = ipTagList
	} else {
		prefix.IpTags = nil
	}

	// Location
	prefix.Location = genruntime.ClonePointerToString(source.Location)

	// NatGateway
	if source.NatGateway != nil {
		var natGateway NatGatewaySpec_PublicIPPrefix_SubResourceEmbedded
		err := natGateway.AssignProperties_From_NatGatewaySpec_PublicIPPrefix_SubResourceEmbedded(source.NatGateway)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_NatGatewaySpec_PublicIPPrefix_SubResourceEmbedded() to populate field NatGateway")
		}
		prefix.NatGateway = &natGateway
	} else {
		prefix.NatGateway = nil
	}

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

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

	// PrefixLength
	prefix.PrefixLength = genruntime.ClonePointerToInt(source.PrefixLength)

	// PublicIPAddressVersion
	if source.PublicIPAddressVersion != nil {
		publicIPAddressVersion := *source.PublicIPAddressVersion
		publicIPAddressVersionTemp := genruntime.ToEnum(publicIPAddressVersion, iPVersion_Values)
		prefix.PublicIPAddressVersion = &publicIPAddressVersionTemp
	} else {
		prefix.PublicIPAddressVersion = nil
	}

	// Sku
	if source.Sku != nil {
		var sku PublicIPPrefixSku
		err := sku.AssignProperties_From_PublicIPPrefixSku(source.Sku)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_PublicIPPrefixSku() to populate field Sku")
		}
		prefix.Sku = &sku
	} else {
		prefix.Sku = nil
	}

	// Tags
	prefix.Tags = genruntime.CloneMapOfStringToString(source.Tags)

	// Zones
	prefix.Zones = genruntime.CloneSliceOfString(source.Zones)

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = prefix.AzureName

	// CustomIPPrefix
	if prefix.CustomIPPrefix != nil {
		var customIPPrefix storage.SubResource
		err := prefix.CustomIPPrefix.AssignProperties_To_SubResource(&customIPPrefix)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource() to populate field CustomIPPrefix")
		}
		destination.CustomIPPrefix = &customIPPrefix
	} else {
		destination.CustomIPPrefix = nil
	}

	// ExtendedLocation
	if prefix.ExtendedLocation != nil {
		var extendedLocation storage.ExtendedLocation
		err := prefix.ExtendedLocation.AssignProperties_To_ExtendedLocation(&extendedLocation)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ExtendedLocation() to populate field ExtendedLocation")
		}
		destination.ExtendedLocation = &extendedLocation
	} else {
		destination.ExtendedLocation = nil
	}

	// IpTags
	if prefix.IpTags != nil {
		ipTagList := make([]storage.IpTag, len(prefix.IpTags))
		for ipTagIndex, ipTagItem := range prefix.IpTags {
			var ipTag storage.IpTag
			err := ipTagItem.AssignProperties_To_IpTag(&ipTag)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_IpTag() to populate field IpTags")
			}
			ipTagList[ipTagIndex] = ipTag
		}
		destination.IpTags = ipTagList
	} else {
		destination.IpTags = nil
	}

	// Location
	destination.Location = genruntime.ClonePointerToString(prefix.Location)

	// NatGateway
	if prefix.NatGateway != nil {
		var natGateway storage.NatGatewaySpec_PublicIPPrefix_SubResourceEmbedded
		err := prefix.NatGateway.AssignProperties_To_NatGatewaySpec_PublicIPPrefix_SubResourceEmbedded(&natGateway)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_NatGatewaySpec_PublicIPPrefix_SubResourceEmbedded() to populate field NatGateway")
		}
		destination.NatGateway = &natGateway
	} else {
		destination.NatGateway = nil
	}

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

	// OriginalVersion
	destination.OriginalVersion = prefix.OriginalVersion()

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

	// PrefixLength
	destination.PrefixLength = genruntime.ClonePointerToInt(prefix.PrefixLength)

	// PublicIPAddressVersion
	if prefix.PublicIPAddressVersion != nil {
		publicIPAddressVersion := string(*prefix.PublicIPAddressVersion)
		destination.PublicIPAddressVersion = &publicIPAddressVersion
	} else {
		destination.PublicIPAddressVersion = nil
	}

	// Sku
	if prefix.Sku != nil {
		var sku storage.PublicIPPrefixSku
		err := prefix.Sku.AssignProperties_To_PublicIPPrefixSku(&sku)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_PublicIPPrefixSku() to populate field Sku")
		}
		destination.Sku = &sku
	} else {
		destination.Sku = nil
	}

	// Tags
	destination.Tags = genruntime.CloneMapOfStringToString(prefix.Tags)

	// Zones
	destination.Zones = genruntime.CloneSliceOfString(prefix.Zones)

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

	// No error
	return nil
}

// Initialize_From_PublicIPPrefix_STATUS populates our PublicIPPrefix_Spec from the provided source PublicIPPrefix_STATUS
func (prefix *PublicIPPrefix_Spec) Initialize_From_PublicIPPrefix_STATUS(source *PublicIPPrefix_STATUS) error {

	// CustomIPPrefix
	if source.CustomIPPrefix != nil {
		var customIPPrefix SubResource
		err := customIPPrefix.Initialize_From_SubResource_STATUS(source.CustomIPPrefix)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_SubResource_STATUS() to populate field CustomIPPrefix")
		}
		prefix.CustomIPPrefix = &customIPPrefix
	} else {
		prefix.CustomIPPrefix = nil
	}

	// ExtendedLocation
	if source.ExtendedLocation != nil {
		var extendedLocation ExtendedLocation
		err := extendedLocation.Initialize_From_ExtendedLocation_STATUS(source.ExtendedLocation)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_ExtendedLocation_STATUS() to populate field ExtendedLocation")
		}
		prefix.ExtendedLocation = &extendedLocation
	} else {
		prefix.ExtendedLocation = nil
	}

	// IpTags
	if source.IpTags != nil {
		ipTagList := make([]IpTag, len(source.IpTags))
		for ipTagIndex, ipTagItem := range source.IpTags {
			var ipTag IpTag
			err := ipTag.Initialize_From_IpTag_STATUS(&ipTagItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_IpTag_STATUS() to populate field IpTags")
			}
			ipTagList[ipTagIndex] = ipTag
		}
		prefix.IpTags = ipTagList
	} else {
		prefix.IpTags = nil
	}

	// Location
	prefix.Location = genruntime.ClonePointerToString(source.Location)

	// NatGateway
	if source.NatGateway != nil {
		var natGateway NatGatewaySpec_PublicIPPrefix_SubResourceEmbedded
		err := natGateway.Initialize_From_NatGateway_STATUS_PublicIPPrefix_SubResourceEmbedded(source.NatGateway)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_NatGateway_STATUS_PublicIPPrefix_SubResourceEmbedded() to populate field NatGateway")
		}
		prefix.NatGateway = &natGateway
	} else {
		prefix.NatGateway = nil
	}

	// PrefixLength
	prefix.PrefixLength = genruntime.ClonePointerToInt(source.PrefixLength)

	// PublicIPAddressVersion
	if source.PublicIPAddressVersion != nil {
		publicIPAddressVersion := genruntime.ToEnum(string(*source.PublicIPAddressVersion), iPVersion_Values)
		prefix.PublicIPAddressVersion = &publicIPAddressVersion
	} else {
		prefix.PublicIPAddressVersion = nil
	}

	// Sku
	if source.Sku != nil {
		var sku PublicIPPrefixSku
		err := sku.Initialize_From_PublicIPPrefixSku_STATUS(source.Sku)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_PublicIPPrefixSku_STATUS() to populate field Sku")
		}
		prefix.Sku = &sku
	} else {
		prefix.Sku = nil
	}

	// Tags
	prefix.Tags = genruntime.CloneMapOfStringToString(source.Tags)

	// Zones
	prefix.Zones = genruntime.CloneSliceOfString(source.Zones)

	// No error
	return nil
}

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

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

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

	// CustomIPPrefix: The customIpPrefix that this prefix is associated with.
	CustomIPPrefix *SubResource_STATUS `json:"customIPPrefix,omitempty"`

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

	// ExtendedLocation: The extended location of the public ip address.
	ExtendedLocation *ExtendedLocation_STATUS `json:"extendedLocation,omitempty"`

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

	// IpPrefix: The allocated Prefix.
	IpPrefix *string `json:"ipPrefix,omitempty"`

	// IpTags: The list of tags associated with the public IP prefix.
	IpTags []IpTag_STATUS `json:"ipTags,omitempty"`

	// LoadBalancerFrontendIpConfiguration: The reference to load balancer frontend IP configuration associated with the public
	// IP prefix.
	LoadBalancerFrontendIpConfiguration *SubResource_STATUS `json:"loadBalancerFrontendIpConfiguration,omitempty"`

	// Location: Resource location.
	Location *string `json:"location,omitempty"`

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

	// NatGateway: NatGateway of Public IP Prefix.
	NatGateway *NatGateway_STATUS_PublicIPPrefix_SubResourceEmbedded `json:"natGateway,omitempty"`

	// PrefixLength: The Length of the Public IP Prefix.
	PrefixLength *int `json:"prefixLength,omitempty"`

	// ProvisioningState: The provisioning state of the public IP prefix resource.
	ProvisioningState *ProvisioningState_STATUS `json:"provisioningState,omitempty"`

	// PublicIPAddressVersion: The public IP address version.
	PublicIPAddressVersion *IPVersion_STATUS `json:"publicIPAddressVersion,omitempty"`

	// PublicIPAddresses: The list of all referenced PublicIPAddresses.
	PublicIPAddresses []ReferencedPublicIpAddress_STATUS `json:"publicIPAddresses,omitempty"`

	// ResourceGuid: The resource GUID property of the public IP prefix resource.
	ResourceGuid *string `json:"resourceGuid,omitempty"`

	// Sku: The public IP prefix SKU.
	Sku *PublicIPPrefixSku_STATUS `json:"sku,omitempty"`

	// Tags: Resource tags.
	Tags map[string]string `json:"tags,omitempty"`

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

	// Zones: A list of availability zones denoting the IP allocated for the resource needs to come from.
	Zones []string `json:"zones,omitempty"`
}

var _ genruntime.ConvertibleStatus = &PublicIPPrefix_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.PublicIPPrefix_STATUS{}
	err := prefix.AssignProperties_To_PublicIPPrefix_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 = &PublicIPPrefix_STATUS{}

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

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

	// no assignment for property "Conditions"

	// Set property "CustomIPPrefix":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CustomIPPrefix != nil {
			var customIPPrefix1 SubResource_STATUS
			err := customIPPrefix1.PopulateFromARM(owner, *typedInput.Properties.CustomIPPrefix)
			if err != nil {
				return err
			}
			customIPPrefix := customIPPrefix1
			prefix.CustomIPPrefix = &customIPPrefix
		}
	}

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

	// Set property "ExtendedLocation":
	if typedInput.ExtendedLocation != nil {
		var extendedLocation1 ExtendedLocation_STATUS
		err := extendedLocation1.PopulateFromARM(owner, *typedInput.ExtendedLocation)
		if err != nil {
			return err
		}
		extendedLocation := extendedLocation1
		prefix.ExtendedLocation = &extendedLocation
	}

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

	// Set property "IpPrefix":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IpPrefix != nil {
			ipPrefix := *typedInput.Properties.IpPrefix
			prefix.IpPrefix = &ipPrefix
		}
	}

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

	// Set property "LoadBalancerFrontendIpConfiguration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.LoadBalancerFrontendIpConfiguration != nil {
			var loadBalancerFrontendIpConfiguration1 SubResource_STATUS
			err := loadBalancerFrontendIpConfiguration1.PopulateFromARM(owner, *typedInput.Properties.LoadBalancerFrontendIpConfiguration)
			if err != nil {
				return err
			}
			loadBalancerFrontendIpConfiguration := loadBalancerFrontendIpConfiguration1
			prefix.LoadBalancerFrontendIpConfiguration = &loadBalancerFrontendIpConfiguration
		}
	}

	// Set property "Location":
	if typedInput.Location != nil {
		location := *typedInput.Location
		prefix.Location = &location
	}

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

	// Set property "NatGateway":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NatGateway != nil {
			var natGateway1 NatGateway_STATUS_PublicIPPrefix_SubResourceEmbedded
			err := natGateway1.PopulateFromARM(owner, *typedInput.Properties.NatGateway)
			if err != nil {
				return err
			}
			natGateway := natGateway1
			prefix.NatGateway = &natGateway
		}
	}

	// Set property "PrefixLength":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PrefixLength != nil {
			prefixLength := *typedInput.Properties.PrefixLength
			prefix.PrefixLength = &prefixLength
		}
	}

	// 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)
			prefix.ProvisioningState = &provisioningState
		}
	}

	// Set property "PublicIPAddressVersion":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PublicIPAddressVersion != nil {
			var temp string
			temp = string(*typedInput.Properties.PublicIPAddressVersion)
			publicIPAddressVersion := IPVersion_STATUS(temp)
			prefix.PublicIPAddressVersion = &publicIPAddressVersion
		}
	}

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

	// Set property "ResourceGuid":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ResourceGuid != nil {
			resourceGuid := *typedInput.Properties.ResourceGuid
			prefix.ResourceGuid = &resourceGuid
		}
	}

	// Set property "Sku":
	if typedInput.Sku != nil {
		var sku1 PublicIPPrefixSku_STATUS
		err := sku1.PopulateFromARM(owner, *typedInput.Sku)
		if err != nil {
			return err
		}
		sku := sku1
		prefix.Sku = &sku
	}

	// Set property "Tags":
	if typedInput.Tags != nil {
		prefix.Tags = make(map[string]string, len(typedInput.Tags))
		for key, value := range typedInput.Tags {
			prefix.Tags[key] = value
		}
	}

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

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

	// No error
	return nil
}

// AssignProperties_From_PublicIPPrefix_STATUS populates our PublicIPPrefix_STATUS from the provided source PublicIPPrefix_STATUS
func (prefix *PublicIPPrefix_STATUS) AssignProperties_From_PublicIPPrefix_STATUS(source *storage.PublicIPPrefix_STATUS) error {

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

	// CustomIPPrefix
	if source.CustomIPPrefix != nil {
		var customIPPrefix SubResource_STATUS
		err := customIPPrefix.AssignProperties_From_SubResource_STATUS(source.CustomIPPrefix)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field CustomIPPrefix")
		}
		prefix.CustomIPPrefix = &customIPPrefix
	} else {
		prefix.CustomIPPrefix = nil
	}

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

	// ExtendedLocation
	if source.ExtendedLocation != nil {
		var extendedLocation ExtendedLocation_STATUS
		err := extendedLocation.AssignProperties_From_ExtendedLocation_STATUS(source.ExtendedLocation)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ExtendedLocation_STATUS() to populate field ExtendedLocation")
		}
		prefix.ExtendedLocation = &extendedLocation
	} else {
		prefix.ExtendedLocation = nil
	}

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

	// IpPrefix
	prefix.IpPrefix = genruntime.ClonePointerToString(source.IpPrefix)

	// IpTags
	if source.IpTags != nil {
		ipTagList := make([]IpTag_STATUS, len(source.IpTags))
		for ipTagIndex, ipTagItem := range source.IpTags {
			var ipTag IpTag_STATUS
			err := ipTag.AssignProperties_From_IpTag_STATUS(&ipTagItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_IpTag_STATUS() to populate field IpTags")
			}
			ipTagList[ipTagIndex] = ipTag
		}
		prefix.IpTags = ipTagList
	} else {
		prefix.IpTags = nil
	}

	// LoadBalancerFrontendIpConfiguration
	if source.LoadBalancerFrontendIpConfiguration != nil {
		var loadBalancerFrontendIpConfiguration SubResource_STATUS
		err := loadBalancerFrontendIpConfiguration.AssignProperties_From_SubResource_STATUS(source.LoadBalancerFrontendIpConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field LoadBalancerFrontendIpConfiguration")
		}
		prefix.LoadBalancerFrontendIpConfiguration = &loadBalancerFrontendIpConfiguration
	} else {
		prefix.LoadBalancerFrontendIpConfiguration = nil
	}

	// Location
	prefix.Location = genruntime.ClonePointerToString(source.Location)

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

	// NatGateway
	if source.NatGateway != nil {
		var natGateway NatGateway_STATUS_PublicIPPrefix_SubResourceEmbedded
		err := natGateway.AssignProperties_From_NatGateway_STATUS_PublicIPPrefix_SubResourceEmbedded(source.NatGateway)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_NatGateway_STATUS_PublicIPPrefix_SubResourceEmbedded() to populate field NatGateway")
		}
		prefix.NatGateway = &natGateway
	} else {
		prefix.NatGateway = nil
	}

	// PrefixLength
	prefix.PrefixLength = genruntime.ClonePointerToInt(source.PrefixLength)

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

	// PublicIPAddressVersion
	if source.PublicIPAddressVersion != nil {
		publicIPAddressVersion := *source.PublicIPAddressVersion
		publicIPAddressVersionTemp := genruntime.ToEnum(publicIPAddressVersion, iPVersion_STATUS_Values)
		prefix.PublicIPAddressVersion = &publicIPAddressVersionTemp
	} else {
		prefix.PublicIPAddressVersion = nil
	}

	// PublicIPAddresses
	if source.PublicIPAddresses != nil {
		publicIPAddressList := make([]ReferencedPublicIpAddress_STATUS, len(source.PublicIPAddresses))
		for publicIPAddressIndex, publicIPAddressItem := range source.PublicIPAddresses {
			var publicIPAddress ReferencedPublicIpAddress_STATUS
			err := publicIPAddress.AssignProperties_From_ReferencedPublicIpAddress_STATUS(&publicIPAddressItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_ReferencedPublicIpAddress_STATUS() to populate field PublicIPAddresses")
			}
			publicIPAddressList[publicIPAddressIndex] = publicIPAddress
		}
		prefix.PublicIPAddresses = publicIPAddressList
	} else {
		prefix.PublicIPAddresses = nil
	}

	// ResourceGuid
	prefix.ResourceGuid = genruntime.ClonePointerToString(source.ResourceGuid)

	// Sku
	if source.Sku != nil {
		var sku PublicIPPrefixSku_STATUS
		err := sku.AssignProperties_From_PublicIPPrefixSku_STATUS(source.Sku)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_PublicIPPrefixSku_STATUS() to populate field Sku")
		}
		prefix.Sku = &sku
	} else {
		prefix.Sku = nil
	}

	// Tags
	prefix.Tags = genruntime.CloneMapOfStringToString(source.Tags)

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

	// Zones
	prefix.Zones = genruntime.CloneSliceOfString(source.Zones)

	// No error
	return nil
}

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

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

	// CustomIPPrefix
	if prefix.CustomIPPrefix != nil {
		var customIPPrefix storage.SubResource_STATUS
		err := prefix.CustomIPPrefix.AssignProperties_To_SubResource_STATUS(&customIPPrefix)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field CustomIPPrefix")
		}
		destination.CustomIPPrefix = &customIPPrefix
	} else {
		destination.CustomIPPrefix = nil
	}

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

	// ExtendedLocation
	if prefix.ExtendedLocation != nil {
		var extendedLocation storage.ExtendedLocation_STATUS
		err := prefix.ExtendedLocation.AssignProperties_To_ExtendedLocation_STATUS(&extendedLocation)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ExtendedLocation_STATUS() to populate field ExtendedLocation")
		}
		destination.ExtendedLocation = &extendedLocation
	} else {
		destination.ExtendedLocation = nil
	}

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

	// IpPrefix
	destination.IpPrefix = genruntime.ClonePointerToString(prefix.IpPrefix)

	// IpTags
	if prefix.IpTags != nil {
		ipTagList := make([]storage.IpTag_STATUS, len(prefix.IpTags))
		for ipTagIndex, ipTagItem := range prefix.IpTags {
			var ipTag storage.IpTag_STATUS
			err := ipTagItem.AssignProperties_To_IpTag_STATUS(&ipTag)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_IpTag_STATUS() to populate field IpTags")
			}
			ipTagList[ipTagIndex] = ipTag
		}
		destination.IpTags = ipTagList
	} else {
		destination.IpTags = nil
	}

	// LoadBalancerFrontendIpConfiguration
	if prefix.LoadBalancerFrontendIpConfiguration != nil {
		var loadBalancerFrontendIpConfiguration storage.SubResource_STATUS
		err := prefix.LoadBalancerFrontendIpConfiguration.AssignProperties_To_SubResource_STATUS(&loadBalancerFrontendIpConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field LoadBalancerFrontendIpConfiguration")
		}
		destination.LoadBalancerFrontendIpConfiguration = &loadBalancerFrontendIpConfiguration
	} else {
		destination.LoadBalancerFrontendIpConfiguration = nil
	}

	// Location
	destination.Location = genruntime.ClonePointerToString(prefix.Location)

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

	// NatGateway
	if prefix.NatGateway != nil {
		var natGateway storage.NatGateway_STATUS_PublicIPPrefix_SubResourceEmbedded
		err := prefix.NatGateway.AssignProperties_To_NatGateway_STATUS_PublicIPPrefix_SubResourceEmbedded(&natGateway)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_NatGateway_STATUS_PublicIPPrefix_SubResourceEmbedded() to populate field NatGateway")
		}
		destination.NatGateway = &natGateway
	} else {
		destination.NatGateway = nil
	}

	// PrefixLength
	destination.PrefixLength = genruntime.ClonePointerToInt(prefix.PrefixLength)

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

	// PublicIPAddressVersion
	if prefix.PublicIPAddressVersion != nil {
		publicIPAddressVersion := string(*prefix.PublicIPAddressVersion)
		destination.PublicIPAddressVersion = &publicIPAddressVersion
	} else {
		destination.PublicIPAddressVersion = nil
	}

	// PublicIPAddresses
	if prefix.PublicIPAddresses != nil {
		publicIPAddressList := make([]storage.ReferencedPublicIpAddress_STATUS, len(prefix.PublicIPAddresses))
		for publicIPAddressIndex, publicIPAddressItem := range prefix.PublicIPAddresses {
			var publicIPAddress storage.ReferencedPublicIpAddress_STATUS
			err := publicIPAddressItem.AssignProperties_To_ReferencedPublicIpAddress_STATUS(&publicIPAddress)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ReferencedPublicIpAddress_STATUS() to populate field PublicIPAddresses")
			}
			publicIPAddressList[publicIPAddressIndex] = publicIPAddress
		}
		destination.PublicIPAddresses = publicIPAddressList
	} else {
		destination.PublicIPAddresses = nil
	}

	// ResourceGuid
	destination.ResourceGuid = genruntime.ClonePointerToString(prefix.ResourceGuid)

	// Sku
	if prefix.Sku != nil {
		var sku storage.PublicIPPrefixSku_STATUS
		err := prefix.Sku.AssignProperties_To_PublicIPPrefixSku_STATUS(&sku)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_PublicIPPrefixSku_STATUS() to populate field Sku")
		}
		destination.Sku = &sku
	} else {
		destination.Sku = nil
	}

	// Tags
	destination.Tags = genruntime.CloneMapOfStringToString(prefix.Tags)

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

	// Zones
	destination.Zones = genruntime.CloneSliceOfString(prefix.Zones)

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

	// No error
	return nil
}

// Nat Gateway resource.
type NatGateway_STATUS_PublicIPPrefix_SubResourceEmbedded struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &NatGateway_STATUS_PublicIPPrefix_SubResourceEmbedded{}

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

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

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

	// No error
	return nil
}

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

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

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

var _ genruntime.ARMTransformer = &NatGatewaySpec_PublicIPPrefix_SubResourceEmbedded{}

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

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

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

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

	// no assignment for property "Reference"

	// No error
	return nil
}

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

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// Initialize_From_NatGateway_STATUS_PublicIPPrefix_SubResourceEmbedded populates our NatGatewaySpec_PublicIPPrefix_SubResourceEmbedded from the provided source NatGateway_STATUS_PublicIPPrefix_SubResourceEmbedded
func (embedded *NatGatewaySpec_PublicIPPrefix_SubResourceEmbedded) Initialize_From_NatGateway_STATUS_PublicIPPrefix_SubResourceEmbedded(source *NatGateway_STATUS_PublicIPPrefix_SubResourceEmbedded) error {

	// Reference
	if source.Id != nil {
		reference := genruntime.CreateResourceReferenceFromARMID(*source.Id)
		embedded.Reference = &reference
	} else {
		embedded.Reference = 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 PublicIPPrefixOperatorSpec 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_PublicIPPrefixOperatorSpec populates our PublicIPPrefixOperatorSpec from the provided source PublicIPPrefixOperatorSpec
func (operator *PublicIPPrefixOperatorSpec) AssignProperties_From_PublicIPPrefixOperatorSpec(source *storage.PublicIPPrefixOperatorSpec) 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_PublicIPPrefixOperatorSpec populates the provided destination PublicIPPrefixOperatorSpec from our PublicIPPrefixOperatorSpec
func (operator *PublicIPPrefixOperatorSpec) AssignProperties_To_PublicIPPrefixOperatorSpec(destination *storage.PublicIPPrefixOperatorSpec) 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
}

// SKU of a public IP prefix.
type PublicIPPrefixSku struct {
	// Name: Name of a public IP prefix SKU.
	Name *PublicIPPrefixSku_Name `json:"name,omitempty"`

	// Tier: Tier of a public IP prefix SKU.
	Tier *PublicIPPrefixSku_Tier `json:"tier,omitempty"`
}

var _ genruntime.ARMTransformer = &PublicIPPrefixSku{}

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

	// Set property "Name":
	if prefixSku.Name != nil {
		var temp string
		temp = string(*prefixSku.Name)
		name := arm.PublicIPPrefixSku_Name(temp)
		result.Name = &name
	}

	// Set property "Tier":
	if prefixSku.Tier != nil {
		var temp string
		temp = string(*prefixSku.Tier)
		tier := arm.PublicIPPrefixSku_Tier(temp)
		result.Tier = &tier
	}
	return result, nil
}

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

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

	// Set property "Name":
	if typedInput.Name != nil {
		var temp string
		temp = string(*typedInput.Name)
		name := PublicIPPrefixSku_Name(temp)
		prefixSku.Name = &name
	}

	// Set property "Tier":
	if typedInput.Tier != nil {
		var temp string
		temp = string(*typedInput.Tier)
		tier := PublicIPPrefixSku_Tier(temp)
		prefixSku.Tier = &tier
	}

	// No error
	return nil
}

// AssignProperties_From_PublicIPPrefixSku populates our PublicIPPrefixSku from the provided source PublicIPPrefixSku
func (prefixSku *PublicIPPrefixSku) AssignProperties_From_PublicIPPrefixSku(source *storage.PublicIPPrefixSku) error {

	// Name
	if source.Name != nil {
		name := *source.Name
		nameTemp := genruntime.ToEnum(name, publicIPPrefixSku_Name_Values)
		prefixSku.Name = &nameTemp
	} else {
		prefixSku.Name = nil
	}

	// Tier
	if source.Tier != nil {
		tier := *source.Tier
		tierTemp := genruntime.ToEnum(tier, publicIPPrefixSku_Tier_Values)
		prefixSku.Tier = &tierTemp
	} else {
		prefixSku.Tier = nil
	}

	// No error
	return nil
}

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

	// Name
	if prefixSku.Name != nil {
		name := string(*prefixSku.Name)
		destination.Name = &name
	} else {
		destination.Name = nil
	}

	// Tier
	if prefixSku.Tier != nil {
		tier := string(*prefixSku.Tier)
		destination.Tier = &tier
	} else {
		destination.Tier = nil
	}

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

	// No error
	return nil
}

// Initialize_From_PublicIPPrefixSku_STATUS populates our PublicIPPrefixSku from the provided source PublicIPPrefixSku_STATUS
func (prefixSku *PublicIPPrefixSku) Initialize_From_PublicIPPrefixSku_STATUS(source *PublicIPPrefixSku_STATUS) error {

	// Name
	if source.Name != nil {
		name := genruntime.ToEnum(string(*source.Name), publicIPPrefixSku_Name_Values)
		prefixSku.Name = &name
	} else {
		prefixSku.Name = nil
	}

	// Tier
	if source.Tier != nil {
		tier := genruntime.ToEnum(string(*source.Tier), publicIPPrefixSku_Tier_Values)
		prefixSku.Tier = &tier
	} else {
		prefixSku.Tier = nil
	}

	// No error
	return nil
}

// SKU of a public IP prefix.
type PublicIPPrefixSku_STATUS struct {
	// Name: Name of a public IP prefix SKU.
	Name *PublicIPPrefixSku_Name_STATUS `json:"name,omitempty"`

	// Tier: Tier of a public IP prefix SKU.
	Tier *PublicIPPrefixSku_Tier_STATUS `json:"tier,omitempty"`
}

var _ genruntime.FromARMConverter = &PublicIPPrefixSku_STATUS{}

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

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

	// Set property "Name":
	if typedInput.Name != nil {
		var temp string
		temp = string(*typedInput.Name)
		name := PublicIPPrefixSku_Name_STATUS(temp)
		prefixSku.Name = &name
	}

	// Set property "Tier":
	if typedInput.Tier != nil {
		var temp string
		temp = string(*typedInput.Tier)
		tier := PublicIPPrefixSku_Tier_STATUS(temp)
		prefixSku.Tier = &tier
	}

	// No error
	return nil
}

// AssignProperties_From_PublicIPPrefixSku_STATUS populates our PublicIPPrefixSku_STATUS from the provided source PublicIPPrefixSku_STATUS
func (prefixSku *PublicIPPrefixSku_STATUS) AssignProperties_From_PublicIPPrefixSku_STATUS(source *storage.PublicIPPrefixSku_STATUS) error {

	// Name
	if source.Name != nil {
		name := *source.Name
		nameTemp := genruntime.ToEnum(name, publicIPPrefixSku_Name_STATUS_Values)
		prefixSku.Name = &nameTemp
	} else {
		prefixSku.Name = nil
	}

	// Tier
	if source.Tier != nil {
		tier := *source.Tier
		tierTemp := genruntime.ToEnum(tier, publicIPPrefixSku_Tier_STATUS_Values)
		prefixSku.Tier = &tierTemp
	} else {
		prefixSku.Tier = nil
	}

	// No error
	return nil
}

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

	// Name
	if prefixSku.Name != nil {
		name := string(*prefixSku.Name)
		destination.Name = &name
	} else {
		destination.Name = nil
	}

	// Tier
	if prefixSku.Tier != nil {
		tier := string(*prefixSku.Tier)
		destination.Tier = &tier
	} else {
		destination.Tier = nil
	}

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

	// No error
	return nil
}

// Reference to a public IP address.
type ReferencedPublicIpAddress_STATUS struct {
	// Id: The PublicIPAddress Reference.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &ReferencedPublicIpAddress_STATUS{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_ReferencedPublicIpAddress_STATUS populates our ReferencedPublicIpAddress_STATUS from the provided source ReferencedPublicIpAddress_STATUS
func (address *ReferencedPublicIpAddress_STATUS) AssignProperties_From_ReferencedPublicIpAddress_STATUS(source *storage.ReferencedPublicIpAddress_STATUS) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"Standard"}
type PublicIPPrefixSku_Name string

const PublicIPPrefixSku_Name_Standard = PublicIPPrefixSku_Name("Standard")

// Mapping from string to PublicIPPrefixSku_Name
var publicIPPrefixSku_Name_Values = map[string]PublicIPPrefixSku_Name{
	"standard": PublicIPPrefixSku_Name_Standard,
}

type PublicIPPrefixSku_Name_STATUS string

const PublicIPPrefixSku_Name_STATUS_Standard = PublicIPPrefixSku_Name_STATUS("Standard")

// Mapping from string to PublicIPPrefixSku_Name_STATUS
var publicIPPrefixSku_Name_STATUS_Values = map[string]PublicIPPrefixSku_Name_STATUS{
	"standard": PublicIPPrefixSku_Name_STATUS_Standard,
}

// +kubebuilder:validation:Enum={"Global","Regional"}
type PublicIPPrefixSku_Tier string

const (
	PublicIPPrefixSku_Tier_Global   = PublicIPPrefixSku_Tier("Global")
	PublicIPPrefixSku_Tier_Regional = PublicIPPrefixSku_Tier("Regional")
)

// Mapping from string to PublicIPPrefixSku_Tier
var publicIPPrefixSku_Tier_Values = map[string]PublicIPPrefixSku_Tier{
	"global":   PublicIPPrefixSku_Tier_Global,
	"regional": PublicIPPrefixSku_Tier_Regional,
}

type PublicIPPrefixSku_Tier_STATUS string

const (
	PublicIPPrefixSku_Tier_STATUS_Global   = PublicIPPrefixSku_Tier_STATUS("Global")
	PublicIPPrefixSku_Tier_STATUS_Regional = PublicIPPrefixSku_Tier_STATUS("Regional")
)

// Mapping from string to PublicIPPrefixSku_Tier_STATUS
var publicIPPrefixSku_Tier_STATUS_Values = map[string]PublicIPPrefixSku_Tier_STATUS{
	"global":   PublicIPPrefixSku_Tier_STATUS_Global,
	"regional": PublicIPPrefixSku_Tier_STATUS_Regional,
}

func init() {
	SchemeBuilder.Register(&PublicIPPrefix{}, &PublicIPPrefixList{})
}
