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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/kusto/v1api20230815/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/kusto/v1api20230815/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,kusto}
// +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: /azure-kusto/resource-manager/Microsoft.Kusto/Kusto/stable/2023-08-15/kusto.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}
type Database struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              Database_Spec   `json:"spec,omitempty"`
	Status            Database_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &Database{}

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

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

var _ conversion.Convertible = &Database{}

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

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

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

	return nil
}

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

	return nil
}

var _ configmaps.Exporter = &Database{}

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

var _ secrets.Exporter = &Database{}

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

var _ genruntime.KubernetesResource = &Database{}

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

// GetAPIVersion returns the ARM API version of the resource. This is always "2023-08-15"
func (database Database) GetAPIVersion() string {
	return "2023-08-15"
}

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.Kusto/clusters/databases"
func (database *Database) GetType() string {
	return "Microsoft.Kusto/clusters/databases"
}

// NewEmptyStatus returns a new empty (blank) status
func (database *Database) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &Database_STATUS{}
}

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

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

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

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

	database.Status = st
	return nil
}

// AssignProperties_From_Database populates our Database from the provided source Database
func (database *Database) AssignProperties_From_Database(source *storage.Database) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_Database populates the provided destination Database from our Database
func (database *Database) AssignProperties_To_Database(destination *storage.Database) error {

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /azure-kusto/resource-manager/Microsoft.Kusto/Kusto/stable/2023-08-15/kusto.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}
type DatabaseList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Database `json:"items"`
}

type Database_Spec struct {
	// +kubebuilder:validation:Pattern="^.*$"
	// AzureName: The name of the resource in Azure. This is often the same as the name of the resource in Kubernetes but it
	// doesn't have to be.
	AzureName string `json:"azureName,omitempty"`

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

	// ReadWrite: Mutually exclusive with all other properties
	ReadWrite *ReadWriteDatabase `json:"readWriteDatabase,omitempty"`
}

var _ genruntime.ARMTransformer = &Database_Spec{}

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

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

	// Set property "ReadWrite":
	if database.ReadWrite != nil {
		readWrite_ARM, err := database.ReadWrite.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		readWrite := *readWrite_ARM.(*arm.ReadWriteDatabase)
		result.ReadWrite = &readWrite
		result.ReadWrite.Name = database.AzureName
	}
	return result, nil
}

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

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

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

	// no assignment for property "OperatorSpec"

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

	// Set property "ReadWrite":
	if typedInput.ReadWrite != nil {
		var readWrite1 ReadWriteDatabase
		err := readWrite1.PopulateFromARM(owner, *typedInput.ReadWrite)
		if err != nil {
			return err
		}
		readWrite := readWrite1
		database.ReadWrite = &readWrite
		database.AzureName = typedInput.ReadWrite.Name
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &Database_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.Database_Spec{}
	err := database.AssignProperties_To_Database_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_Database_Spec populates our Database_Spec from the provided source Database_Spec
func (database *Database_Spec) AssignProperties_From_Database_Spec(source *storage.Database_Spec) error {

	// AzureName
	database.AzureName = source.AzureName

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

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

	// ReadWrite
	if source.ReadWrite != nil {
		var readWrite ReadWriteDatabase
		err := readWrite.AssignProperties_From_ReadWriteDatabase(source.ReadWrite)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ReadWriteDatabase() to populate field ReadWrite")
		}
		database.ReadWrite = &readWrite
	} else {
		database.ReadWrite = nil
	}

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = database.AzureName

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

	// OriginalVersion
	destination.OriginalVersion = database.OriginalVersion()

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

	// ReadWrite
	if database.ReadWrite != nil {
		var readWrite storage.ReadWriteDatabase
		err := database.ReadWrite.AssignProperties_To_ReadWriteDatabase(&readWrite)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ReadWriteDatabase() to populate field ReadWrite")
		}
		destination.ReadWrite = &readWrite
	} else {
		destination.ReadWrite = 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 (database *Database_Spec) OriginalVersion() string {
	return GroupVersion.Version
}

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

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

	// Name: The name of the resource
	Name *string `json:"name,omitempty"`

	// ReadWrite: Mutually exclusive with all other properties
	ReadWrite *ReadWriteDatabase_STATUS `json:"readWrite,omitempty"`
}

