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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/network/v1api20180501/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/network/v1api20180501/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: /dns/resource-manager/Microsoft.Network/Dns/stable/2018-05-01/dns.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}
type DnsZone struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              DnsZone_Spec   `json:"spec,omitempty"`
	Status            DnsZone_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &DnsZone{}

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

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

var _ conversion.Convertible = &DnsZone{}

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

	return zone.AssignProperties_From_DnsZone(source)
}

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

	return zone.AssignProperties_To_DnsZone(destination)
}

var _ configmaps.Exporter = &DnsZone{}

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

var _ secrets.Exporter = &DnsZone{}

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

var _ genruntime.ImportableResource = &DnsZone{}

// InitializeSpec initializes the spec for this resource from the given status
func (zone *DnsZone) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*DnsZone_STATUS); ok {
		return zone.Spec.Initialize_From_DnsZone_STATUS(s)
	}

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

var _ genruntime.KubernetesResource = &DnsZone{}

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

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

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

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

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

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

// NewEmptyStatus returns a new empty (blank) status
func (zone *DnsZone) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &DnsZone_STATUS{}
}

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

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

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

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

	zone.Status = st
	return nil
}

// AssignProperties_From_DnsZone populates our DnsZone from the provided source DnsZone
func (zone *DnsZone) AssignProperties_From_DnsZone(source *storage.DnsZone) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_DnsZone populates the provided destination DnsZone from our DnsZone
func (zone *DnsZone) AssignProperties_To_DnsZone(destination *storage.DnsZone) error {

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /dns/resource-manager/Microsoft.Network/Dns/stable/2018-05-01/dns.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}
type DnsZoneList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []DnsZone `json:"items"`
}

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

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

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

	// +kubebuilder:validation:Required
	// Location: Resource location.
	Location *string `json:"location,omitempty"`

	// OperatorSpec: The specification for configuring operator behavior. This field is interpreted by the operator and not
	// passed directly to Azure
	OperatorSpec *DnsZoneOperatorSpec `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"`

	// RegistrationVirtualNetworks: A list of references to virtual networks that register hostnames in this DNS zone. This is
	// a only when ZoneType is Private.
	RegistrationVirtualNetworks []SubResource `json:"registrationVirtualNetworks,omitempty"`

	// ResolutionVirtualNetworks: A list of references to virtual networks that resolve records in this DNS zone. This is a
	// only when ZoneType is Private.
	ResolutionVirtualNetworks []SubResource `json:"resolutionVirtualNetworks,omitempty"`

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

	// ZoneType: The type of this DNS zone (Public or Private).
	ZoneType *ZoneProperties_ZoneType `json:"zoneType,omitempty"`
}

var _ genruntime.ARMTransformer = &DnsZone_Spec{}

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

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

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

	// Set property "Properties":
	if zone.RegistrationVirtualNetworks != nil ||
		zone.ResolutionVirtualNetworks != nil ||
		zone.ZoneType != nil {
		result.Properties = &arm.ZoneProperties{}
	}
	for _, item := range zone.RegistrationVirtualNetworks {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.RegistrationVirtualNetworks = append(result.Properties.RegistrationVirtualNetworks, *item_ARM.(*arm.SubResource))
	}
	for _, item := range zone.ResolutionVirtualNetworks {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.ResolutionVirtualNetworks = append(result.Properties.ResolutionVirtualNetworks, *item_ARM.(*arm.SubResource))
	}
	if zone.ZoneType != nil {
		var temp string
		temp = string(*zone.ZoneType)
		zoneType := arm.ZoneProperties_ZoneType(temp)
		result.Properties.ZoneType = &zoneType
	}

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

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

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

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

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

	// no assignment for property "OperatorSpec"

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

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

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

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

	// Set property "ZoneType":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ZoneType != nil {
			var temp string
			temp = string(*typedInput.Properties.ZoneType)
			zoneType := ZoneProperties_ZoneType(temp)
			zone.ZoneType = &zoneType
		}
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &DnsZone_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.DnsZone_Spec{}
	err := zone.AssignProperties_To_DnsZone_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_DnsZone_Spec populates our DnsZone_Spec from the provided source DnsZone_Spec
