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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/network/v1api20200601/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/network/v1api20200601/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: /privatedns/resource-manager/Microsoft.Network/PrivateDns/stable/2020-06-01/privatedns.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/PTR/{relativeRecordSetName}
type PrivateDnsZonesPTRRecord struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              PrivateDnsZonesPTRRecord_Spec   `json:"spec,omitempty"`
	Status            PrivateDnsZonesPTRRecord_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &PrivateDnsZonesPTRRecord{}

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

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

var _ conversion.Convertible = &PrivateDnsZonesPTRRecord{}

// ConvertFrom populates our PrivateDnsZonesPTRRecord from the provided hub PrivateDnsZonesPTRRecord
func (record *PrivateDnsZonesPTRRecord) ConvertFrom(hub conversion.Hub) error {
	// intermediate variable for conversion
	var source storage.PrivateDnsZonesPTRRecord

	err := source.ConvertFrom(hub)
	if err != nil {
		return eris.Wrap(err, "converting from hub to source")
	}

	err = record.AssignProperties_From_PrivateDnsZonesPTRRecord(&source)
	if err != nil {
		return eris.Wrap(err, "converting from source to record")
	}

	return nil
}

// ConvertTo populates the provided hub PrivateDnsZonesPTRRecord from our PrivateDnsZonesPTRRecord
func (record *PrivateDnsZonesPTRRecord) ConvertTo(hub conversion.Hub) error {
	// intermediate variable for conversion
	var destination storage.PrivateDnsZonesPTRRecord
	err := record.AssignProperties_To_PrivateDnsZonesPTRRecord(&destination)
	if err != nil {
		return eris.Wrap(err, "converting to destination from record")
	}
	err = destination.ConvertTo(hub)
	if err != nil {
		return eris.Wrap(err, "converting from destination to hub")
	}

	return nil
}

var _ configmaps.Exporter = &PrivateDnsZonesPTRRecord{}

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

var _ secrets.Exporter = &PrivateDnsZonesPTRRecord{}

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

var _ genruntime.KubernetesResource = &PrivateDnsZonesPTRRecord{}

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

// GetAPIVersion returns the ARM API version of the resource. This is always "2020-06-01"
func (record PrivateDnsZonesPTRRecord) GetAPIVersion() string {
	return "2020-06-01"
}

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

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

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

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

// NewEmptyStatus returns a new empty (blank) status
func (record *PrivateDnsZonesPTRRecord) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &PrivateDnsZonesPTRRecord_STATUS{}
}

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

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

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

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

	record.Status = st
	return nil
}

// AssignProperties_From_PrivateDnsZonesPTRRecord populates our PrivateDnsZonesPTRRecord from the provided source PrivateDnsZonesPTRRecord
func (record *PrivateDnsZonesPTRRecord) AssignProperties_From_PrivateDnsZonesPTRRecord(source *storage.PrivateDnsZonesPTRRecord) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_PrivateDnsZonesPTRRecord populates the provided destination PrivateDnsZonesPTRRecord from our PrivateDnsZonesPTRRecord
func (record *PrivateDnsZonesPTRRecord) AssignProperties_To_PrivateDnsZonesPTRRecord(destination *storage.PrivateDnsZonesPTRRecord) error {

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /privatedns/resource-manager/Microsoft.Network/PrivateDns/stable/2020-06-01/privatedns.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/PTR/{relativeRecordSetName}
type PrivateDnsZonesPTRRecordList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []PrivateDnsZonesPTRRecord `json:"items"`
}