var _ genruntime.ConvertibleStatus = &Database_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.Database_STATUS{}
	err := database.AssignProperties_To_Database_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 = &Database_STATUS{}

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

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

	// no assignment for property "Conditions"

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

	// Set property "ReadWrite":
	if typedInput.ReadWrite != nil {
		var readWrite1 ReadWriteDatabase_STATUS
		err := readWrite1.PopulateFromARM(owner, *typedInput.ReadWrite)
		if err != nil {
			return err
		}
		readWrite := readWrite1
		database.ReadWrite = &readWrite
		database.Name = typedInput.ReadWrite.Name
	}

	// No error
	return nil
}

// AssignProperties_From_Database_STATUS populates our Database_STATUS from the provided source Database_STATUS
func (database *Database_STATUS) AssignProperties_From_Database_STATUS(source *storage.Database_STATUS) error {

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

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

	// ReadWrite
	if source.ReadWrite != nil {
		var readWrite ReadWriteDatabase_STATUS
		err := readWrite.AssignProperties_From_ReadWriteDatabase_STATUS(source.ReadWrite)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ReadWriteDatabase_STATUS() to populate field ReadWrite")
		}
		database.ReadWrite = &readWrite
	} else {
		database.ReadWrite = nil
	}

	// No error
	return nil
}

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

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

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

	// ReadWrite
	if database.ReadWrite != nil {
		var readWrite storage.ReadWriteDatabase_STATUS
		err := database.ReadWrite.AssignProperties_To_ReadWriteDatabase_STATUS(&readWrite)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ReadWriteDatabase_STATUS() to populate field ReadWrite")
		}
		destination.ReadWrite = &readWrite
	} else {
		destination.ReadWrite = nil
	}

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

	// No error
	return nil
}

// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure
type DatabaseOperatorSpec 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_DatabaseOperatorSpec populates our DatabaseOperatorSpec from the provided source DatabaseOperatorSpec
func (operator *DatabaseOperatorSpec) AssignProperties_From_DatabaseOperatorSpec(source *storage.DatabaseOperatorSpec) 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_DatabaseOperatorSpec populates the provided destination DatabaseOperatorSpec from our DatabaseOperatorSpec
func (operator *DatabaseOperatorSpec) AssignProperties_To_DatabaseOperatorSpec(destination *storage.DatabaseOperatorSpec) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// ConfigMapExpressions
	if operator.ConfigMapExpressions != nil {
		configMapExpressionList := make([]*core.DestinationExpression, len(operator.ConfigMapExpressions))
		for configMapExpressionIndex, configMapExpressionItem := range operator.ConfigMapExpressions {
			if configMapExpressionItem != nil {
				configMapExpression := *configMapExpressionItem.DeepCopy()
				configMapExpressionList[configMapExpressionIndex] = &configMapExpression
			} else {
				configMapExpressionList[configMapExpressionIndex] = nil
			}
		}
		destination.ConfigMapExpressions = configMapExpressionList
	} else {
		destination.ConfigMapExpressions = nil
	}

	// SecretExpressions
	if operator.SecretExpressions != nil {
		secretExpressionList := make([]*core.DestinationExpression, len(operator.SecretExpressions))
		for secretExpressionIndex, secretExpressionItem := range operator.SecretExpressions {
			if secretExpressionItem != nil {
				secretExpression := *secretExpressionItem.DeepCopy()
				secretExpressionList[secretExpressionIndex] = &secretExpression
			} else {
				secretExpressionList[secretExpressionIndex] = nil
			}
		}
		destination.SecretExpressions = secretExpressionList
	} else {
		destination.SecretExpressions = nil
	}

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

	// No error
	return nil
}