func (zone *DnsZone_Spec) AssignProperties_From_DnsZone_Spec(source *storage.DnsZone_Spec) error {

	// AzureName
	zone.AzureName = source.AzureName

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

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

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

	// RegistrationVirtualNetworks
	if source.RegistrationVirtualNetworks != nil {
		registrationVirtualNetworkList := make([]SubResource, len(source.RegistrationVirtualNetworks))
		for registrationVirtualNetworkIndex, registrationVirtualNetworkItem := range source.RegistrationVirtualNetworks {
			var registrationVirtualNetwork SubResource
			err := registrationVirtualNetwork.AssignProperties_From_SubResource(&registrationVirtualNetworkItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SubResource() to populate field RegistrationVirtualNetworks")
			}
			registrationVirtualNetworkList[registrationVirtualNetworkIndex] = registrationVirtualNetwork
		}
		zone.RegistrationVirtualNetworks = registrationVirtualNetworkList
	} else {
		zone.RegistrationVirtualNetworks = nil
	}

	// ResolutionVirtualNetworks
	if source.ResolutionVirtualNetworks != nil {
		resolutionVirtualNetworkList := make([]SubResource, len(source.ResolutionVirtualNetworks))
		for resolutionVirtualNetworkIndex, resolutionVirtualNetworkItem := range source.ResolutionVirtualNetworks {
			var resolutionVirtualNetwork SubResource
			err := resolutionVirtualNetwork.AssignProperties_From_SubResource(&resolutionVirtualNetworkItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SubResource() to populate field ResolutionVirtualNetworks")
			}
			resolutionVirtualNetworkList[resolutionVirtualNetworkIndex] = resolutionVirtualNetwork
		}
		zone.ResolutionVirtualNetworks = resolutionVirtualNetworkList
	} else {
		zone.ResolutionVirtualNetworks = nil
	}

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

	// ZoneType
	if source.ZoneType != nil {
		zoneType := *source.ZoneType
		zoneTypeTemp := genruntime.ToEnum(zoneType, zoneProperties_ZoneType_Values)
		zone.ZoneType = &zoneTypeTemp
	} else {
		zone.ZoneType = nil
	}

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = zone.AzureName

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

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

	// OriginalVersion
	destination.OriginalVersion = zone.OriginalVersion()

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

	// RegistrationVirtualNetworks
	if zone.RegistrationVirtualNetworks != nil {
		registrationVirtualNetworkList := make([]storage.SubResource, len(zone.RegistrationVirtualNetworks))
		for registrationVirtualNetworkIndex, registrationVirtualNetworkItem := range zone.RegistrationVirtualNetworks {
			var registrationVirtualNetwork storage.SubResource
			err := registrationVirtualNetworkItem.AssignProperties_To_SubResource(&registrationVirtualNetwork)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SubResource() to populate field RegistrationVirtualNetworks")
			}
			registrationVirtualNetworkList[registrationVirtualNetworkIndex] = registrationVirtualNetwork
		}
		destination.RegistrationVirtualNetworks = registrationVirtualNetworkList
	} else {
		destination.RegistrationVirtualNetworks = nil
	}

	// ResolutionVirtualNetworks
	if zone.ResolutionVirtualNetworks != nil {
		resolutionVirtualNetworkList := make([]storage.SubResource, len(zone.ResolutionVirtualNetworks))
		for resolutionVirtualNetworkIndex, resolutionVirtualNetworkItem := range zone.ResolutionVirtualNetworks {
			var resolutionVirtualNetwork storage.SubResource
			err := resolutionVirtualNetworkItem.AssignProperties_To_SubResource(&resolutionVirtualNetwork)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SubResource() to populate field ResolutionVirtualNetworks")
			}
			resolutionVirtualNetworkList[resolutionVirtualNetworkIndex] = resolutionVirtualNetwork
		}
		destination.ResolutionVirtualNetworks = resolutionVirtualNetworkList
	} else {
		destination.ResolutionVirtualNetworks = nil
	}

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

	// ZoneType
	if zone.ZoneType != nil {
		zoneType := string(*zone.ZoneType)
		destination.ZoneType = &zoneType
	} else {
		destination.ZoneType = nil
	}

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

	// No error
	return nil
}

