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

import (
	"fmt"
	v20201201s "github.com/Azure/azure-service-operator/v2/api/compute/v1api20201201/storage"
	v20210701s "github.com/Azure/azure-service-operator/v2/api/compute/v1api20210701/storage"
	v20220301s "github.com/Azure/azure-service-operator/v2/api/compute/v1api20220301/storage"
	v20240302s "github.com/Azure/azure-service-operator/v2/api/compute/v1api20240302/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,compute}
// +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"
// Storage version of v1api20200930.Snapshot
// Generator information:
// - Generated from: /compute/resource-manager/Microsoft.Compute/DiskRP/stable/2020-09-30/disk.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}
type Snapshot struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              Snapshot_Spec   `json:"spec,omitempty"`
	Status            Snapshot_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &Snapshot{}

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

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

var _ conversion.Convertible = &Snapshot{}

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

	return snapshot.AssignProperties_From_Snapshot(source)
}

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

	return snapshot.AssignProperties_To_Snapshot(destination)
}

var _ configmaps.Exporter = &Snapshot{}

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

var _ secrets.Exporter = &Snapshot{}

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

var _ genruntime.KubernetesResource = &Snapshot{}

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

// GetAPIVersion returns the ARM API version of the resource. This is always "2020-09-30"
func (snapshot Snapshot) GetAPIVersion() string {
	return "2020-09-30"
}

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.Compute/snapshots"
func (snapshot *Snapshot) GetType() string {
	return "Microsoft.Compute/snapshots"
}

// NewEmptyStatus returns a new empty (blank) status
func (snapshot *Snapshot) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &Snapshot_STATUS{}
}

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

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

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

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

	snapshot.Status = st
	return nil
}