type ReadWriteDatabase struct {
	// HotCachePeriod: The time the data should be kept in cache for fast queries in TimeSpan.
	HotCachePeriod *string `json:"hotCachePeriod,omitempty"`

	// KeyVaultProperties: KeyVault properties for the database encryption.
	KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"`

	// +kubebuilder:validation:Required
	// Kind: Kind of the database
	Kind *ReadWriteDatabase_Kind `json:"kind,omitempty"`

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

	// SoftDeletePeriod: The time the data should be kept before it stops being accessible to queries in TimeSpan.
	SoftDeletePeriod *string `json:"softDeletePeriod,omitempty"`
}

var _ genruntime.ARMTransformer = &ReadWriteDatabase{}

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

	// Set property "Kind":
	if database.Kind != nil {
		var temp arm.ReadWriteDatabase_Kind
		var temp1 string
		temp1 = string(*database.Kind)
		temp = arm.ReadWriteDatabase_Kind(temp1)
		result.Kind = temp
	}

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

	// no assignment for property "Name"

	// Set property "Properties":
	if database.HotCachePeriod != nil ||
		database.KeyVaultProperties != nil ||
		database.SoftDeletePeriod != nil {
		result.Properties = &arm.ReadWriteDatabaseProperties{}
	}
	if database.HotCachePeriod != nil {
		hotCachePeriod := *database.HotCachePeriod
		result.Properties.HotCachePeriod = &hotCachePeriod
	}
	if database.KeyVaultProperties != nil {
		keyVaultProperties_ARM, err := database.KeyVaultProperties.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		keyVaultProperties := *keyVaultProperties_ARM.(*arm.KeyVaultProperties)
		result.Properties.KeyVaultProperties = &keyVaultProperties
	}
	if database.SoftDeletePeriod != nil {
		softDeletePeriod := *database.SoftDeletePeriod
		result.Properties.SoftDeletePeriod = &softDeletePeriod
	}
	return result, nil
}

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

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

	// Set property "HotCachePeriod":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.HotCachePeriod != nil {
			hotCachePeriod := *typedInput.Properties.HotCachePeriod
			database.HotCachePeriod = &hotCachePeriod
		}
	}

	// Set property "KeyVaultProperties":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.KeyVaultProperties != nil {
			var keyVaultProperties1 KeyVaultProperties
			err := keyVaultProperties1.PopulateFromARM(owner, *typedInput.Properties.KeyVaultProperties)
			if err != nil {
				return err
			}
			keyVaultProperties := keyVaultProperties1
			database.KeyVaultProperties = &keyVaultProperties
		}
	}

	// Set property "Kind":
	var temp ReadWriteDatabase_Kind
	var temp1 string
	temp1 = string(typedInput.Kind)
	temp = ReadWriteDatabase_Kind(temp1)
	database.Kind = &temp

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

	// Set property "SoftDeletePeriod":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SoftDeletePeriod != nil {
			softDeletePeriod := *typedInput.Properties.SoftDeletePeriod
			database.SoftDeletePeriod = &softDeletePeriod
		}
	}

	// No error
	return nil
}

// AssignProperties_From_ReadWriteDatabase populates our ReadWriteDatabase from the provided source ReadWriteDatabase
func (database *ReadWriteDatabase) AssignProperties_From_ReadWriteDatabase(source *storage.ReadWriteDatabase) error {

	// HotCachePeriod
	database.HotCachePeriod = genruntime.ClonePointerToString(source.HotCachePeriod)

	// KeyVaultProperties
	if source.KeyVaultProperties != nil {
		var keyVaultProperty KeyVaultProperties
		err := keyVaultProperty.AssignProperties_From_KeyVaultProperties(source.KeyVaultProperties)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_KeyVaultProperties() to populate field KeyVaultProperties")
		}
		database.KeyVaultProperties = &keyVaultProperty
	} else {
		database.KeyVaultProperties = nil
	}

	// Kind
	if source.Kind != nil {
		kind := *source.Kind
		kindTemp := genruntime.ToEnum(kind, readWriteDatabase_Kind_Values)
		database.Kind = &kindTemp
	} else {
		database.Kind = nil
	}

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

	// SoftDeletePeriod
	database.SoftDeletePeriod = genruntime.ClonePointerToString(source.SoftDeletePeriod)

	// No error
	return nil
}

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

	// HotCachePeriod
	destination.HotCachePeriod = genruntime.ClonePointerToString(database.HotCachePeriod)

	// KeyVaultProperties
	if database.KeyVaultProperties != nil {
		var keyVaultProperty storage.KeyVaultProperties
		err := database.KeyVaultProperties.AssignProperties_To_KeyVaultProperties(&keyVaultProperty)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_KeyVaultProperties() to populate field KeyVaultProperties")
		}
		destination.KeyVaultProperties = &keyVaultProperty
	} else {
		destination.KeyVaultProperties = nil
	}

	// Kind
	if database.Kind != nil {
		kind := string(*database.Kind)
		destination.Kind = &kind
	} else {
		destination.Kind = nil
	}

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

	// SoftDeletePeriod
	destination.SoftDeletePeriod = genruntime.ClonePointerToString(database.SoftDeletePeriod)

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

	// No error
	return nil
}