// Initialize_From_DnsZone_STATUS populates our DnsZone_Spec from the provided source DnsZone_STATUS
func (zone *DnsZone_Spec) Initialize_From_DnsZone_STATUS(source *DnsZone_STATUS) error {

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

	// RegistrationVirtualNetworks
	if source.RegistrationVirtualNetworks != nil {
		registrationVirtualNetworkList := make([]SubResource, len(source.RegistrationVirtualNetworks))
		for registrationVirtualNetworkIndex, registrationVirtualNetworkItem := range source.RegistrationVirtualNetworks {
			var registrationVirtualNetwork SubResource
			err := registrationVirtualNetwork.Initialize_From_SubResource_STATUS(&registrationVirtualNetworkItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_SubResource_STATUS() to populate field RegistrationVirtualNetworks")
			}
			registrationVirtualNetworkList[registrationVirtualNetworkIndex] = registrationVirtualNetwork
		}
		zone.RegistrationVirtualNetworks = registrationVirtualNetworkList
	} else {
		zone.RegistrationVirtualNetworks = nil
	}

	// ResolutionVirtualNetworks
	if source.ResolutionVirtualNetworks != nil {
		resolutionVirtualNetworkList := make([]SubResource, len(source.ResolutionVirtualNetworks))
		for resolutionVirtualNetworkIndex, resolutionVirtualNetworkItem := range source.ResolutionVirtualNetworks {
			var resolutionVirtualNetwork SubResource
			err := resolutionVirtualNetwork.Initialize_From_SubResource_STATUS(&resolutionVirtualNetworkItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_SubResource_STATUS() to populate field ResolutionVirtualNetworks")
			}
			resolutionVirtualNetworkList[resolutionVirtualNetworkIndex] = resolutionVirtualNetwork
		}
		zone.ResolutionVirtualNetworks = resolutionVirtualNetworkList
	} else {
		zone.ResolutionVirtualNetworks = nil
	}

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

	// ZoneType
	if source.ZoneType != nil {
		zoneType := genruntime.ToEnum(string(*source.ZoneType), zoneProperties_ZoneType_Values)
		zone.ZoneType = &zoneType
	} else {
		zone.ZoneType = nil
	}

	// No error
	return nil
}

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

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

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

	// Etag: The etag of the zone.
	Etag *string `json:"etag,omitempty"`

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

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

	// MaxNumberOfRecordSets: The maximum number of record sets that can be created in this DNS zone.  This is a read-only
	// property and any attempt to set this value will be ignored.
	MaxNumberOfRecordSets *int `json:"maxNumberOfRecordSets,omitempty"`

	// MaxNumberOfRecordsPerRecordSet: The maximum number of records per record set that can be created in this DNS zone.  This
	// is a read-only property and any attempt to set this value will be ignored.
	MaxNumberOfRecordsPerRecordSet *int `json:"maxNumberOfRecordsPerRecordSet,omitempty"`

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

	// NameServers: The name servers for this DNS zone. This is a read-only property and any attempt to set this value will be
	// ignored.
	NameServers []string `json:"nameServers,omitempty"`

	// NumberOfRecordSets: The current number of record sets in this DNS zone.  This is a read-only property and any attempt to
	// set this value will be ignored.
	NumberOfRecordSets *int `json:"numberOfRecordSets,omitempty"`

	// RegistrationVirtualNetworks: A list of references to virtual networks that register hostnames in this DNS zone. This is
	// a only when ZoneType is Private.
	RegistrationVirtualNetworks []SubResource_STATUS `json:"registrationVirtualNetworks,omitempty"`

	// ResolutionVirtualNetworks: A list of references to virtual networks that resolve records in this DNS zone. This is a
	// only when ZoneType is Private.
	ResolutionVirtualNetworks []SubResource_STATUS `json:"resolutionVirtualNetworks,omitempty"`

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

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

	// ZoneType: The type of this DNS zone (Public or Private).
	ZoneType *ZoneProperties_ZoneType_STATUS `json:"zoneType,omitempty"`
}