type PrivateDnsZonesPTRRecord_Spec struct {
	// ARecords: The list of A records in the record set.
	ARecords []ARecord `json:"aRecords,omitempty"`

	// AaaaRecords: The list of AAAA records in the record set.
	AaaaRecords []AaaaRecord `json:"aaaaRecords,omitempty"`

	// 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"`

	// CnameRecord: The CNAME record in the record set.
	CnameRecord *CnameRecord `json:"cnameRecord,omitempty"`

	// Etag: The ETag of the record set.
	Etag *string `json:"etag,omitempty"`

	// Metadata: The metadata attached to the record set.
	Metadata map[string]string `json:"metadata,omitempty"`

	// MxRecords: The list of MX records in the record set.
	MxRecords []MxRecord `json:"mxRecords,omitempty"`

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

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

	// PtrRecords: The list of PTR records in the record set.
	PtrRecords []PtrRecord `json:"ptrRecords,omitempty"`

	// SoaRecord: The SOA record in the record set.
	SoaRecord *SoaRecord `json:"soaRecord,omitempty"`

	// SrvRecords: The list of SRV records in the record set.
	SrvRecords []SrvRecord `json:"srvRecords,omitempty"`

	// Ttl: The TTL (time-to-live) of the records in the record set.
	Ttl *int `json:"ttl,omitempty"`

	// TxtRecords: The list of TXT records in the record set.
	TxtRecords []TxtRecord `json:"txtRecords,omitempty"`
}

var _ genruntime.ARMTransformer = &PrivateDnsZonesPTRRecord_Spec{}

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

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

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

	// Set property "Properties":
	if record.ARecords != nil ||
		record.AaaaRecords != nil ||
		record.CnameRecord != nil ||
		record.Metadata != nil ||
		record.MxRecords != nil ||
		record.PtrRecords != nil ||
		record.SoaRecord != nil ||
		record.SrvRecords != nil ||
		record.Ttl != nil ||
		record.TxtRecords != nil {
		result.Properties = &arm.RecordSetProperties{}
	}
	for _, item := range record.ARecords {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.ARecords = append(result.Properties.ARecords, *item_ARM.(*arm.ARecord))
	}
	for _, item := range record.AaaaRecords {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.AaaaRecords = append(result.Properties.AaaaRecords, *item_ARM.(*arm.AaaaRecord))
	}
	if record.CnameRecord != nil {
		cnameRecord_ARM, err := record.CnameRecord.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		cnameRecord := *cnameRecord_ARM.(*arm.CnameRecord)
		result.Properties.CnameRecord = &cnameRecord
	}
	if record.Metadata != nil {
		result.Properties.Metadata = make(map[string]string, len(record.Metadata))
		for key, value := range record.Metadata {
			result.Properties.Metadata[key] = value
		}
	}
	for _, item := range record.MxRecords {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.MxRecords = append(result.Properties.MxRecords, *item_ARM.(*arm.MxRecord))
	}
	for _, item := range record.PtrRecords {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.PtrRecords = append(result.Properties.PtrRecords, *item_ARM.(*arm.PtrRecord))
	}
	if record.SoaRecord != nil {
		soaRecord_ARM, err := record.SoaRecord.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		soaRecord := *soaRecord_ARM.(*arm.SoaRecord)
		result.Properties.SoaRecord = &soaRecord
	}
	for _, item := range record.SrvRecords {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.SrvRecords = append(result.Properties.SrvRecords, *item_ARM.(*arm.SrvRecord))
	}
	if record.Ttl != nil {
		ttl := *record.Ttl
		result.Properties.Ttl = &ttl
	}
	for _, item := range record.TxtRecords {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.TxtRecords = append(result.Properties.TxtRecords, *item_ARM.(*arm.TxtRecord))
	}
	return result, nil
}

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

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

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

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

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

	// Set property "CnameRecord":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CnameRecord != nil {
			var cnameRecord1 CnameRecord
			err := cnameRecord1.PopulateFromARM(owner, *typedInput.Properties.CnameRecord)
			if err != nil {
				return err
			}
			cnameRecord := cnameRecord1
			record.CnameRecord = &cnameRecord
		}
	}

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

	// Set property "Metadata":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Metadata != nil {
			record.Metadata = make(map[string]string, len(typedInput.Properties.Metadata))
			for key, value := range typedInput.Properties.Metadata {
				record.Metadata[key] = value
			}
		}
	}

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

	// no assignment for property "OperatorSpec"

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

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

	// Set property "SoaRecord":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SoaRecord != nil {
			var soaRecord1 SoaRecord
			err := soaRecord1.PopulateFromARM(owner, *typedInput.Properties.SoaRecord)
			if err != nil {
				return err
			}
			soaRecord := soaRecord1
			record.SoaRecord = &soaRecord
		}
	}

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

	// Set property "Ttl":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Ttl != nil {
			ttl := *typedInput.Properties.Ttl
			record.Ttl = &ttl
		}
	}

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

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &PrivateDnsZonesPTRRecord_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.PrivateDnsZonesPTRRecord_Spec{}
	err := record.AssignProperties_To_PrivateDnsZonesPTRRecord_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_PrivateDnsZonesPTRRecord_Spec populates our PrivateDnsZonesPTRRecord_Spec from the provided source PrivateDnsZonesPTRRecord_Spec