type ReadWriteDatabase_STATUS struct {
	// HotCachePeriod: The time the data should be kept in cache for fast queries in TimeSpan.
	HotCachePeriod *string `json:"hotCachePeriod,omitempty"`

	// Id: Fully qualified resource ID for the resource. Ex -
	// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	Id *string `json:"id,omitempty"`

	// IsFollowed: Indicates whether the database is followed.
	IsFollowed *bool `json:"isFollowed,omitempty"`

	// KeyVaultProperties: KeyVault properties for the database encryption.
	KeyVaultProperties *KeyVaultProperties_STATUS `json:"keyVaultProperties,omitempty"`

	// Kind: Kind of the database
	Kind *ReadWriteDatabase_Kind_STATUS `json:"kind,omitempty"`

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

	// ProvisioningState: The provisioned state of the resource.
	ProvisioningState *ProvisioningState_STATUS `json:"provisioningState,omitempty"`

	// SoftDeletePeriod: The time the data should be kept before it stops being accessible to queries in TimeSpan.
	SoftDeletePeriod *string `json:"softDeletePeriod,omitempty"`

	// Statistics: The statistics of the database.
	Statistics *DatabaseStatistics_STATUS `json:"statistics,omitempty"`

	// SuspensionDetails: The database suspension details. If the database is suspended, this object contains information
	// related to the database's suspension state.
	SuspensionDetails *SuspensionDetails_STATUS `json:"suspensionDetails,omitempty"`

	// Type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string `json:"type,omitempty"`
}

var _ genruntime.FromARMConverter = &ReadWriteDatabase_STATUS{}

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

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

	// Set property "HotCachePeriod":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.HotCachePeriod != nil {
			hotCachePeriod := *typedInput.Properties.HotCachePeriod
			database.HotCachePeriod = &hotCachePeriod
		}
	}

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

	// Set property "IsFollowed":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IsFollowed != nil {
			isFollowed := *typedInput.Properties.IsFollowed
			database.IsFollowed = &isFollowed
		}
	}

	// Set property "KeyVaultProperties":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.KeyVaultProperties != nil {
			var keyVaultProperties1 KeyVaultProperties_STATUS
			err := keyVaultProperties1.PopulateFromARM(owner, *typedInput.Properties.KeyVaultProperties)
			if err != nil {
				return err
			}
			keyVaultProperties := keyVaultProperties1
			database.KeyVaultProperties = &keyVaultProperties
		}
	}

	// Set property "Kind":
	var temp ReadWriteDatabase_Kind_STATUS
	var temp1 string
	temp1 = string(typedInput.Kind)
	temp = ReadWriteDatabase_Kind_STATUS(temp1)
	database.Kind = &temp

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

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

	// Set property "SoftDeletePeriod":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SoftDeletePeriod != nil {
			softDeletePeriod := *typedInput.Properties.SoftDeletePeriod
			database.SoftDeletePeriod = &softDeletePeriod
		}
	}

	// Set property "Statistics":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Statistics != nil {
			var statistics1 DatabaseStatistics_STATUS
			err := statistics1.PopulateFromARM(owner, *typedInput.Properties.Statistics)
			if err != nil {
				return err
			}
			statistics := statistics1
			database.Statistics = &statistics
		}
	}

	// Set property "SuspensionDetails":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SuspensionDetails != nil {
			var suspensionDetails1 SuspensionDetails_STATUS
			err := suspensionDetails1.PopulateFromARM(owner, *typedInput.Properties.SuspensionDetails)
			if err != nil {
				return err
			}
			suspensionDetails := suspensionDetails1
			database.SuspensionDetails = &suspensionDetails
		}
	}

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

	// No error
	return nil
}