var _ genruntime.ConvertibleStatus = &DnsZone_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.DnsZone_STATUS{}
	err := zone.AssignProperties_To_DnsZone_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 = &DnsZone_STATUS{}

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

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

	// no assignment for property "Conditions"

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

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

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

	// Set property "MaxNumberOfRecordSets":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MaxNumberOfRecordSets != nil {
			maxNumberOfRecordSets := *typedInput.Properties.MaxNumberOfRecordSets
			zone.MaxNumberOfRecordSets = &maxNumberOfRecordSets
		}
	}

	// Set property "MaxNumberOfRecordsPerRecordSet":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MaxNumberOfRecordsPerRecordSet != nil {
			maxNumberOfRecordsPerRecordSet := *typedInput.Properties.MaxNumberOfRecordsPerRecordSet
			zone.MaxNumberOfRecordsPerRecordSet = &maxNumberOfRecordsPerRecordSet
		}
	}

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

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

	// Set property "NumberOfRecordSets":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NumberOfRecordSets != nil {
			numberOfRecordSets := *typedInput.Properties.NumberOfRecordSets
			zone.NumberOfRecordSets = &numberOfRecordSets
		}
	}

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

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

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

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

	// Set property "ZoneType":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ZoneType != nil {
			var temp string
			temp = string(*typedInput.Properties.ZoneType)
			zoneType := ZoneProperties_ZoneType_STATUS(temp)
			zone.ZoneType = &zoneType
		}
	}

	// No error
	return nil
}

// AssignProperties_From_DnsZone_STATUS populates our DnsZone_STATUS from the provided source DnsZone_STATUS
func (zone *DnsZone_STATUS) AssignProperties_From_DnsZone_STATUS(source *storage.DnsZone_STATUS) error {

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

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

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

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

	// MaxNumberOfRecordSets
	zone.MaxNumberOfRecordSets = genruntime.ClonePointerToInt(source.MaxNumberOfRecordSets)

	// MaxNumberOfRecordsPerRecordSet
	zone.MaxNumberOfRecordsPerRecordSet = genruntime.ClonePointerToInt(source.MaxNumberOfRecordsPerRecordSet)

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

	// NameServers
	zone.NameServers = genruntime.CloneSliceOfString(source.NameServers)

	// NumberOfRecordSets
	zone.NumberOfRecordSets = genruntime.ClonePointerToInt(source.NumberOfRecordSets)

	// RegistrationVirtualNetworks
	if source.RegistrationVirtualNetworks != nil {
		registrationVirtualNetworkList := make([]SubResource_STATUS, len(source.RegistrationVirtualNetworks))
		for registrationVirtualNetworkIndex, registrationVirtualNetworkItem := range source.RegistrationVirtualNetworks {
			var registrationVirtualNetwork SubResource_STATUS
			err := registrationVirtualNetwork.AssignProperties_From_SubResource_STATUS(&registrationVirtualNetworkItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field RegistrationVirtualNetworks")
			}
			registrationVirtualNetworkList[registrationVirtualNetworkIndex] = registrationVirtualNetwork
		}
		zone.RegistrationVirtualNetworks = registrationVirtualNetworkList
	} else {
		zone.RegistrationVirtualNetworks = nil
	}

	// ResolutionVirtualNetworks
	if source.ResolutionVirtualNetworks != nil {
		resolutionVirtualNetworkList := make([]SubResource_STATUS, len(source.ResolutionVirtualNetworks))
		for resolutionVirtualNetworkIndex, resolutionVirtualNetworkItem := range source.ResolutionVirtualNetworks {
			var resolutionVirtualNetwork SubResource_STATUS
			err := resolutionVirtualNetwork.AssignProperties_From_SubResource_STATUS(&resolutionVirtualNetworkItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field ResolutionVirtualNetworks")
			}
			resolutionVirtualNetworkList[resolutionVirtualNetworkIndex] = resolutionVirtualNetwork
		}
		zone.ResolutionVirtualNetworks = resolutionVirtualNetworkList
	} else {
		zone.ResolutionVirtualNetworks = nil
	}

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

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

	// ZoneType
	if source.ZoneType != nil {
		zoneType := *source.ZoneType
		zoneTypeTemp := genruntime.ToEnum(zoneType, zoneProperties_ZoneType_STATUS_Values)
		zone.ZoneType = &zoneTypeTemp
	} else {
		zone.ZoneType = nil
	}

	// No error
	return nil
}

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

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

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

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

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

	// MaxNumberOfRecordSets
	destination.MaxNumberOfRecordSets = genruntime.ClonePointerToInt(zone.MaxNumberOfRecordSets)

	// MaxNumberOfRecordsPerRecordSet
	destination.MaxNumberOfRecordsPerRecordSet = genruntime.ClonePointerToInt(zone.MaxNumberOfRecordsPerRecordSet)

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

	// NameServers
	destination.NameServers = genruntime.CloneSliceOfString(zone.NameServers)

	// NumberOfRecordSets
	destination.NumberOfRecordSets = genruntime.ClonePointerToInt(zone.NumberOfRecordSets)

	// RegistrationVirtualNetworks
	if zone.RegistrationVirtualNetworks != nil {
		registrationVirtualNetworkList := make([]storage.SubResource_STATUS, len(zone.RegistrationVirtualNetworks))
		for registrationVirtualNetworkIndex, registrationVirtualNetworkItem := range zone.RegistrationVirtualNetworks {
			var registrationVirtualNetwork storage.SubResource_STATUS
			err := registrationVirtualNetworkItem.AssignProperties_To_SubResource_STATUS(&registrationVirtualNetwork)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field RegistrationVirtualNetworks")
			}
			registrationVirtualNetworkList[registrationVirtualNetworkIndex] = registrationVirtualNetwork
		}
		destination.RegistrationVirtualNetworks = registrationVirtualNetworkList
	} else {
		destination.RegistrationVirtualNetworks = nil
	}

	// ResolutionVirtualNetworks
	if zone.ResolutionVirtualNetworks != nil {
		resolutionVirtualNetworkList := make([]storage.SubResource_STATUS, len(zone.ResolutionVirtualNetworks))
		for resolutionVirtualNetworkIndex, resolutionVirtualNetworkItem := range zone.ResolutionVirtualNetworks {
			var resolutionVirtualNetwork storage.SubResource_STATUS
			err := resolutionVirtualNetworkItem.AssignProperties_To_SubResource_STATUS(&resolutionVirtualNetwork)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field ResolutionVirtualNetworks")
			}
			resolutionVirtualNetworkList[resolutionVirtualNetworkIndex] = resolutionVirtualNetwork
		}
		destination.ResolutionVirtualNetworks = resolutionVirtualNetworkList
	} else {
		destination.ResolutionVirtualNetworks = nil
	}

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

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

	// ZoneType
	if zone.ZoneType != nil {
		zoneType := string(*zone.ZoneType)
		destination.ZoneType = &zoneType
	} else {
		destination.ZoneType = nil
	}

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

	// No error
	return nil
}

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

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