func (record *PrivateDnsZonesPTRRecord_Spec) AssignProperties_From_PrivateDnsZonesPTRRecord_Spec(source *storage.PrivateDnsZonesPTRRecord_Spec) error {

	// ARecords
	if source.ARecords != nil {
		aRecordList := make([]ARecord, len(source.ARecords))
		for aRecordIndex, aRecordItem := range source.ARecords {
			var aRecord ARecord
			err := aRecord.AssignProperties_From_ARecord(&aRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_ARecord() to populate field ARecords")
			}
			aRecordList[aRecordIndex] = aRecord
		}
		record.ARecords = aRecordList
	} else {
		record.ARecords = nil
	}

	// AaaaRecords
	if source.AaaaRecords != nil {
		aaaaRecordList := make([]AaaaRecord, len(source.AaaaRecords))
		for aaaaRecordIndex, aaaaRecordItem := range source.AaaaRecords {
			var aaaaRecord AaaaRecord
			err := aaaaRecord.AssignProperties_From_AaaaRecord(&aaaaRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_AaaaRecord() to populate field AaaaRecords")
			}
			aaaaRecordList[aaaaRecordIndex] = aaaaRecord
		}
		record.AaaaRecords = aaaaRecordList
	} else {
		record.AaaaRecords = nil
	}

	// AzureName
	record.AzureName = source.AzureName

	// CnameRecord
	if source.CnameRecord != nil {
		var cnameRecord CnameRecord
		err := cnameRecord.AssignProperties_From_CnameRecord(source.CnameRecord)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_CnameRecord() to populate field CnameRecord")
		}
		record.CnameRecord = &cnameRecord
	} else {
		record.CnameRecord = nil
	}

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

	// Metadata
	record.Metadata = genruntime.CloneMapOfStringToString(source.Metadata)

	// MxRecords
	if source.MxRecords != nil {
		mxRecordList := make([]MxRecord, len(source.MxRecords))
		for mxRecordIndex, mxRecordItem := range source.MxRecords {
			var mxRecord MxRecord
			err := mxRecord.AssignProperties_From_MxRecord(&mxRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_MxRecord() to populate field MxRecords")
			}
			mxRecordList[mxRecordIndex] = mxRecord
		}
		record.MxRecords = mxRecordList
	} else {
		record.MxRecords = nil
	}

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

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

	// PtrRecords
	if source.PtrRecords != nil {
		ptrRecordList := make([]PtrRecord, len(source.PtrRecords))
		for ptrRecordIndex, ptrRecordItem := range source.PtrRecords {
			var ptrRecord PtrRecord
			err := ptrRecord.AssignProperties_From_PtrRecord(&ptrRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_PtrRecord() to populate field PtrRecords")
			}
			ptrRecordList[ptrRecordIndex] = ptrRecord
		}
		record.PtrRecords = ptrRecordList
	} else {
		record.PtrRecords = nil
	}

	// SoaRecord
	if source.SoaRecord != nil {
		var soaRecord SoaRecord
		err := soaRecord.AssignProperties_From_SoaRecord(source.SoaRecord)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SoaRecord() to populate field SoaRecord")
		}
		record.SoaRecord = &soaRecord
	} else {
		record.SoaRecord = nil
	}

	// SrvRecords
	if source.SrvRecords != nil {
		srvRecordList := make([]SrvRecord, len(source.SrvRecords))
		for srvRecordIndex, srvRecordItem := range source.SrvRecords {
			var srvRecord SrvRecord
			err := srvRecord.AssignProperties_From_SrvRecord(&srvRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SrvRecord() to populate field SrvRecords")
			}
			srvRecordList[srvRecordIndex] = srvRecord
		}
		record.SrvRecords = srvRecordList
	} else {
		record.SrvRecords = nil
	}

	// Ttl
	record.Ttl = genruntime.ClonePointerToInt(source.Ttl)

	// TxtRecords
	if source.TxtRecords != nil {
		txtRecordList := make([]TxtRecord, len(source.TxtRecords))
		for txtRecordIndex, txtRecordItem := range source.TxtRecords {
			var txtRecord TxtRecord
			err := txtRecord.AssignProperties_From_TxtRecord(&txtRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_TxtRecord() to populate field TxtRecords")
			}
			txtRecordList[txtRecordIndex] = txtRecord
		}
		record.TxtRecords = txtRecordList
	} else {
		record.TxtRecords = nil
	}

	// No error
	return nil
}

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

	// ARecords
	if record.ARecords != nil {
		aRecordList := make([]storage.ARecord, len(record.ARecords))
		for aRecordIndex, aRecordItem := range record.ARecords {
			var aRecord storage.ARecord
			err := aRecordItem.AssignProperties_To_ARecord(&aRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ARecord() to populate field ARecords")
			}
			aRecordList[aRecordIndex] = aRecord
		}
		destination.ARecords = aRecordList
	} else {
		destination.ARecords = nil
	}

	// AaaaRecords
	if record.AaaaRecords != nil {
		aaaaRecordList := make([]storage.AaaaRecord, len(record.AaaaRecords))
		for aaaaRecordIndex, aaaaRecordItem := range record.AaaaRecords {
			var aaaaRecord storage.AaaaRecord
			err := aaaaRecordItem.AssignProperties_To_AaaaRecord(&aaaaRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_AaaaRecord() to populate field AaaaRecords")
			}
			aaaaRecordList[aaaaRecordIndex] = aaaaRecord
		}
		destination.AaaaRecords = aaaaRecordList
	} else {
		destination.AaaaRecords = nil
	}

	// AzureName
	destination.AzureName = record.AzureName

	// CnameRecord
	if record.CnameRecord != nil {
		var cnameRecord storage.CnameRecord
		err := record.CnameRecord.AssignProperties_To_CnameRecord(&cnameRecord)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_CnameRecord() to populate field CnameRecord")
		}
		destination.CnameRecord = &cnameRecord
	} else {
		destination.CnameRecord = nil
	}

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

	// Metadata
	destination.Metadata = genruntime.CloneMapOfStringToString(record.Metadata)

	// MxRecords
	if record.MxRecords != nil {
		mxRecordList := make([]storage.MxRecord, len(record.MxRecords))
		for mxRecordIndex, mxRecordItem := range record.MxRecords {
			var mxRecord storage.MxRecord
			err := mxRecordItem.AssignProperties_To_MxRecord(&mxRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_MxRecord() to populate field MxRecords")
			}
			mxRecordList[mxRecordIndex] = mxRecord
		}
		destination.MxRecords = mxRecordList
	} else {
		destination.MxRecords = nil
	}

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

	// OriginalVersion
	destination.OriginalVersion = record.OriginalVersion()

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

	// PtrRecords
	if record.PtrRecords != nil {
		ptrRecordList := make([]storage.PtrRecord, len(record.PtrRecords))
		for ptrRecordIndex, ptrRecordItem := range record.PtrRecords {
			var ptrRecord storage.PtrRecord
			err := ptrRecordItem.AssignProperties_To_PtrRecord(&ptrRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_PtrRecord() to populate field PtrRecords")
			}
			ptrRecordList[ptrRecordIndex] = ptrRecord
		}
		destination.PtrRecords = ptrRecordList
	} else {
		destination.PtrRecords = nil
	}

	// SoaRecord
	if record.SoaRecord != nil {
		var soaRecord storage.SoaRecord
		err := record.SoaRecord.AssignProperties_To_SoaRecord(&soaRecord)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SoaRecord() to populate field SoaRecord")
		}
		destination.SoaRecord = &soaRecord
	} else {
		destination.SoaRecord = nil
	}

	// SrvRecords
	if record.SrvRecords != nil {
		srvRecordList := make([]storage.SrvRecord, len(record.SrvRecords))
		for srvRecordIndex, srvRecordItem := range record.SrvRecords {
			var srvRecord storage.SrvRecord
			err := srvRecordItem.AssignProperties_To_SrvRecord(&srvRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SrvRecord() to populate field SrvRecords")
			}
			srvRecordList[srvRecordIndex] = srvRecord
		}
		destination.SrvRecords = srvRecordList
	} else {
		destination.SrvRecords = nil
	}

	// Ttl
	destination.Ttl = genruntime.ClonePointerToInt(record.Ttl)

	// TxtRecords
	if record.TxtRecords != nil {
		txtRecordList := make([]storage.TxtRecord, len(record.TxtRecords))
		for txtRecordIndex, txtRecordItem := range record.TxtRecords {
			var txtRecord storage.TxtRecord
			err := txtRecordItem.AssignProperties_To_TxtRecord(&txtRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_TxtRecord() to populate field TxtRecords")
			}
			txtRecordList[txtRecordIndex] = txtRecord
		}
		destination.TxtRecords = txtRecordList
	} else {
		destination.TxtRecords = nil
	}

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

	// No error
	return nil
}

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

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