// AssignProperties_From_ReadWriteDatabase_STATUS populates our ReadWriteDatabase_STATUS from the provided source ReadWriteDatabase_STATUS
func (database *ReadWriteDatabase_STATUS) AssignProperties_From_ReadWriteDatabase_STATUS(source *storage.ReadWriteDatabase_STATUS) error {

	// HotCachePeriod
	database.HotCachePeriod = genruntime.ClonePointerToString(source.HotCachePeriod)

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

	// IsFollowed
	if source.IsFollowed != nil {
		isFollowed := *source.IsFollowed
		database.IsFollowed = &isFollowed
	} else {
		database.IsFollowed = nil
	}

	// KeyVaultProperties
	if source.KeyVaultProperties != nil {
		var keyVaultProperty KeyVaultProperties_STATUS
		err := keyVaultProperty.AssignProperties_From_KeyVaultProperties_STATUS(source.KeyVaultProperties)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_KeyVaultProperties_STATUS() to populate field KeyVaultProperties")
		}
		database.KeyVaultProperties = &keyVaultProperty
	} else {
		database.KeyVaultProperties = nil
	}

	// Kind
	if source.Kind != nil {
		kind := *source.Kind
		kindTemp := genruntime.ToEnum(kind, readWriteDatabase_Kind_STATUS_Values)
		database.Kind = &kindTemp
	} else {
		database.Kind = nil
	}

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

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

	// SoftDeletePeriod
	database.SoftDeletePeriod = genruntime.ClonePointerToString(source.SoftDeletePeriod)

	// Statistics
	if source.Statistics != nil {
		var statistic DatabaseStatistics_STATUS
		err := statistic.AssignProperties_From_DatabaseStatistics_STATUS(source.Statistics)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_DatabaseStatistics_STATUS() to populate field Statistics")
		}
		database.Statistics = &statistic
	} else {
		database.Statistics = nil
	}

	// SuspensionDetails
	if source.SuspensionDetails != nil {
		var suspensionDetail SuspensionDetails_STATUS
		err := suspensionDetail.AssignProperties_From_SuspensionDetails_STATUS(source.SuspensionDetails)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SuspensionDetails_STATUS() to populate field SuspensionDetails")
		}
		database.SuspensionDetails = &suspensionDetail
	} else {
		database.SuspensionDetails = nil
	}

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

	// No error
	return nil
}

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

	// HotCachePeriod
	destination.HotCachePeriod = genruntime.ClonePointerToString(database.HotCachePeriod)

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

	// IsFollowed
	if database.IsFollowed != nil {
		isFollowed := *database.IsFollowed
		destination.IsFollowed = &isFollowed
	} else {
		destination.IsFollowed = nil
	}

	// KeyVaultProperties
	if database.KeyVaultProperties != nil {
		var keyVaultProperty storage.KeyVaultProperties_STATUS
		err := database.KeyVaultProperties.AssignProperties_To_KeyVaultProperties_STATUS(&keyVaultProperty)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_KeyVaultProperties_STATUS() to populate field KeyVaultProperties")
		}
		destination.KeyVaultProperties = &keyVaultProperty
	} else {
		destination.KeyVaultProperties = nil
	}

	// Kind
	if database.Kind != nil {
		kind := string(*database.Kind)
		destination.Kind = &kind
	} else {
		destination.Kind = nil
	}

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

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

	// SoftDeletePeriod
	destination.SoftDeletePeriod = genruntime.ClonePointerToString(database.SoftDeletePeriod)

	// Statistics
	if database.Statistics != nil {
		var statistic storage.DatabaseStatistics_STATUS
		err := database.Statistics.AssignProperties_To_DatabaseStatistics_STATUS(&statistic)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_DatabaseStatistics_STATUS() to populate field Statistics")
		}
		destination.Statistics = &statistic
	} else {
		destination.Statistics = nil
	}

	// SuspensionDetails
	if database.SuspensionDetails != nil {
		var suspensionDetail storage.SuspensionDetails_STATUS
		err := database.SuspensionDetails.AssignProperties_To_SuspensionDetails_STATUS(&suspensionDetail)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SuspensionDetails_STATUS() to populate field SuspensionDetails")
		}
		destination.SuspensionDetails = &suspensionDetail
	} else {
		destination.SuspensionDetails = nil
	}

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

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

	// No error
	return nil
}