// AssignProperties_From_Snapshot populates our Snapshot from the provided source Snapshot
func (snapshot *Snapshot) AssignProperties_From_Snapshot(source *v20240302s.Snapshot) error {

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

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

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

	// Invoke the augmentConversionForSnapshot interface (if implemented) to customize the conversion
	var snapshotAsAny any = snapshot
	if augmentedSnapshot, ok := snapshotAsAny.(augmentConversionForSnapshot); ok {
		err := augmentedSnapshot.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_Snapshot populates the provided destination Snapshot from our Snapshot
func (snapshot *Snapshot) AssignProperties_To_Snapshot(destination *v20240302s.Snapshot) error {

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

	// Spec
	var spec v20240302s.Snapshot_Spec
	err := snapshot.Spec.AssignProperties_To_Snapshot_Spec(&spec)
	if err != nil {
		return eris.Wrap(err, "calling AssignProperties_To_Snapshot_Spec() to populate field Spec")
	}
	destination.Spec = spec

	// Status
	var status v20240302s.Snapshot_STATUS
	err = snapshot.Status.AssignProperties_To_Snapshot_STATUS(&status)
	if err != nil {
		return eris.Wrap(err, "calling AssignProperties_To_Snapshot_STATUS() to populate field Status")
	}
	destination.Status = status

	// Invoke the augmentConversionForSnapshot interface (if implemented) to customize the conversion
	var snapshotAsAny any = snapshot
	if augmentedSnapshot, ok := snapshotAsAny.(augmentConversionForSnapshot); ok {
		err := augmentedSnapshot.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// OriginalGVK returns a GroupValueKind for the original API version used to create the resource
func (snapshot *Snapshot) OriginalGVK() *schema.GroupVersionKind {
	return &schema.GroupVersionKind{
		Group:   GroupVersion.Group,
		Version: snapshot.Spec.OriginalVersion,
		Kind:    "Snapshot",
	}
}

// +kubebuilder:object:root=true
// Storage version of v1api20200930.Snapshot
// Generator information:
// - Generated from: /compute/resource-manager/Microsoft.Compute/DiskRP/stable/2020-09-30/disk.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}
type SnapshotList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Snapshot `json:"items"`
}

type augmentConversionForSnapshot interface {
	AssignPropertiesFrom(src *v20240302s.Snapshot) error
	AssignPropertiesTo(dst *v20240302s.Snapshot) error
}

// Storage version of v1api20200930.Snapshot_Spec
type Snapshot_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"`
	CreationData *CreationData `json:"creationData,omitempty"`

	// DiskAccessReference: ARM id of the DiskAccess resource for using private endpoints on disks.
	DiskAccessReference          *genruntime.ResourceReference `armReference:"DiskAccessId" json:"diskAccessReference,omitempty"`
	DiskSizeGB                   *int                          `json:"diskSizeGB,omitempty"`
	Encryption                   *Encryption                   `json:"encryption,omitempty"`
	EncryptionSettingsCollection *EncryptionSettingsCollection `json:"encryptionSettingsCollection,omitempty"`
	ExtendedLocation             *ExtendedLocation             `json:"extendedLocation,omitempty"`
	HyperVGeneration             *string                       `json:"hyperVGeneration,omitempty"`
	Incremental                  *bool                         `json:"incremental,omitempty"`
	Location                     *string                       `json:"location,omitempty"`
	NetworkAccessPolicy          *string                       `json:"networkAccessPolicy,omitempty"`
	OperatorSpec                 *SnapshotOperatorSpec         `json:"operatorSpec,omitempty"`
	OriginalVersion              string                        `json:"originalVersion,omitempty"`
	OsType                       *string                       `json:"osType,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"`
	PropertyBag  genruntime.PropertyBag             `json:"$propertyBag,omitempty"`
	PurchasePlan *PurchasePlan                      `json:"purchasePlan,omitempty"`
	Sku          *SnapshotSku                       `json:"sku,omitempty"`
	Tags         map[string]string                  `json:"tags,omitempty"`
}

var _ genruntime.ConvertibleSpec = &Snapshot_Spec{}

// ConvertSpecFrom populates our Snapshot_Spec from the provided source
func (snapshot *Snapshot_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error {
	src, ok := source.(*v20240302s.Snapshot_Spec)
	if ok {
		// Populate our instance from source
		return snapshot.AssignProperties_From_Snapshot_Spec(src)
	}

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

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

	return nil
}

// ConvertSpecTo populates the provided destination from our Snapshot_Spec
func (snapshot *Snapshot_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error {
	dst, ok := destination.(*v20240302s.Snapshot_Spec)
	if ok {
		// Populate destination from our instance
		return snapshot.AssignProperties_To_Snapshot_Spec(dst)
	}

	// Convert to an intermediate form
	dst = &v20240302s.Snapshot_Spec{}
	err := snapshot.AssignProperties_To_Snapshot_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_Snapshot_Spec populates our Snapshot_Spec from the provided source Snapshot_Spec
func (snapshot *Snapshot_Spec) AssignProperties_From_Snapshot_Spec(source *v20240302s.Snapshot_Spec) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// AzureName
	snapshot.AzureName = source.AzureName

	// CompletionPercent
	if source.CompletionPercent != nil {
		propertyBag.Add("CompletionPercent", *source.CompletionPercent)
	} else {
		propertyBag.Remove("CompletionPercent")
	}

	// CopyCompletionError
	if source.CopyCompletionError != nil {
		propertyBag.Add("CopyCompletionError", *source.CopyCompletionError)
	} else {
		propertyBag.Remove("CopyCompletionError")
	}

	// CreationData
	if source.CreationData != nil {
		var creationDatum CreationData
		err := creationDatum.AssignProperties_From_CreationData(source.CreationData)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_CreationData() to populate field CreationData")
		}
		snapshot.CreationData = &creationDatum
	} else {
		snapshot.CreationData = nil
	}

	// DataAccessAuthMode
	if source.DataAccessAuthMode != nil {
		propertyBag.Add("DataAccessAuthMode", *source.DataAccessAuthMode)
	} else {
		propertyBag.Remove("DataAccessAuthMode")
	}

	// DiskAccessReference
	if source.DiskAccessReference != nil {
		diskAccessReference := source.DiskAccessReference.Copy()
		snapshot.DiskAccessReference = &diskAccessReference
	} else {
		snapshot.DiskAccessReference = nil
	}

	// DiskSizeGB
	snapshot.DiskSizeGB = genruntime.ClonePointerToInt(source.DiskSizeGB)

	// Encryption
	if source.Encryption != nil {
		var encryption Encryption
		err := encryption.AssignProperties_From_Encryption(source.Encryption)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Encryption() to populate field Encryption")
		}
		snapshot.Encryption = &encryption
	} else {
		snapshot.Encryption = nil
	}

	// EncryptionSettingsCollection
	if source.EncryptionSettingsCollection != nil {
		var encryptionSettingsCollection EncryptionSettingsCollection
		err := encryptionSettingsCollection.AssignProperties_From_EncryptionSettingsCollection(source.EncryptionSettingsCollection)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_EncryptionSettingsCollection() to populate field EncryptionSettingsCollection")
		}
		snapshot.EncryptionSettingsCollection = &encryptionSettingsCollection
	} else {
		snapshot.EncryptionSettingsCollection = nil
	}

	// ExtendedLocation
	if source.ExtendedLocation != nil {
		var extendedLocationStash v20220301s.ExtendedLocation
		err := extendedLocationStash.AssignProperties_From_ExtendedLocation(source.ExtendedLocation)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ExtendedLocation() to populate field ExtendedLocationStash from ExtendedLocation")
		}
		var extendedLocationStashLocal v20210701s.ExtendedLocation
		err = extendedLocationStashLocal.AssignProperties_From_ExtendedLocation(&extendedLocationStash)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ExtendedLocation() to populate field ExtendedLocationStash")
		}
		var extendedLocationStashCopy v20201201s.ExtendedLocation
		err = extendedLocationStashCopy.AssignProperties_From_ExtendedLocation(&extendedLocationStashLocal)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ExtendedLocation() to populate field ExtendedLocationStash")
		}
		var extendedLocation ExtendedLocation
		err = extendedLocation.AssignProperties_From_ExtendedLocation(&extendedLocationStashCopy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ExtendedLocation() to populate field ExtendedLocation from ExtendedLocationStash")
		}
		snapshot.ExtendedLocation = &extendedLocation
	} else {
		snapshot.ExtendedLocation = nil
	}

	// HyperVGeneration
	snapshot.HyperVGeneration = genruntime.ClonePointerToString(source.HyperVGeneration)

	// Incremental
	if source.Incremental != nil {
		incremental := *source.Incremental
		snapshot.Incremental = &incremental
	} else {
		snapshot.Incremental = nil
	}

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

	// NetworkAccessPolicy
	snapshot.NetworkAccessPolicy = genruntime.ClonePointerToString(source.NetworkAccessPolicy)

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

	// OriginalVersion
	snapshot.OriginalVersion = source.OriginalVersion

	// OsType
	snapshot.OsType = genruntime.ClonePointerToString(source.OsType)

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

	// PublicNetworkAccess
	if source.PublicNetworkAccess != nil {
		propertyBag.Add("PublicNetworkAccess", *source.PublicNetworkAccess)
	} else {
		propertyBag.Remove("PublicNetworkAccess")
	}

	// PurchasePlan
	if source.PurchasePlan != nil {
		var purchasePlan PurchasePlan
		err := purchasePlan.AssignProperties_From_DiskPurchasePlan(source.PurchasePlan)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_DiskPurchasePlan() to populate field PurchasePlan")
		}
		snapshot.PurchasePlan = &purchasePlan
	} else {
		snapshot.PurchasePlan = nil
	}

	// SecurityProfile
	if source.SecurityProfile != nil {
		propertyBag.Add("SecurityProfile", *source.SecurityProfile)
	} else {
		propertyBag.Remove("SecurityProfile")
	}

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

	// SupportedCapabilities
	if source.SupportedCapabilities != nil {
		propertyBag.Add("SupportedCapabilities", *source.SupportedCapabilities)
	} else {
		propertyBag.Remove("SupportedCapabilities")
	}

	// SupportsHibernation
	if source.SupportsHibernation != nil {
		propertyBag.Add("SupportsHibernation", *source.SupportsHibernation)
	} else {
		propertyBag.Remove("SupportsHibernation")
	}

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

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

	// Invoke the augmentConversionForSnapshot_Spec interface (if implemented) to customize the conversion
	var snapshotAsAny any = snapshot
	if augmentedSnapshot, ok := snapshotAsAny.(augmentConversionForSnapshot_Spec); ok {
		err := augmentedSnapshot.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_Snapshot_Spec populates the provided destination Snapshot_Spec from our Snapshot_Spec
func (snapshot *Snapshot_Spec) AssignProperties_To_Snapshot_Spec(destination *v20240302s.Snapshot_Spec) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(snapshot.PropertyBag)

	// AzureName
	destination.AzureName = snapshot.AzureName

	// CompletionPercent
	if propertyBag.Contains("CompletionPercent") {
		var completionPercent float64
		err := propertyBag.Pull("CompletionPercent", &completionPercent)
		if err != nil {
			return eris.Wrap(err, "pulling 'CompletionPercent' from propertyBag")
		}

		destination.CompletionPercent = &completionPercent
	} else {
		destination.CompletionPercent = nil
	}

	// CopyCompletionError
	if propertyBag.Contains("CopyCompletionError") {
		var copyCompletionError v20240302s.CopyCompletionError
		err := propertyBag.Pull("CopyCompletionError", &copyCompletionError)
		if err != nil {
			return eris.Wrap(err, "pulling 'CopyCompletionError' from propertyBag")
		}

		destination.CopyCompletionError = &copyCompletionError
	} else {
		destination.CopyCompletionError = nil
	}

	// CreationData
	if snapshot.CreationData != nil {
		var creationDatum v20240302s.CreationData
		err := snapshot.CreationData.AssignProperties_To_CreationData(&creationDatum)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_CreationData() to populate field CreationData")
		}
		destination.CreationData = &creationDatum
	} else {
		destination.CreationData = nil
	}

	// DataAccessAuthMode
	if propertyBag.Contains("DataAccessAuthMode") {
		var dataAccessAuthMode string
		err := propertyBag.Pull("DataAccessAuthMode", &dataAccessAuthMode)
		if err != nil {
			return eris.Wrap(err, "pulling 'DataAccessAuthMode' from propertyBag")
		}

		destination.DataAccessAuthMode = &dataAccessAuthMode
	} else {
		destination.DataAccessAuthMode = nil
	}

	// DiskAccessReference
	if snapshot.DiskAccessReference != nil {
		diskAccessReference := snapshot.DiskAccessReference.Copy()
		destination.DiskAccessReference = &diskAccessReference
	} else {
		destination.DiskAccessReference = nil
	}

	// DiskSizeGB
	destination.DiskSizeGB = genruntime.ClonePointerToInt(snapshot.DiskSizeGB)

	// Encryption
	if snapshot.Encryption != nil {
		var encryption v20240302s.Encryption
		err := snapshot.Encryption.AssignProperties_To_Encryption(&encryption)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Encryption() to populate field Encryption")
		}
		destination.Encryption = &encryption
	} else {
		destination.Encryption = nil
	}

	// EncryptionSettingsCollection
	if snapshot.EncryptionSettingsCollection != nil {
		var encryptionSettingsCollection v20240302s.EncryptionSettingsCollection
		err := snapshot.EncryptionSettingsCollection.AssignProperties_To_EncryptionSettingsCollection(&encryptionSettingsCollection)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_EncryptionSettingsCollection() to populate field EncryptionSettingsCollection")
		}
		destination.EncryptionSettingsCollection = &encryptionSettingsCollection
	} else {
		destination.EncryptionSettingsCollection = nil
	}

	// ExtendedLocation
	if snapshot.ExtendedLocation != nil {
		var extendedLocationStash v20201201s.ExtendedLocation
		err := snapshot.ExtendedLocation.AssignProperties_To_ExtendedLocation(&extendedLocationStash)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ExtendedLocation() to populate field ExtendedLocationStash from ExtendedLocation")
		}
		var extendedLocationStashLocal v20210701s.ExtendedLocation
		err = extendedLocationStash.AssignProperties_To_ExtendedLocation(&extendedLocationStashLocal)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ExtendedLocation() to populate field ExtendedLocationStash")
		}
		var extendedLocationStashCopy v20220301s.ExtendedLocation
		err = extendedLocationStashLocal.AssignProperties_To_ExtendedLocation(&extendedLocationStashCopy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ExtendedLocation() to populate field ExtendedLocationStash")
		}
		var extendedLocation v20240302s.ExtendedLocation
		err = extendedLocationStashCopy.AssignProperties_To_ExtendedLocation(&extendedLocation)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ExtendedLocation() to populate field ExtendedLocation from ExtendedLocationStash")
		}
		destination.ExtendedLocation = &extendedLocation
	} else {
		destination.ExtendedLocation = nil
	}

	// HyperVGeneration
	destination.HyperVGeneration = genruntime.ClonePointerToString(snapshot.HyperVGeneration)

	// Incremental
	if snapshot.Incremental != nil {
		incremental := *snapshot.Incremental
		destination.Incremental = &incremental
	} else {
		destination.Incremental = nil
	}

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

	// NetworkAccessPolicy
	destination.NetworkAccessPolicy = genruntime.ClonePointerToString(snapshot.NetworkAccessPolicy)

	// OperatorSpec
	if snapshot.OperatorSpec != nil {
		var operatorSpec v20240302s.SnapshotOperatorSpec
		err := snapshot.OperatorSpec.AssignProperties_To_SnapshotOperatorSpec(&operatorSpec)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SnapshotOperatorSpec() to populate field OperatorSpec")
		}
		destination.OperatorSpec = &operatorSpec
	} else {
		destination.OperatorSpec = nil
	}

	// OriginalVersion
	destination.OriginalVersion = snapshot.OriginalVersion

	// OsType
	destination.OsType = genruntime.ClonePointerToString(snapshot.OsType)

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

	// PublicNetworkAccess
	if propertyBag.Contains("PublicNetworkAccess") {
		var publicNetworkAccess string
		err := propertyBag.Pull("PublicNetworkAccess", &publicNetworkAccess)
		if err != nil {
			return eris.Wrap(err, "pulling 'PublicNetworkAccess' from propertyBag")
		}

		destination.PublicNetworkAccess = &publicNetworkAccess
	} else {
		destination.PublicNetworkAccess = nil
	}

	// PurchasePlan
	if snapshot.PurchasePlan != nil {
		var purchasePlan v20240302s.DiskPurchasePlan
		err := snapshot.PurchasePlan.AssignProperties_To_DiskPurchasePlan(&purchasePlan)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_DiskPurchasePlan() to populate field PurchasePlan")
		}
		destination.PurchasePlan = &purchasePlan
	} else {
		destination.PurchasePlan = nil
	}

	// SecurityProfile
	if propertyBag.Contains("SecurityProfile") {
		var securityProfile v20240302s.DiskSecurityProfile
		err := propertyBag.Pull("SecurityProfile", &securityProfile)
		if err != nil {
			return eris.Wrap(err, "pulling 'SecurityProfile' from propertyBag")
		}

		destination.SecurityProfile = &securityProfile
	} else {
		destination.SecurityProfile = nil
	}

	// Sku
	if snapshot.Sku != nil {
		var sku v20240302s.SnapshotSku
		err := snapshot.Sku.AssignProperties_To_SnapshotSku(&sku)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SnapshotSku() to populate field Sku")
		}
		destination.Sku = &sku
	} else {
		destination.Sku = nil
	}

	// SupportedCapabilities
	if propertyBag.Contains("SupportedCapabilities") {
		var supportedCapability v20240302s.SupportedCapabilities
		err := propertyBag.Pull("SupportedCapabilities", &supportedCapability)
		if err != nil {
			return eris.Wrap(err, "pulling 'SupportedCapabilities' from propertyBag")
		}

		destination.SupportedCapabilities = &supportedCapability
	} else {
		destination.SupportedCapabilities = nil
	}

	// SupportsHibernation
	if propertyBag.Contains("SupportsHibernation") {
		var supportsHibernation bool
		err := propertyBag.Pull("SupportsHibernation", &supportsHibernation)
		if err != nil {
			return eris.Wrap(err, "pulling 'SupportsHibernation' from propertyBag")
		}

		destination.SupportsHibernation = &supportsHibernation
	} else {
		destination.SupportsHibernation = nil
	}

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

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

	// Invoke the augmentConversionForSnapshot_Spec interface (if implemented) to customize the conversion
	var snapshotAsAny any = snapshot
	if augmentedSnapshot, ok := snapshotAsAny.(augmentConversionForSnapshot_Spec); ok {
		err := augmentedSnapshot.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20200930.Snapshot_STATUS
// Snapshot resource.
type Snapshot_STATUS struct {
	Conditions                   []conditions.Condition               `json:"conditions,omitempty"`
	CreationData                 *CreationData_STATUS                 `json:"creationData,omitempty"`
	DiskAccessId                 *string                              `json:"diskAccessId,omitempty"`
	DiskSizeBytes                *int                                 `json:"diskSizeBytes,omitempty"`
	DiskSizeGB                   *int                                 `json:"diskSizeGB,omitempty"`
	DiskState                    *string                              `json:"diskState,omitempty"`
	Encryption                   *Encryption_STATUS                   `json:"encryption,omitempty"`
	EncryptionSettingsCollection *EncryptionSettingsCollection_STATUS `json:"encryptionSettingsCollection,omitempty"`
	ExtendedLocation             *ExtendedLocation_STATUS             `json:"extendedLocation,omitempty"`
	HyperVGeneration             *string                              `json:"hyperVGeneration,omitempty"`
	Id                           *string                              `json:"id,omitempty"`
	Incremental                  *bool                                `json:"incremental,omitempty"`
	Location                     *string                              `json:"location,omitempty"`
	ManagedBy                    *string                              `json:"managedBy,omitempty"`
	Name                         *string                              `json:"name,omitempty"`
	NetworkAccessPolicy          *string                              `json:"networkAccessPolicy,omitempty"`
	OsType                       *string                              `json:"osType,omitempty"`
	PropertyBag                  genruntime.PropertyBag               `json:"$propertyBag,omitempty"`
	ProvisioningState            *string                              `json:"provisioningState,omitempty"`
	PurchasePlan                 *PurchasePlan_STATUS                 `json:"purchasePlan,omitempty"`
	Sku                          *SnapshotSku_STATUS                  `json:"sku,omitempty"`
	Tags                         map[string]string                    `json:"tags,omitempty"`
	TimeCreated                  *string                              `json:"timeCreated,omitempty"`
	Type                         *string                              `json:"type,omitempty"`
	UniqueId                     *string                              `json:"uniqueId,omitempty"`
}

var _ genruntime.ConvertibleStatus = &Snapshot_STATUS{}

// ConvertStatusFrom populates our Snapshot_STATUS from the provided source
func (snapshot *Snapshot_STATUS) ConvertStatusFrom(source genruntime.ConvertibleStatus) error {
	src, ok := source.(*v20240302s.Snapshot_STATUS)
	if ok {
		// Populate our instance from source
		return snapshot.AssignProperties_From_Snapshot_STATUS(src)
	}

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

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

	return nil
}

// ConvertStatusTo populates the provided destination from our Snapshot_STATUS
func (snapshot *Snapshot_STATUS) ConvertStatusTo(destination genruntime.ConvertibleStatus) error {
	dst, ok := destination.(*v20240302s.Snapshot_STATUS)
	if ok {
		// Populate destination from our instance
		return snapshot.AssignProperties_To_Snapshot_STATUS(dst)
	}

	// Convert to an intermediate form
	dst = &v20240302s.Snapshot_STATUS{}
	err := snapshot.AssignProperties_To_Snapshot_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
}

// AssignProperties_From_Snapshot_STATUS populates our Snapshot_STATUS from the provided source Snapshot_STATUS
func (snapshot *Snapshot_STATUS) AssignProperties_From_Snapshot_STATUS(source *v20240302s.Snapshot_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// CompletionPercent
	if source.CompletionPercent != nil {
		propertyBag.Add("CompletionPercent", *source.CompletionPercent)
	} else {
		propertyBag.Remove("CompletionPercent")
	}

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

	// CopyCompletionError
	if source.CopyCompletionError != nil {
		propertyBag.Add("CopyCompletionError", *source.CopyCompletionError)
	} else {
		propertyBag.Remove("CopyCompletionError")
	}

	// CreationData
	if source.CreationData != nil {
		var creationDatum CreationData_STATUS
		err := creationDatum.AssignProperties_From_CreationData_STATUS(source.CreationData)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_CreationData_STATUS() to populate field CreationData")
		}
		snapshot.CreationData = &creationDatum
	} else {
		snapshot.CreationData = nil
	}

	// DataAccessAuthMode
	if source.DataAccessAuthMode != nil {
		propertyBag.Add("DataAccessAuthMode", *source.DataAccessAuthMode)
	} else {
		propertyBag.Remove("DataAccessAuthMode")
	}

	// DiskAccessId
	snapshot.DiskAccessId = genruntime.ClonePointerToString(source.DiskAccessId)

	// DiskSizeBytes
	snapshot.DiskSizeBytes = genruntime.ClonePointerToInt(source.DiskSizeBytes)

	// DiskSizeGB
	snapshot.DiskSizeGB = genruntime.ClonePointerToInt(source.DiskSizeGB)

	// DiskState
	snapshot.DiskState = genruntime.ClonePointerToString(source.DiskState)

	// Encryption
	if source.Encryption != nil {
		var encryption Encryption_STATUS
		err := encryption.AssignProperties_From_Encryption_STATUS(source.Encryption)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Encryption_STATUS() to populate field Encryption")
		}
		snapshot.Encryption = &encryption
	} else {
		snapshot.Encryption = nil
	}

	// EncryptionSettingsCollection
	if source.EncryptionSettingsCollection != nil {
		var encryptionSettingsCollection EncryptionSettingsCollection_STATUS
		err := encryptionSettingsCollection.AssignProperties_From_EncryptionSettingsCollection_STATUS(source.EncryptionSettingsCollection)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_EncryptionSettingsCollection_STATUS() to populate field EncryptionSettingsCollection")
		}
		snapshot.EncryptionSettingsCollection = &encryptionSettingsCollection
	} else {
		snapshot.EncryptionSettingsCollection = nil
	}

	// ExtendedLocation
	if source.ExtendedLocation != nil {
		var extendedLocationSTATUSStash v20220301s.ExtendedLocation_STATUS
		err := extendedLocationSTATUSStash.AssignProperties_From_ExtendedLocation_STATUS(source.ExtendedLocation)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ExtendedLocation_STATUS() to populate field ExtendedLocation_STATUSStash from ExtendedLocation")
		}
		var extendedLocationSTATUSStashLocal v20210701s.ExtendedLocation_STATUS
		err = extendedLocationSTATUSStashLocal.AssignProperties_From_ExtendedLocation_STATUS(&extendedLocationSTATUSStash)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ExtendedLocation_STATUS() to populate field ExtendedLocation_STATUSStash")
		}
		var extendedLocationSTATUSStashCopy v20201201s.ExtendedLocation_STATUS
		err = extendedLocationSTATUSStashCopy.AssignProperties_From_ExtendedLocation_STATUS(&extendedLocationSTATUSStashLocal)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ExtendedLocation_STATUS() to populate field ExtendedLocation_STATUSStash")
		}
		var extendedLocation ExtendedLocation_STATUS
		err = extendedLocation.AssignProperties_From_ExtendedLocation_STATUS(&extendedLocationSTATUSStashCopy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ExtendedLocation_STATUS() to populate field ExtendedLocation from ExtendedLocation_STATUSStash")
		}
		snapshot.ExtendedLocation = &extendedLocation
	} else {
		snapshot.ExtendedLocation = nil
	}

	// HyperVGeneration
	snapshot.HyperVGeneration = genruntime.ClonePointerToString(source.HyperVGeneration)

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

	// Incremental
	if source.Incremental != nil {
		incremental := *source.Incremental
		snapshot.Incremental = &incremental
	} else {
		snapshot.Incremental = nil
	}

	// IncrementalSnapshotFamilyId
	if source.IncrementalSnapshotFamilyId != nil {
		propertyBag.Add("IncrementalSnapshotFamilyId", *source.IncrementalSnapshotFamilyId)
	} else {
		propertyBag.Remove("IncrementalSnapshotFamilyId")
	}

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

	// ManagedBy
	snapshot.ManagedBy = genruntime.ClonePointerToString(source.ManagedBy)

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

	// NetworkAccessPolicy
	snapshot.NetworkAccessPolicy = genruntime.ClonePointerToString(source.NetworkAccessPolicy)

	// OsType
	snapshot.OsType = genruntime.ClonePointerToString(source.OsType)

	// ProvisioningState
	snapshot.ProvisioningState = genruntime.ClonePointerToString(source.ProvisioningState)

	// PublicNetworkAccess
	if source.PublicNetworkAccess != nil {
		propertyBag.Add("PublicNetworkAccess", *source.PublicNetworkAccess)
	} else {
		propertyBag.Remove("PublicNetworkAccess")
	}

	// PurchasePlan
	if source.PurchasePlan != nil {
		var purchasePlan PurchasePlan_STATUS
		err := purchasePlan.AssignProperties_From_DiskPurchasePlan_STATUS(source.PurchasePlan)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_DiskPurchasePlan_STATUS() to populate field PurchasePlan")
		}
		snapshot.PurchasePlan = &purchasePlan
	} else {
		snapshot.PurchasePlan = nil
	}

	// SecurityProfile
	if source.SecurityProfile != nil {
		propertyBag.Add("SecurityProfile", *source.SecurityProfile)
	} else {
		propertyBag.Remove("SecurityProfile")
	}

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

	// SupportedCapabilities
	if source.SupportedCapabilities != nil {
		propertyBag.Add("SupportedCapabilities", *source.SupportedCapabilities)
	} else {
		propertyBag.Remove("SupportedCapabilities")
	}

	// SupportsHibernation
	if source.SupportsHibernation != nil {
		propertyBag.Add("SupportsHibernation", *source.SupportsHibernation)
	} else {
		propertyBag.Remove("SupportsHibernation")
	}

	// SystemData
	if source.SystemData != nil {
		propertyBag.Add("SystemData", *source.SystemData)
	} else {
		propertyBag.Remove("SystemData")
	}

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

	// TimeCreated
	snapshot.TimeCreated = genruntime.ClonePointerToString(source.TimeCreated)

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

	// UniqueId
	snapshot.UniqueId = genruntime.ClonePointerToString(source.UniqueId)

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

	// Invoke the augmentConversionForSnapshot_STATUS interface (if implemented) to customize the conversion
	var snapshotAsAny any = snapshot
	if augmentedSnapshot, ok := snapshotAsAny.(augmentConversionForSnapshot_STATUS); ok {
		err := augmentedSnapshot.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_Snapshot_STATUS populates the provided destination Snapshot_STATUS from our Snapshot_STATUS
func (snapshot *Snapshot_STATUS) AssignProperties_To_Snapshot_STATUS(destination *v20240302s.Snapshot_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(snapshot.PropertyBag)

	// CompletionPercent
	if propertyBag.Contains("CompletionPercent") {
		var completionPercent float64
		err := propertyBag.Pull("CompletionPercent", &completionPercent)
		if err != nil {
			return eris.Wrap(err, "pulling 'CompletionPercent' from propertyBag")
		}

		destination.CompletionPercent = &completionPercent
	} else {
		destination.CompletionPercent = nil
	}

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

	// CopyCompletionError
	if propertyBag.Contains("CopyCompletionError") {
		var copyCompletionError v20240302s.CopyCompletionError_STATUS
		err := propertyBag.Pull("CopyCompletionError", &copyCompletionError)
		if err != nil {
			return eris.Wrap(err, "pulling 'CopyCompletionError' from propertyBag")
		}

		destination.CopyCompletionError = &copyCompletionError
	} else {
		destination.CopyCompletionError = nil
	}

	// CreationData
	if snapshot.CreationData != nil {
		var creationDatum v20240302s.CreationData_STATUS
		err := snapshot.CreationData.AssignProperties_To_CreationData_STATUS(&creationDatum)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_CreationData_STATUS() to populate field CreationData")
		}
		destination.CreationData = &creationDatum
	} else {
		destination.CreationData = nil
	}

	// DataAccessAuthMode
	if propertyBag.Contains("DataAccessAuthMode") {
		var dataAccessAuthMode string
		err := propertyBag.Pull("DataAccessAuthMode", &dataAccessAuthMode)
		if err != nil {
			return eris.Wrap(err, "pulling 'DataAccessAuthMode' from propertyBag")
		}

		destination.DataAccessAuthMode = &dataAccessAuthMode
	} else {
		destination.DataAccessAuthMode = nil
	}

	// DiskAccessId
	destination.DiskAccessId = genruntime.ClonePointerToString(snapshot.DiskAccessId)

	// DiskSizeBytes
	destination.DiskSizeBytes = genruntime.ClonePointerToInt(snapshot.DiskSizeBytes)

	// DiskSizeGB
	destination.DiskSizeGB = genruntime.ClonePointerToInt(snapshot.DiskSizeGB)

	// DiskState
	destination.DiskState = genruntime.ClonePointerToString(snapshot.DiskState)

	// Encryption
	if snapshot.Encryption != nil {
		var encryption v20240302s.Encryption_STATUS
		err := snapshot.Encryption.AssignProperties_To_Encryption_STATUS(&encryption)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Encryption_STATUS() to populate field Encryption")
		}
		destination.Encryption = &encryption
	} else {
		destination.Encryption = nil
	}

	// EncryptionSettingsCollection
	if snapshot.EncryptionSettingsCollection != nil {
		var encryptionSettingsCollection v20240302s.EncryptionSettingsCollection_STATUS
		err := snapshot.EncryptionSettingsCollection.AssignProperties_To_EncryptionSettingsCollection_STATUS(&encryptionSettingsCollection)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_EncryptionSettingsCollection_STATUS() to populate field EncryptionSettingsCollection")
		}
		destination.EncryptionSettingsCollection = &encryptionSettingsCollection
	} else {
		destination.EncryptionSettingsCollection = nil
	}

	// ExtendedLocation
	if snapshot.ExtendedLocation != nil {
		var extendedLocationSTATUSStash v20201201s.ExtendedLocation_STATUS
		err := snapshot.ExtendedLocation.AssignProperties_To_ExtendedLocation_STATUS(&extendedLocationSTATUSStash)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ExtendedLocation_STATUS() to populate field ExtendedLocation_STATUSStash from ExtendedLocation")
		}
		var extendedLocationSTATUSStashLocal v20210701s.ExtendedLocation_STATUS
		err = extendedLocationSTATUSStash.AssignProperties_To_ExtendedLocation_STATUS(&extendedLocationSTATUSStashLocal)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ExtendedLocation_STATUS() to populate field ExtendedLocation_STATUSStash")
		}
		var extendedLocationSTATUSStashCopy v20220301s.ExtendedLocation_STATUS
		err = extendedLocationSTATUSStashLocal.AssignProperties_To_ExtendedLocation_STATUS(&extendedLocationSTATUSStashCopy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ExtendedLocation_STATUS() to populate field ExtendedLocation_STATUSStash")
		}
		var extendedLocation v20240302s.ExtendedLocation_STATUS
		err = extendedLocationSTATUSStashCopy.AssignProperties_To_ExtendedLocation_STATUS(&extendedLocation)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ExtendedLocation_STATUS() to populate field ExtendedLocation from ExtendedLocation_STATUSStash")
		}
		destination.ExtendedLocation = &extendedLocation
	} else {
		destination.ExtendedLocation = nil
	}

	// HyperVGeneration
	destination.HyperVGeneration = genruntime.ClonePointerToString(snapshot.HyperVGeneration)

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

	// Incremental
	if snapshot.Incremental != nil {
		incremental := *snapshot.Incremental
		destination.Incremental = &incremental
	} else {
		destination.Incremental = nil
	}

	// IncrementalSnapshotFamilyId
	if propertyBag.Contains("IncrementalSnapshotFamilyId") {
		var incrementalSnapshotFamilyId string
		err := propertyBag.Pull("IncrementalSnapshotFamilyId", &incrementalSnapshotFamilyId)
		if err != nil {
			return eris.Wrap(err, "pulling 'IncrementalSnapshotFamilyId' from propertyBag")
		}

		destination.IncrementalSnapshotFamilyId = &incrementalSnapshotFamilyId
	} else {
		destination.IncrementalSnapshotFamilyId = nil
	}

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

	// ManagedBy
	destination.ManagedBy = genruntime.ClonePointerToString(snapshot.ManagedBy)

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

	// NetworkAccessPolicy
	destination.NetworkAccessPolicy = genruntime.ClonePointerToString(snapshot.NetworkAccessPolicy)

	// OsType
	destination.OsType = genruntime.ClonePointerToString(snapshot.OsType)

	// ProvisioningState
	destination.ProvisioningState = genruntime.ClonePointerToString(snapshot.ProvisioningState)

	// PublicNetworkAccess
	if propertyBag.Contains("PublicNetworkAccess") {
		var publicNetworkAccess string
		err := propertyBag.Pull("PublicNetworkAccess", &publicNetworkAccess)
		if err != nil {
			return eris.Wrap(err, "pulling 'PublicNetworkAccess' from propertyBag")
		}

		destination.PublicNetworkAccess = &publicNetworkAccess
	} else {
		destination.PublicNetworkAccess = nil
	}

	// PurchasePlan
	if snapshot.PurchasePlan != nil {
		var purchasePlan v20240302s.DiskPurchasePlan_STATUS
		err := snapshot.PurchasePlan.AssignProperties_To_DiskPurchasePlan_STATUS(&purchasePlan)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_DiskPurchasePlan_STATUS() to populate field PurchasePlan")
		}
		destination.PurchasePlan = &purchasePlan
	} else {
		destination.PurchasePlan = nil
	}

	// SecurityProfile
	if propertyBag.Contains("SecurityProfile") {
		var securityProfile v20240302s.DiskSecurityProfile_STATUS
		err := propertyBag.Pull("SecurityProfile", &securityProfile)
		if err != nil {
			return eris.Wrap(err, "pulling 'SecurityProfile' from propertyBag")
		}

		destination.SecurityProfile = &securityProfile
	} else {
		destination.SecurityProfile = nil
	}

	// Sku
	if snapshot.Sku != nil {
		var sku v20240302s.SnapshotSku_STATUS
		err := snapshot.Sku.AssignProperties_To_SnapshotSku_STATUS(&sku)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SnapshotSku_STATUS() to populate field Sku")
		}
		destination.Sku = &sku
	} else {
		destination.Sku = nil
	}

	// SupportedCapabilities
	if propertyBag.Contains("SupportedCapabilities") {
		var supportedCapability v20240302s.SupportedCapabilities_STATUS
		err := propertyBag.Pull("SupportedCapabilities", &supportedCapability)
		if err != nil {
			return eris.Wrap(err, "pulling 'SupportedCapabilities' from propertyBag")
		}

		destination.SupportedCapabilities = &supportedCapability
	} else {
		destination.SupportedCapabilities = nil
	}

	// SupportsHibernation
	if propertyBag.Contains("SupportsHibernation") {
		var supportsHibernation bool
		err := propertyBag.Pull("SupportsHibernation", &supportsHibernation)
		if err != nil {
			return eris.Wrap(err, "pulling 'SupportsHibernation' from propertyBag")
		}

		destination.SupportsHibernation = &supportsHibernation
	} else {
		destination.SupportsHibernation = nil
	}

	// SystemData
	if propertyBag.Contains("SystemData") {
		var systemDatum v20240302s.SystemData_STATUS
		err := propertyBag.Pull("SystemData", &systemDatum)
		if err != nil {
			return eris.Wrap(err, "pulling 'SystemData' from propertyBag")
		}

		destination.SystemData = &systemDatum
	} else {
		destination.SystemData = nil
	}

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

	// TimeCreated
	destination.TimeCreated = genruntime.ClonePointerToString(snapshot.TimeCreated)

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

	// UniqueId
	destination.UniqueId = genruntime.ClonePointerToString(snapshot.UniqueId)

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

	// Invoke the augmentConversionForSnapshot_STATUS interface (if implemented) to customize the conversion
	var snapshotAsAny any = snapshot
	if augmentedSnapshot, ok := snapshotAsAny.(augmentConversionForSnapshot_STATUS); ok {
		err := augmentedSnapshot.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

type augmentConversionForSnapshot_Spec interface {
	AssignPropertiesFrom(src *v20240302s.Snapshot_Spec) error
	AssignPropertiesTo(dst *v20240302s.Snapshot_Spec) error
}

type augmentConversionForSnapshot_STATUS interface {
	AssignPropertiesFrom(src *v20240302s.Snapshot_STATUS) error
	AssignPropertiesTo(dst *v20240302s.Snapshot_STATUS) error
}

// Storage version of v1api20200930.SnapshotOperatorSpec
// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure
type SnapshotOperatorSpec struct {
	ConfigMapExpressions []*core.DestinationExpression `json:"configMapExpressions,omitempty"`
	PropertyBag          genruntime.PropertyBag        `json:"$propertyBag,omitempty"`
	SecretExpressions    []*core.DestinationExpression `json:"secretExpressions,omitempty"`
}

// AssignProperties_From_SnapshotOperatorSpec populates our SnapshotOperatorSpec from the provided source SnapshotOperatorSpec
func (operator *SnapshotOperatorSpec) AssignProperties_From_SnapshotOperatorSpec(source *v20240302s.SnapshotOperatorSpec) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// 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
	}

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

	// Invoke the augmentConversionForSnapshotOperatorSpec interface (if implemented) to customize the conversion
	var operatorAsAny any = operator
	if augmentedOperator, ok := operatorAsAny.(augmentConversionForSnapshotOperatorSpec); ok {
		err := augmentedOperator.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_SnapshotOperatorSpec populates the provided destination SnapshotOperatorSpec from our SnapshotOperatorSpec
func (operator *SnapshotOperatorSpec) AssignProperties_To_SnapshotOperatorSpec(destination *v20240302s.SnapshotOperatorSpec) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(operator.PropertyBag)

	// 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
	}

	// Invoke the augmentConversionForSnapshotOperatorSpec interface (if implemented) to customize the conversion
	var operatorAsAny any = operator
	if augmentedOperator, ok := operatorAsAny.(augmentConversionForSnapshotOperatorSpec); ok {
		err := augmentedOperator.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20200930.SnapshotSku
// The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental
// snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot
type SnapshotSku struct {
	Name        *string                `json:"name,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// AssignProperties_From_SnapshotSku populates our SnapshotSku from the provided source SnapshotSku
func (snapshotSku *SnapshotSku) AssignProperties_From_SnapshotSku(source *v20240302s.SnapshotSku) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

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

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

	// Invoke the augmentConversionForSnapshotSku interface (if implemented) to customize the conversion
	var snapshotSkuAsAny any = snapshotSku
	if augmentedSnapshotSku, ok := snapshotSkuAsAny.(augmentConversionForSnapshotSku); ok {
		err := augmentedSnapshotSku.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_SnapshotSku populates the provided destination SnapshotSku from our SnapshotSku
func (snapshotSku *SnapshotSku) AssignProperties_To_SnapshotSku(destination *v20240302s.SnapshotSku) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(snapshotSku.PropertyBag)

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

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

	// Invoke the augmentConversionForSnapshotSku interface (if implemented) to customize the conversion
	var snapshotSkuAsAny any = snapshotSku
	if augmentedSnapshotSku, ok := snapshotSkuAsAny.(augmentConversionForSnapshotSku); ok {
		err := augmentedSnapshotSku.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20200930.SnapshotSku_STATUS
// The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental
// snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot
type SnapshotSku_STATUS struct {
	Name        *string                `json:"name,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Tier        *string                `json:"tier,omitempty"`
}

// AssignProperties_From_SnapshotSku_STATUS populates our SnapshotSku_STATUS from the provided source SnapshotSku_STATUS
func (snapshotSku *SnapshotSku_STATUS) AssignProperties_From_SnapshotSku_STATUS(source *v20240302s.SnapshotSku_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

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

	// Tier
	snapshotSku.Tier = genruntime.ClonePointerToString(source.Tier)

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

	// Invoke the augmentConversionForSnapshotSku_STATUS interface (if implemented) to customize the conversion
	var snapshotSkuAsAny any = snapshotSku
	if augmentedSnapshotSku, ok := snapshotSkuAsAny.(augmentConversionForSnapshotSku_STATUS); ok {
		err := augmentedSnapshotSku.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_SnapshotSku_STATUS populates the provided destination SnapshotSku_STATUS from our SnapshotSku_STATUS
func (snapshotSku *SnapshotSku_STATUS) AssignProperties_To_SnapshotSku_STATUS(destination *v20240302s.SnapshotSku_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(snapshotSku.PropertyBag)

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

	// Tier
	destination.Tier = genruntime.ClonePointerToString(snapshotSku.Tier)

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

	// Invoke the augmentConversionForSnapshotSku_STATUS interface (if implemented) to customize the conversion
	var snapshotSkuAsAny any = snapshotSku
	if augmentedSnapshotSku, ok := snapshotSkuAsAny.(augmentConversionForSnapshotSku_STATUS); ok {
		err := augmentedSnapshotSku.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

type augmentConversionForSnapshotOperatorSpec interface {
	AssignPropertiesFrom(src *v20240302s.SnapshotOperatorSpec) error
	AssignPropertiesTo(dst *v20240302s.SnapshotOperatorSpec) error
}

type augmentConversionForSnapshotSku interface {
	AssignPropertiesFrom(src *v20240302s.SnapshotSku) error
	AssignPropertiesTo(dst *v20240302s.SnapshotSku) error
}

type augmentConversionForSnapshotSku_STATUS interface {
	AssignPropertiesFrom(src *v20240302s.SnapshotSku_STATUS) error
	AssignPropertiesTo(dst *v20240302s.SnapshotSku_STATUS) error
}

func init() {
	SchemeBuilder.Register(&Snapshot{}, &SnapshotList{})
}