type PrivateDnsZonesPTRRecord_STATUS struct {
	// ARecords: The list of A records in the record set.
	ARecords []ARecord_STATUS `json:"aRecords,omitempty"`

	// AaaaRecords: The list of AAAA records in the record set.
	AaaaRecords []AaaaRecord_STATUS `json:"aaaaRecords,omitempty"`

	// CnameRecord: The CNAME record in the record set.
	CnameRecord *CnameRecord_STATUS `json:"cnameRecord,omitempty"`

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

	// Etag: The ETag of the record set.
	Etag *string `json:"etag,omitempty"`

	// Fqdn: Fully qualified domain name of the record set.
	Fqdn *string `json:"fqdn,omitempty"`

	// Id: Fully qualified resource Id for the resource. Example -
	// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'.
	Id *string `json:"id,omitempty"`

	// IsAutoRegistered: Is the record set auto-registered in the Private DNS zone through a virtual network link?
	IsAutoRegistered *bool `json:"isAutoRegistered,omitempty"`

	// Metadata: The metadata attached to the record set.
	Metadata map[string]string `json:"metadata,omitempty"`

	// MxRecords: The list of MX records in the record set.
	MxRecords []MxRecord_STATUS `json:"mxRecords,omitempty"`

	// Name: The name of the record set.
	Name *string `json:"name,omitempty"`

	// PtrRecords: The list of PTR records in the record set.
	PtrRecords []PtrRecord_STATUS `json:"ptrRecords,omitempty"`

	// SoaRecord: The SOA record in the record set.
	SoaRecord *SoaRecord_STATUS `json:"soaRecord,omitempty"`

	// SrvRecords: The list of SRV records in the record set.
	SrvRecords []SrvRecord_STATUS `json:"srvRecords,omitempty"`

	// Ttl: The TTL (time-to-live) of the records in the record set.
	Ttl *int `json:"ttl,omitempty"`

	// TxtRecords: The list of TXT records in the record set.
	TxtRecords []TxtRecord_STATUS `json:"txtRecords,omitempty"`

	// Type: The type of the resource. Example - 'Microsoft.Network/privateDnsZones'.
	Type *string `json:"type,omitempty"`
}