// A class that contains database statistics information.
type DatabaseStatistics_STATUS struct {
	// Size: The database size - the total size of compressed data and index in bytes.
	Size *float64 `json:"size,omitempty"`
}

var _ genruntime.FromARMConverter = &DatabaseStatistics_STATUS{}

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

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

	// Set property "Size":
	if typedInput.Size != nil {
		size := *typedInput.Size
		statistics.Size = &size
	}

	// No error
	return nil
}

// AssignProperties_From_DatabaseStatistics_STATUS populates our DatabaseStatistics_STATUS from the provided source DatabaseStatistics_STATUS
func (statistics *DatabaseStatistics_STATUS) AssignProperties_From_DatabaseStatistics_STATUS(source *storage.DatabaseStatistics_STATUS) error {

	// Size
	if source.Size != nil {
		size := *source.Size
		statistics.Size = &size
	} else {
		statistics.Size = nil
	}

	// No error
	return nil
}

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

	// Size
	if statistics.Size != nil {
		size := *statistics.Size
		destination.Size = &size
	} else {
		destination.Size = nil
	}

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"ReadWrite"}
type ReadWriteDatabase_Kind string

const ReadWriteDatabase_Kind_ReadWrite = ReadWriteDatabase_Kind("ReadWrite")

// Mapping from string to ReadWriteDatabase_Kind
var readWriteDatabase_Kind_Values = map[string]ReadWriteDatabase_Kind{
	"readwrite": ReadWriteDatabase_Kind_ReadWrite,
}

type ReadWriteDatabase_Kind_STATUS string

const ReadWriteDatabase_Kind_STATUS_ReadWrite = ReadWriteDatabase_Kind_STATUS("ReadWrite")

// Mapping from string to ReadWriteDatabase_Kind_STATUS
var readWriteDatabase_Kind_STATUS_Values = map[string]ReadWriteDatabase_Kind_STATUS{
	"readwrite": ReadWriteDatabase_Kind_STATUS_ReadWrite,
}

// The database suspension details. If the database is suspended, this object contains information related to the
// database's suspension state.
type SuspensionDetails_STATUS struct {
	// SuspensionStartDate: The starting date and time of the suspension state.
	SuspensionStartDate *string `json:"suspensionStartDate,omitempty"`
}

var _ genruntime.FromARMConverter = &SuspensionDetails_STATUS{}

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

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

	// Set property "SuspensionStartDate":
	if typedInput.SuspensionStartDate != nil {
		suspensionStartDate := *typedInput.SuspensionStartDate
		details.SuspensionStartDate = &suspensionStartDate
	}

	// No error
	return nil
}

// AssignProperties_From_SuspensionDetails_STATUS populates our SuspensionDetails_STATUS from the provided source SuspensionDetails_STATUS
func (details *SuspensionDetails_STATUS) AssignProperties_From_SuspensionDetails_STATUS(source *storage.SuspensionDetails_STATUS) error {

	// SuspensionStartDate
	details.SuspensionStartDate = genruntime.ClonePointerToString(source.SuspensionStartDate)

	// No error
	return nil
}

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

	// SuspensionStartDate
	destination.SuspensionStartDate = genruntime.ClonePointerToString(details.SuspensionStartDate)

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

	// No error
	return nil
}

func init() {
	SchemeBuilder.Register(&Database{}, &DatabaseList{})
}