var _ genruntime.ARMTransformer = &SubResource{}

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

	// Set property "Id":
	if resource.Reference != nil {
		referenceARMID, err := resolved.ResolvedReferences.Lookup(*resource.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 (resource *SubResource) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.SubResource{}
}

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

	// no assignment for property "Reference"

	// No error
	return nil
}

// AssignProperties_From_SubResource populates our SubResource from the provided source SubResource
func (resource *SubResource) AssignProperties_From_SubResource(source *storage.SubResource) error {

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

	// No error
	return nil
}

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

	// Reference
	if resource.Reference != nil {
		reference := resource.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_SubResource_STATUS populates our SubResource from the provided source SubResource_STATUS
func (resource *SubResource) Initialize_From_SubResource_STATUS(source *SubResource_STATUS) error {

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

	// No error
	return nil
}

// A reference to a another resource
type SubResource_STATUS struct {
	// Id: Resource Id.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &SubResource_STATUS{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_SubResource_STATUS populates our SubResource_STATUS from the provided source SubResource_STATUS
func (resource *SubResource_STATUS) AssignProperties_From_SubResource_STATUS(source *storage.SubResource_STATUS) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"Private","Public"}
type ZoneProperties_ZoneType string

const (
	ZoneProperties_ZoneType_Private = ZoneProperties_ZoneType("Private")
	ZoneProperties_ZoneType_Public  = ZoneProperties_ZoneType("Public")
)

// Mapping from string to ZoneProperties_ZoneType
var zoneProperties_ZoneType_Values = map[string]ZoneProperties_ZoneType{
	"private": ZoneProperties_ZoneType_Private,
	"public":  ZoneProperties_ZoneType_Public,
}

type ZoneProperties_ZoneType_STATUS string

const (
	ZoneProperties_ZoneType_STATUS_Private = ZoneProperties_ZoneType_STATUS("Private")
	ZoneProperties_ZoneType_STATUS_Public  = ZoneProperties_ZoneType_STATUS("Public")
)

// Mapping from string to ZoneProperties_ZoneType_STATUS
var zoneProperties_ZoneType_STATUS_Values = map[string]ZoneProperties_ZoneType_STATUS{
	"private": ZoneProperties_ZoneType_STATUS_Private,
	"public":  ZoneProperties_ZoneType_STATUS_Public,
}

func init() {
	SchemeBuilder.Register(&DnsZone{}, &DnsZoneList{})
}