var _ genruntime.ConvertibleStatus = &PrivateDnsZonesPTRRecord_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.PrivateDnsZonesPTRRecord_STATUS{}
	err := record.AssignProperties_To_PrivateDnsZonesPTRRecord_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 = &PrivateDnsZonesPTRRecord_STATUS{}

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

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

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

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

	// Set property "CnameRecord":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CnameRecord != nil {
			var cnameRecord1 CnameRecord_STATUS
			err := cnameRecord1.PopulateFromARM(owner, *typedInput.Properties.CnameRecord)
			if err != nil {
				return err
			}
			cnameRecord := cnameRecord1
			record.CnameRecord = &cnameRecord
		}
	}

	// no assignment for property "Conditions"

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

	// Set property "Fqdn":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Fqdn != nil {
			fqdn := *typedInput.Properties.Fqdn
			record.Fqdn = &fqdn
		}
	}

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

	// Set property "IsAutoRegistered":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IsAutoRegistered != nil {
			isAutoRegistered := *typedInput.Properties.IsAutoRegistered
			record.IsAutoRegistered = &isAutoRegistered
		}
	}

	// Set property "Metadata":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Metadata != nil {
			record.Metadata = make(map[string]string, len(typedInput.Properties.Metadata))
			for key, value := range typedInput.Properties.Metadata {
				record.Metadata[key] = value
			}
		}
	}

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

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

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

	// Set property "SoaRecord":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SoaRecord != nil {
			var soaRecord1 SoaRecord_STATUS
			err := soaRecord1.PopulateFromARM(owner, *typedInput.Properties.SoaRecord)
			if err != nil {
				return err
			}
			soaRecord := soaRecord1
			record.SoaRecord = &soaRecord
		}
	}

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

	// Set property "Ttl":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Ttl != nil {
			ttl := *typedInput.Properties.Ttl
			record.Ttl = &ttl
		}
	}

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

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

	// No error
	return nil
}

// AssignProperties_From_PrivateDnsZonesPTRRecord_STATUS populates our PrivateDnsZonesPTRRecord_STATUS from the provided source PrivateDnsZonesPTRRecord_STATUS
func (record *PrivateDnsZonesPTRRecord_STATUS) AssignProperties_From_PrivateDnsZonesPTRRecord_STATUS(source *storage.PrivateDnsZonesPTRRecord_STATUS) error {

	// ARecords
	if source.ARecords != nil {
		aRecordList := make([]ARecord_STATUS, len(source.ARecords))
		for aRecordIndex, aRecordItem := range source.ARecords {
			var aRecord ARecord_STATUS
			err := aRecord.AssignProperties_From_ARecord_STATUS(&aRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_ARecord_STATUS() to populate field ARecords")
			}
			aRecordList[aRecordIndex] = aRecord
		}
		record.ARecords = aRecordList
	} else {
		record.ARecords = nil
	}

	// AaaaRecords
	if source.AaaaRecords != nil {
		aaaaRecordList := make([]AaaaRecord_STATUS, len(source.AaaaRecords))
		for aaaaRecordIndex, aaaaRecordItem := range source.AaaaRecords {
			var aaaaRecord AaaaRecord_STATUS
			err := aaaaRecord.AssignProperties_From_AaaaRecord_STATUS(&aaaaRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_AaaaRecord_STATUS() to populate field AaaaRecords")
			}
			aaaaRecordList[aaaaRecordIndex] = aaaaRecord
		}
		record.AaaaRecords = aaaaRecordList
	} else {
		record.AaaaRecords = nil
	}

	// CnameRecord
	if source.CnameRecord != nil {
		var cnameRecord CnameRecord_STATUS
		err := cnameRecord.AssignProperties_From_CnameRecord_STATUS(source.CnameRecord)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_CnameRecord_STATUS() to populate field CnameRecord")
		}
		record.CnameRecord = &cnameRecord
	} else {
		record.CnameRecord = nil
	}

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

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

	// Fqdn
	record.Fqdn = genruntime.ClonePointerToString(source.Fqdn)

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

	// IsAutoRegistered
	if source.IsAutoRegistered != nil {
		isAutoRegistered := *source.IsAutoRegistered
		record.IsAutoRegistered = &isAutoRegistered
	} else {
		record.IsAutoRegistered = nil
	}

	// Metadata
	record.Metadata = genruntime.CloneMapOfStringToString(source.Metadata)

	// MxRecords
	if source.MxRecords != nil {
		mxRecordList := make([]MxRecord_STATUS, len(source.MxRecords))
		for mxRecordIndex, mxRecordItem := range source.MxRecords {
			var mxRecord MxRecord_STATUS
			err := mxRecord.AssignProperties_From_MxRecord_STATUS(&mxRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_MxRecord_STATUS() to populate field MxRecords")
			}
			mxRecordList[mxRecordIndex] = mxRecord
		}
		record.MxRecords = mxRecordList
	} else {
		record.MxRecords = nil
	}

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

	// PtrRecords
	if source.PtrRecords != nil {
		ptrRecordList := make([]PtrRecord_STATUS, len(source.PtrRecords))
		for ptrRecordIndex, ptrRecordItem := range source.PtrRecords {
			var ptrRecord PtrRecord_STATUS
			err := ptrRecord.AssignProperties_From_PtrRecord_STATUS(&ptrRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_PtrRecord_STATUS() to populate field PtrRecords")
			}
			ptrRecordList[ptrRecordIndex] = ptrRecord
		}
		record.PtrRecords = ptrRecordList
	} else {
		record.PtrRecords = nil
	}

	// SoaRecord
	if source.SoaRecord != nil {
		var soaRecord SoaRecord_STATUS
		err := soaRecord.AssignProperties_From_SoaRecord_STATUS(source.SoaRecord)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SoaRecord_STATUS() to populate field SoaRecord")
		}
		record.SoaRecord = &soaRecord
	} else {
		record.SoaRecord = nil
	}

	// SrvRecords
	if source.SrvRecords != nil {
		srvRecordList := make([]SrvRecord_STATUS, len(source.SrvRecords))
		for srvRecordIndex, srvRecordItem := range source.SrvRecords {
			var srvRecord SrvRecord_STATUS
			err := srvRecord.AssignProperties_From_SrvRecord_STATUS(&srvRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SrvRecord_STATUS() to populate field SrvRecords")
			}
			srvRecordList[srvRecordIndex] = srvRecord
		}
		record.SrvRecords = srvRecordList
	} else {
		record.SrvRecords = nil
	}

	// Ttl
	record.Ttl = genruntime.ClonePointerToInt(source.Ttl)

	// TxtRecords
	if source.TxtRecords != nil {
		txtRecordList := make([]TxtRecord_STATUS, len(source.TxtRecords))
		for txtRecordIndex, txtRecordItem := range source.TxtRecords {
			var txtRecord TxtRecord_STATUS
			err := txtRecord.AssignProperties_From_TxtRecord_STATUS(&txtRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_TxtRecord_STATUS() to populate field TxtRecords")
			}
			txtRecordList[txtRecordIndex] = txtRecord
		}
		record.TxtRecords = txtRecordList
	} else {
		record.TxtRecords = nil
	}

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

	// No error
	return nil
}

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

	// ARecords
	if record.ARecords != nil {
		aRecordList := make([]storage.ARecord_STATUS, len(record.ARecords))
		for aRecordIndex, aRecordItem := range record.ARecords {
			var aRecord storage.ARecord_STATUS
			err := aRecordItem.AssignProperties_To_ARecord_STATUS(&aRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ARecord_STATUS() to populate field ARecords")
			}
			aRecordList[aRecordIndex] = aRecord
		}
		destination.ARecords = aRecordList
	} else {
		destination.ARecords = nil
	}

	// AaaaRecords
	if record.AaaaRecords != nil {
		aaaaRecordList := make([]storage.AaaaRecord_STATUS, len(record.AaaaRecords))
		for aaaaRecordIndex, aaaaRecordItem := range record.AaaaRecords {
			var aaaaRecord storage.AaaaRecord_STATUS
			err := aaaaRecordItem.AssignProperties_To_AaaaRecord_STATUS(&aaaaRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_AaaaRecord_STATUS() to populate field AaaaRecords")
			}
			aaaaRecordList[aaaaRecordIndex] = aaaaRecord
		}
		destination.AaaaRecords = aaaaRecordList
	} else {
		destination.AaaaRecords = nil
	}

	// CnameRecord
	if record.CnameRecord != nil {
		var cnameRecord storage.CnameRecord_STATUS
		err := record.CnameRecord.AssignProperties_To_CnameRecord_STATUS(&cnameRecord)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_CnameRecord_STATUS() to populate field CnameRecord")
		}
		destination.CnameRecord = &cnameRecord
	} else {
		destination.CnameRecord = nil
	}

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

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

	// Fqdn
	destination.Fqdn = genruntime.ClonePointerToString(record.Fqdn)

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

	// IsAutoRegistered
	if record.IsAutoRegistered != nil {
		isAutoRegistered := *record.IsAutoRegistered
		destination.IsAutoRegistered = &isAutoRegistered
	} else {
		destination.IsAutoRegistered = nil
	}

	// Metadata
	destination.Metadata = genruntime.CloneMapOfStringToString(record.Metadata)

	// MxRecords
	if record.MxRecords != nil {
		mxRecordList := make([]storage.MxRecord_STATUS, len(record.MxRecords))
		for mxRecordIndex, mxRecordItem := range record.MxRecords {
			var mxRecord storage.MxRecord_STATUS
			err := mxRecordItem.AssignProperties_To_MxRecord_STATUS(&mxRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_MxRecord_STATUS() to populate field MxRecords")
			}
			mxRecordList[mxRecordIndex] = mxRecord
		}
		destination.MxRecords = mxRecordList
	} else {
		destination.MxRecords = nil
	}

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

	// PtrRecords
	if record.PtrRecords != nil {
		ptrRecordList := make([]storage.PtrRecord_STATUS, len(record.PtrRecords))
		for ptrRecordIndex, ptrRecordItem := range record.PtrRecords {
			var ptrRecord storage.PtrRecord_STATUS
			err := ptrRecordItem.AssignProperties_To_PtrRecord_STATUS(&ptrRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_PtrRecord_STATUS() to populate field PtrRecords")
			}
			ptrRecordList[ptrRecordIndex] = ptrRecord
		}
		destination.PtrRecords = ptrRecordList
	} else {
		destination.PtrRecords = nil
	}

	// SoaRecord
	if record.SoaRecord != nil {
		var soaRecord storage.SoaRecord_STATUS
		err := record.SoaRecord.AssignProperties_To_SoaRecord_STATUS(&soaRecord)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SoaRecord_STATUS() to populate field SoaRecord")
		}
		destination.SoaRecord = &soaRecord
	} else {
		destination.SoaRecord = nil
	}

	// SrvRecords
	if record.SrvRecords != nil {
		srvRecordList := make([]storage.SrvRecord_STATUS, len(record.SrvRecords))
		for srvRecordIndex, srvRecordItem := range record.SrvRecords {
			var srvRecord storage.SrvRecord_STATUS
			err := srvRecordItem.AssignProperties_To_SrvRecord_STATUS(&srvRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SrvRecord_STATUS() to populate field SrvRecords")
			}
			srvRecordList[srvRecordIndex] = srvRecord
		}
		destination.SrvRecords = srvRecordList
	} else {
		destination.SrvRecords = nil
	}

	// Ttl
	destination.Ttl = genruntime.ClonePointerToInt(record.Ttl)

	// TxtRecords
	if record.TxtRecords != nil {
		txtRecordList := make([]storage.TxtRecord_STATUS, len(record.TxtRecords))
		for txtRecordIndex, txtRecordItem := range record.TxtRecords {
			var txtRecord storage.TxtRecord_STATUS
			err := txtRecordItem.AssignProperties_To_TxtRecord_STATUS(&txtRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_TxtRecord_STATUS() to populate field TxtRecords")
			}
			txtRecordList[txtRecordIndex] = txtRecord
		}
		destination.TxtRecords = txtRecordList
	} else {
		destination.TxtRecords = nil
	}

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

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

	// No error
	return nil
}

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

func init() {
	SchemeBuilder.Register(&PrivateDnsZonesPTRRecord{}, &PrivateDnsZonesPTRRecordList{})
}
