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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/insights/v1api20230601/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/insights/v1api20230601/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,insights}
// +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: /applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/workbooks_API.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}
type Workbook struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              Workbook_Spec   `json:"spec,omitempty"`
	Status            Workbook_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &Workbook{}

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

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

var _ conversion.Convertible = &Workbook{}

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

	return workbook.AssignProperties_From_Workbook(source)
}

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

	return workbook.AssignProperties_To_Workbook(destination)
}

var _ configmaps.Exporter = &Workbook{}

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

var _ secrets.Exporter = &Workbook{}

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

var _ genruntime.ImportableResource = &Workbook{}

// InitializeSpec initializes the spec for this resource from the given status
func (workbook *Workbook) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*Workbook_STATUS); ok {
		return workbook.Spec.Initialize_From_Workbook_STATUS(s)
	}

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

var _ genruntime.KubernetesResource = &Workbook{}

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

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

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.Insights/workbooks"
func (workbook *Workbook) GetType() string {
	return "Microsoft.Insights/workbooks"
}

// NewEmptyStatus returns a new empty (blank) status
func (workbook *Workbook) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &Workbook_STATUS{}
}

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

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

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

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

	workbook.Status = st
	return nil
}

// AssignProperties_From_Workbook populates our Workbook from the provided source Workbook
func (workbook *Workbook) AssignProperties_From_Workbook(source *storage.Workbook) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_Workbook populates the provided destination Workbook from our Workbook
func (workbook *Workbook) AssignProperties_To_Workbook(destination *storage.Workbook) error {

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/workbooks_API.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}
type WorkbookList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Workbook `json:"items"`
}

// +kubebuilder:validation:Enum={"2023-06-01"}
type APIVersion string

const APIVersion_Value = APIVersion("2023-06-01")

type Workbook_Spec struct {
	// AzureName: The name of the resource in Azure. This is often the same as the name of the resource in Kubernetes but it
	// doesn't have to be.
	AzureName string `json:"azureName,omitempty"`

	// +kubebuilder:validation:Required
	// Category: Workbook category, as defined by the user at creation time.
	Category *string `json:"category,omitempty"`

	// Description: The description of the workbook.
	Description *string `json:"description,omitempty"`

	// +kubebuilder:validation:Required
	// DisplayName: The user-defined name (display name) of the workbook.
	DisplayName *string `json:"displayName,omitempty"`

	// Identity: Identity used for BYOS
	Identity *ManagedServiceIdentity `json:"identity,omitempty"`

	// Kind: The kind of workbook. Only valid value is shared.
	Kind *Workbook_Kind_Spec `json:"kind,omitempty"`

	// +kubebuilder:validation:Required
	// Location: The geo-location where the resource lives
	Location *string `json:"location,omitempty"`

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

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

	// PropertiesTags: Being deprecated, please use the other tags field
	PropertiesTags []string `json:"properties_tags,omitempty"`

	// +kubebuilder:validation:Required
	// SerializedData: Configuration of this particular workbook. Configuration data is a string containing valid JSON
	SerializedData *string `json:"serializedData,omitempty"`

	// SourceReference: ResourceId for a source resource.
	SourceReference *genruntime.ResourceReference `armReference:"SourceId" json:"sourceReference,omitempty"`

	// StorageUriReference: The resourceId to the storage account when bring your own storage is used
	StorageUriReference *genruntime.ResourceReference `armReference:"StorageUri" json:"storageUriReference,omitempty"`

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

	// Version: Workbook schema version format, like 'Notebook/1.0', which should match the workbook in serializedData
	Version *string `json:"version,omitempty"`
}

var _ genruntime.ARMTransformer = &Workbook_Spec{}

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

	// Set property "Identity":
	if workbook.Identity != nil {
		identity_ARM, err := workbook.Identity.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		identity := *identity_ARM.(*arm.ManagedServiceIdentity)
		result.Identity = &identity
	}

	// Set property "Kind":
	if workbook.Kind != nil {
		var temp string
		temp = string(*workbook.Kind)
		kind := arm.Workbook_Kind_Spec(temp)
		result.Kind = &kind
	}

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

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

	// Set property "Properties":
	if workbook.Category != nil ||
		workbook.Description != nil ||
		workbook.DisplayName != nil ||
		workbook.PropertiesTags != nil ||
		workbook.SerializedData != nil ||
		workbook.SourceReference != nil ||
		workbook.StorageUriReference != nil ||
		workbook.Version != nil {
		result.Properties = &arm.WorkbookProperties{}
	}
	if workbook.Category != nil {
		category := *workbook.Category
		result.Properties.Category = &category
	}
	if workbook.Description != nil {
		description := *workbook.Description
		result.Properties.Description = &description
	}
	if workbook.DisplayName != nil {
		displayName := *workbook.DisplayName
		result.Properties.DisplayName = &displayName
	}
	for _, item := range workbook.PropertiesTags {
		result.Properties.Tags = append(result.Properties.Tags, item)
	}
	if workbook.SerializedData != nil {
		serializedData := *workbook.SerializedData
		result.Properties.SerializedData = &serializedData
	}
	if workbook.SourceReference != nil {
		sourceIdARMID, err := resolved.ResolvedReferences.Lookup(*workbook.SourceReference)
		if err != nil {
			return nil, err
		}
		sourceId := sourceIdARMID
		result.Properties.SourceId = &sourceId
	}
	if workbook.StorageUriReference != nil {
		storageUriARMID, err := resolved.ResolvedReferences.Lookup(*workbook.StorageUriReference)
		if err != nil {
			return nil, err
		}
		storageUri := storageUriARMID
		result.Properties.StorageUri = &storageUri
	}
	if workbook.Version != nil {
		version := *workbook.Version
		result.Properties.Version = &version
	}

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

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

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

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

	// Set property "Category":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Category != nil {
			category := *typedInput.Properties.Category
			workbook.Category = &category
		}
	}

	// Set property "Description":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Description != nil {
			description := *typedInput.Properties.Description
			workbook.Description = &description
		}
	}

	// Set property "DisplayName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DisplayName != nil {
			displayName := *typedInput.Properties.DisplayName
			workbook.DisplayName = &displayName
		}
	}

	// Set property "Identity":
	if typedInput.Identity != nil {
		var identity1 ManagedServiceIdentity
		err := identity1.PopulateFromARM(owner, *typedInput.Identity)
		if err != nil {
			return err
		}
		identity := identity1
		workbook.Identity = &identity
	}

	// Set property "Kind":
	if typedInput.Kind != nil {
		var temp string
		temp = string(*typedInput.Kind)
		kind := Workbook_Kind_Spec(temp)
		workbook.Kind = &kind
	}

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

	// no assignment for property "OperatorSpec"

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

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

	// Set property "SerializedData":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SerializedData != nil {
			serializedData := *typedInput.Properties.SerializedData
			workbook.SerializedData = &serializedData
		}
	}

	// no assignment for property "SourceReference"

	// no assignment for property "StorageUriReference"

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

	// Set property "Version":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Version != nil {
			version := *typedInput.Properties.Version
			workbook.Version = &version
		}
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &Workbook_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.Workbook_Spec{}
	err := workbook.AssignProperties_To_Workbook_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_Workbook_Spec populates our Workbook_Spec from the provided source Workbook_Spec
func (workbook *Workbook_Spec) AssignProperties_From_Workbook_Spec(source *storage.Workbook_Spec) error {

	// AzureName
	workbook.AzureName = source.AzureName

	// Category
	workbook.Category = genruntime.ClonePointerToString(source.Category)

	// Description
	workbook.Description = genruntime.ClonePointerToString(source.Description)

	// DisplayName
	workbook.DisplayName = genruntime.ClonePointerToString(source.DisplayName)

	// Identity
	if source.Identity != nil {
		var identity ManagedServiceIdentity
		err := identity.AssignProperties_From_ManagedServiceIdentity(source.Identity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ManagedServiceIdentity() to populate field Identity")
		}
		workbook.Identity = &identity
	} else {
		workbook.Identity = nil
	}

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

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

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

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

	// PropertiesTags
	workbook.PropertiesTags = genruntime.CloneSliceOfString(source.PropertiesTags)

	// SerializedData
	workbook.SerializedData = genruntime.ClonePointerToString(source.SerializedData)

	// SourceReference
	if source.SourceReference != nil {
		sourceReference := source.SourceReference.Copy()
		workbook.SourceReference = &sourceReference
	} else {
		workbook.SourceReference = nil
	}

	// StorageUriReference
	if source.StorageUriReference != nil {
		storageUriReference := source.StorageUriReference.Copy()
		workbook.StorageUriReference = &storageUriReference
	} else {
		workbook.StorageUriReference = nil
	}

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

	// Version
	workbook.Version = genruntime.ClonePointerToString(source.Version)

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = workbook.AzureName

	// Category
	destination.Category = genruntime.ClonePointerToString(workbook.Category)

	// Description
	destination.Description = genruntime.ClonePointerToString(workbook.Description)

	// DisplayName
	destination.DisplayName = genruntime.ClonePointerToString(workbook.DisplayName)

	// Identity
	if workbook.Identity != nil {
		var identity storage.ManagedServiceIdentity
		err := workbook.Identity.AssignProperties_To_ManagedServiceIdentity(&identity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ManagedServiceIdentity() to populate field Identity")
		}
		destination.Identity = &identity
	} else {
		destination.Identity = nil
	}

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

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

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

	// OriginalVersion
	destination.OriginalVersion = workbook.OriginalVersion()

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

	// PropertiesTags
	destination.PropertiesTags = genruntime.CloneSliceOfString(workbook.PropertiesTags)

	// SerializedData
	destination.SerializedData = genruntime.ClonePointerToString(workbook.SerializedData)

	// SourceReference
	if workbook.SourceReference != nil {
		sourceReference := workbook.SourceReference.Copy()
		destination.SourceReference = &sourceReference
	} else {
		destination.SourceReference = nil
	}

	// StorageUriReference
	if workbook.StorageUriReference != nil {
		storageUriReference := workbook.StorageUriReference.Copy()
		destination.StorageUriReference = &storageUriReference
	} else {
		destination.StorageUriReference = nil
	}

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

	// Version
	destination.Version = genruntime.ClonePointerToString(workbook.Version)

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

	// No error
	return nil
}

// Initialize_From_Workbook_STATUS populates our Workbook_Spec from the provided source Workbook_STATUS
func (workbook *Workbook_Spec) Initialize_From_Workbook_STATUS(source *Workbook_STATUS) error {

	// Category
	workbook.Category = genruntime.ClonePointerToString(source.Category)

	// Description
	workbook.Description = genruntime.ClonePointerToString(source.Description)

	// DisplayName
	workbook.DisplayName = genruntime.ClonePointerToString(source.DisplayName)

	// Identity
	if source.Identity != nil {
		var identity ManagedServiceIdentity
		err := identity.Initialize_From_ManagedServiceIdentity_STATUS(source.Identity)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_ManagedServiceIdentity_STATUS() to populate field Identity")
		}
		workbook.Identity = &identity
	} else {
		workbook.Identity = nil
	}

	// Kind
	if source.Kind != nil {
		kind := genruntime.ToEnum(string(*source.Kind), workbook_Kind_Spec_Values)
		workbook.Kind = &kind
	} else {
		workbook.Kind = nil
	}

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

	// PropertiesTags
	workbook.PropertiesTags = genruntime.CloneSliceOfString(source.PropertiesTags)

	// SerializedData
	workbook.SerializedData = genruntime.ClonePointerToString(source.SerializedData)

	// SourceReference
	if source.SourceId != nil {
		sourceReference := genruntime.CreateResourceReferenceFromARMID(*source.SourceId)
		workbook.SourceReference = &sourceReference
	} else {
		workbook.SourceReference = nil
	}

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

	// Version
	workbook.Version = genruntime.ClonePointerToString(source.Version)

	// No error
	return nil
}

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

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

// A workbook definition.
type Workbook_STATUS struct {
	// Category: Workbook category, as defined by the user at creation time.
	Category *string `json:"category,omitempty"`

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

	// Description: The description of the workbook.
	Description *string `json:"description,omitempty"`

	// DisplayName: The user-defined name (display name) of the workbook.
	DisplayName *string `json:"displayName,omitempty"`

	// Etag: Resource etag
	Etag *string `json:"etag,omitempty"`

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

	// Identity: Identity used for BYOS
	Identity *ManagedServiceIdentity_STATUS `json:"identity,omitempty"`

	// Kind: The kind of workbook. Only valid value is shared.
	Kind *Workbook_Kind_STATUS `json:"kind,omitempty"`

	// Location: The geo-location where the resource lives
	Location *string `json:"location,omitempty"`

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

	// PropertiesTags: Being deprecated, please use the other tags field
	PropertiesTags []string `json:"properties_tags,omitempty"`

	// Revision: The unique revision id for this workbook definition
	Revision *string `json:"revision,omitempty"`

	// SerializedData: Configuration of this particular workbook. Configuration data is a string containing valid JSON
	SerializedData *string `json:"serializedData,omitempty"`

	// SourceId: ResourceId for a source resource.
	SourceId *string `json:"sourceId,omitempty"`

	// StorageUri: The resourceId to the storage account when bring your own storage is used
	StorageUri *string `json:"storageUri,omitempty"`

	// SystemData: Metadata pertaining to creation and last modification of the resource.
	SystemData *SystemData_STATUS `json:"systemData,omitempty"`

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

	// TimeModified: Date and time in UTC of the last modification that was made to this workbook definition.
	TimeModified *string `json:"timeModified,omitempty"`

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

	// UserId: Unique user id of the specific user that owns this workbook.
	UserId *string `json:"userId,omitempty"`

	// Version: Workbook schema version format, like 'Notebook/1.0', which should match the workbook in serializedData
	Version *string `json:"version,omitempty"`
}

var _ genruntime.ConvertibleStatus = &Workbook_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.Workbook_STATUS{}
	err := workbook.AssignProperties_To_Workbook_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 = &Workbook_STATUS{}

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

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

	// Set property "Category":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Category != nil {
			category := *typedInput.Properties.Category
			workbook.Category = &category
		}
	}

	// no assignment for property "Conditions"

	// Set property "Description":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Description != nil {
			description := *typedInput.Properties.Description
			workbook.Description = &description
		}
	}

	// Set property "DisplayName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DisplayName != nil {
			displayName := *typedInput.Properties.DisplayName
			workbook.DisplayName = &displayName
		}
	}

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

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

	// Set property "Identity":
	if typedInput.Identity != nil {
		var identity1 ManagedServiceIdentity_STATUS
		err := identity1.PopulateFromARM(owner, *typedInput.Identity)
		if err != nil {
			return err
		}
		identity := identity1
		workbook.Identity = &identity
	}

	// Set property "Kind":
	if typedInput.Kind != nil {
		var temp string
		temp = string(*typedInput.Kind)
		kind := Workbook_Kind_STATUS(temp)
		workbook.Kind = &kind
	}

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

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

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

	// Set property "Revision":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Revision != nil {
			revision := *typedInput.Properties.Revision
			workbook.Revision = &revision
		}
	}

	// Set property "SerializedData":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SerializedData != nil {
			serializedData := *typedInput.Properties.SerializedData
			workbook.SerializedData = &serializedData
		}
	}

	// Set property "SourceId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SourceId != nil {
			sourceId := *typedInput.Properties.SourceId
			workbook.SourceId = &sourceId
		}
	}

	// Set property "StorageUri":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.StorageUri != nil {
			storageUri := *typedInput.Properties.StorageUri
			workbook.StorageUri = &storageUri
		}
	}

	// Set property "SystemData":
	if typedInput.SystemData != nil {
		var systemData1 SystemData_STATUS
		err := systemData1.PopulateFromARM(owner, *typedInput.SystemData)
		if err != nil {
			return err
		}
		systemData := systemData1
		workbook.SystemData = &systemData
	}

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

	// Set property "TimeModified":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.TimeModified != nil {
			timeModified := *typedInput.Properties.TimeModified
			workbook.TimeModified = &timeModified
		}
	}

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

	// Set property "UserId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.UserId != nil {
			userId := *typedInput.Properties.UserId
			workbook.UserId = &userId
		}
	}

	// Set property "Version":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Version != nil {
			version := *typedInput.Properties.Version
			workbook.Version = &version
		}
	}

	// No error
	return nil
}

// AssignProperties_From_Workbook_STATUS populates our Workbook_STATUS from the provided source Workbook_STATUS
func (workbook *Workbook_STATUS) AssignProperties_From_Workbook_STATUS(source *storage.Workbook_STATUS) error {

	// Category
	workbook.Category = genruntime.ClonePointerToString(source.Category)

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

	// Description
	workbook.Description = genruntime.ClonePointerToString(source.Description)

	// DisplayName
	workbook.DisplayName = genruntime.ClonePointerToString(source.DisplayName)

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

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

	// Identity
	if source.Identity != nil {
		var identity ManagedServiceIdentity_STATUS
		err := identity.AssignProperties_From_ManagedServiceIdentity_STATUS(source.Identity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ManagedServiceIdentity_STATUS() to populate field Identity")
		}
		workbook.Identity = &identity
	} else {
		workbook.Identity = nil
	}

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

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

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

	// PropertiesTags
	workbook.PropertiesTags = genruntime.CloneSliceOfString(source.PropertiesTags)

	// Revision
	workbook.Revision = genruntime.ClonePointerToString(source.Revision)

	// SerializedData
	workbook.SerializedData = genruntime.ClonePointerToString(source.SerializedData)

	// SourceId
	workbook.SourceId = genruntime.ClonePointerToString(source.SourceId)

	// StorageUri
	workbook.StorageUri = genruntime.ClonePointerToString(source.StorageUri)

	// SystemData
	if source.SystemData != nil {
		var systemDatum SystemData_STATUS
		err := systemDatum.AssignProperties_From_SystemData_STATUS(source.SystemData)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SystemData_STATUS() to populate field SystemData")
		}
		workbook.SystemData = &systemDatum
	} else {
		workbook.SystemData = nil
	}

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

	// TimeModified
	workbook.TimeModified = genruntime.ClonePointerToString(source.TimeModified)

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

	// UserId
	workbook.UserId = genruntime.ClonePointerToString(source.UserId)

	// Version
	workbook.Version = genruntime.ClonePointerToString(source.Version)

	// No error
	return nil
}

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

	// Category
	destination.Category = genruntime.ClonePointerToString(workbook.Category)

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

	// Description
	destination.Description = genruntime.ClonePointerToString(workbook.Description)

	// DisplayName
	destination.DisplayName = genruntime.ClonePointerToString(workbook.DisplayName)

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

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

	// Identity
	if workbook.Identity != nil {
		var identity storage.ManagedServiceIdentity_STATUS
		err := workbook.Identity.AssignProperties_To_ManagedServiceIdentity_STATUS(&identity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ManagedServiceIdentity_STATUS() to populate field Identity")
		}
		destination.Identity = &identity
	} else {
		destination.Identity = nil
	}

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

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

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

	// PropertiesTags
	destination.PropertiesTags = genruntime.CloneSliceOfString(workbook.PropertiesTags)

	// Revision
	destination.Revision = genruntime.ClonePointerToString(workbook.Revision)

	// SerializedData
	destination.SerializedData = genruntime.ClonePointerToString(workbook.SerializedData)

	// SourceId
	destination.SourceId = genruntime.ClonePointerToString(workbook.SourceId)

	// StorageUri
	destination.StorageUri = genruntime.ClonePointerToString(workbook.StorageUri)

	// SystemData
	if workbook.SystemData != nil {
		var systemDatum storage.SystemData_STATUS
		err := workbook.SystemData.AssignProperties_To_SystemData_STATUS(&systemDatum)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SystemData_STATUS() to populate field SystemData")
		}
		destination.SystemData = &systemDatum
	} else {
		destination.SystemData = nil
	}

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

	// TimeModified
	destination.TimeModified = genruntime.ClonePointerToString(workbook.TimeModified)

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

	// UserId
	destination.UserId = genruntime.ClonePointerToString(workbook.UserId)

	// Version
	destination.Version = genruntime.ClonePointerToString(workbook.Version)

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

	// No error
	return nil
}

// Managed service identity (system assigned and/or user assigned identities)
type ManagedServiceIdentity struct {
	// +kubebuilder:validation:Required
	// Type: Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).
	Type                   *ManagedServiceIdentityType   `json:"type,omitempty"`
	UserAssignedIdentities []UserAssignedIdentityDetails `json:"userAssignedIdentities,omitempty"`
}

var _ genruntime.ARMTransformer = &ManagedServiceIdentity{}

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

	// Set property "Type":
	if identity.Type != nil {
		var temp string
		temp = string(*identity.Type)
		typeVar := arm.ManagedServiceIdentityType(temp)
		result.Type = &typeVar
	}

	// Set property "UserAssignedIdentities":
	result.UserAssignedIdentities = make(map[string]arm.UserAssignedIdentityDetails, len(identity.UserAssignedIdentities))
	for _, ident := range identity.UserAssignedIdentities {
		identARMID, err := resolved.ResolvedReferences.Lookup(ident.Reference)
		if err != nil {
			return nil, err
		}
		key := identARMID
		result.UserAssignedIdentities[key] = arm.UserAssignedIdentityDetails{}
	}
	return result, nil
}

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

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

	// Set property "Type":
	if typedInput.Type != nil {
		var temp string
		temp = string(*typedInput.Type)
		typeVar := ManagedServiceIdentityType(temp)
		identity.Type = &typeVar
	}

	// no assignment for property "UserAssignedIdentities"

	// No error
	return nil
}

// AssignProperties_From_ManagedServiceIdentity populates our ManagedServiceIdentity from the provided source ManagedServiceIdentity
func (identity *ManagedServiceIdentity) AssignProperties_From_ManagedServiceIdentity(source *storage.ManagedServiceIdentity) error {

	// Type
	if source.Type != nil {
		typeVar := *source.Type
		typeTemp := genruntime.ToEnum(typeVar, managedServiceIdentityType_Values)
		identity.Type = &typeTemp
	} else {
		identity.Type = nil
	}

	// UserAssignedIdentities
	if source.UserAssignedIdentities != nil {
		userAssignedIdentityList := make([]UserAssignedIdentityDetails, len(source.UserAssignedIdentities))
		for userAssignedIdentityIndex, userAssignedIdentityItem := range source.UserAssignedIdentities {
			var userAssignedIdentity UserAssignedIdentityDetails
			err := userAssignedIdentity.AssignProperties_From_UserAssignedIdentityDetails(&userAssignedIdentityItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_UserAssignedIdentityDetails() to populate field UserAssignedIdentities")
			}
			userAssignedIdentityList[userAssignedIdentityIndex] = userAssignedIdentity
		}
		identity.UserAssignedIdentities = userAssignedIdentityList
	} else {
		identity.UserAssignedIdentities = nil
	}

	// No error
	return nil
}

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

	// Type
	if identity.Type != nil {
		typeVar := string(*identity.Type)
		destination.Type = &typeVar
	} else {
		destination.Type = nil
	}

	// UserAssignedIdentities
	if identity.UserAssignedIdentities != nil {
		userAssignedIdentityList := make([]storage.UserAssignedIdentityDetails, len(identity.UserAssignedIdentities))
		for userAssignedIdentityIndex, userAssignedIdentityItem := range identity.UserAssignedIdentities {
			var userAssignedIdentity storage.UserAssignedIdentityDetails
			err := userAssignedIdentityItem.AssignProperties_To_UserAssignedIdentityDetails(&userAssignedIdentity)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_UserAssignedIdentityDetails() to populate field UserAssignedIdentities")
			}
			userAssignedIdentityList[userAssignedIdentityIndex] = userAssignedIdentity
		}
		destination.UserAssignedIdentities = userAssignedIdentityList
	} else {
		destination.UserAssignedIdentities = nil
	}

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

	// No error
	return nil
}

// Initialize_From_ManagedServiceIdentity_STATUS populates our ManagedServiceIdentity from the provided source ManagedServiceIdentity_STATUS
func (identity *ManagedServiceIdentity) Initialize_From_ManagedServiceIdentity_STATUS(source *ManagedServiceIdentity_STATUS) error {

	// Type
	if source.Type != nil {
		typeVar := genruntime.ToEnum(string(*source.Type), managedServiceIdentityType_Values)
		identity.Type = &typeVar
	} else {
		identity.Type = nil
	}

	// UserAssignedIdentities
	if source.UserAssignedIdentities != nil {
		userAssignedIdentityList := make([]UserAssignedIdentityDetails, 0, len(source.UserAssignedIdentities))
		for userAssignedIdentitiesKey := range source.UserAssignedIdentities {
			userAssignedIdentitiesRef := genruntime.CreateResourceReferenceFromARMID(userAssignedIdentitiesKey)
			userAssignedIdentityList = append(userAssignedIdentityList, UserAssignedIdentityDetails{Reference: userAssignedIdentitiesRef})
		}
		identity.UserAssignedIdentities = userAssignedIdentityList
	} else {
		identity.UserAssignedIdentities = nil
	}

	// No error
	return nil
}

// Managed service identity (system assigned and/or user assigned identities)
type ManagedServiceIdentity_STATUS struct {
	// PrincipalId: The service principal ID of the system assigned identity. This property will only be provided for a system
	// assigned identity.
	PrincipalId *string `json:"principalId,omitempty"`

	// TenantId: The tenant ID of the system assigned identity. This property will only be provided for a system assigned
	// identity.
	TenantId *string `json:"tenantId,omitempty"`

	// Type: Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).
	Type                   *ManagedServiceIdentityType_STATUS     `json:"type,omitempty"`
	UserAssignedIdentities map[string]UserAssignedIdentity_STATUS `json:"userAssignedIdentities,omitempty"`
}

var _ genruntime.FromARMConverter = &ManagedServiceIdentity_STATUS{}

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

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

	// Set property "PrincipalId":
	if typedInput.PrincipalId != nil {
		principalId := *typedInput.PrincipalId
		identity.PrincipalId = &principalId
	}

	// Set property "TenantId":
	if typedInput.TenantId != nil {
		tenantId := *typedInput.TenantId
		identity.TenantId = &tenantId
	}

	// Set property "Type":
	if typedInput.Type != nil {
		var temp string
		temp = string(*typedInput.Type)
		typeVar := ManagedServiceIdentityType_STATUS(temp)
		identity.Type = &typeVar
	}

	// Set property "UserAssignedIdentities":
	if typedInput.UserAssignedIdentities != nil {
		identity.UserAssignedIdentities = make(map[string]UserAssignedIdentity_STATUS, len(typedInput.UserAssignedIdentities))
		for key, value := range typedInput.UserAssignedIdentities {
			var value1 UserAssignedIdentity_STATUS
			err := value1.PopulateFromARM(owner, value)
			if err != nil {
				return err
			}
			identity.UserAssignedIdentities[key] = value1
		}
	}

	// No error
	return nil
}

// AssignProperties_From_ManagedServiceIdentity_STATUS populates our ManagedServiceIdentity_STATUS from the provided source ManagedServiceIdentity_STATUS
func (identity *ManagedServiceIdentity_STATUS) AssignProperties_From_ManagedServiceIdentity_STATUS(source *storage.ManagedServiceIdentity_STATUS) error {

	// PrincipalId
	identity.PrincipalId = genruntime.ClonePointerToString(source.PrincipalId)

	// TenantId
	identity.TenantId = genruntime.ClonePointerToString(source.TenantId)

	// Type
	if source.Type != nil {
		typeVar := *source.Type
		typeTemp := genruntime.ToEnum(typeVar, managedServiceIdentityType_STATUS_Values)
		identity.Type = &typeTemp
	} else {
		identity.Type = nil
	}

	// UserAssignedIdentities
	if source.UserAssignedIdentities != nil {
		userAssignedIdentityMap := make(map[string]UserAssignedIdentity_STATUS, len(source.UserAssignedIdentities))
		for userAssignedIdentityKey, userAssignedIdentityValue := range source.UserAssignedIdentities {
			var userAssignedIdentity UserAssignedIdentity_STATUS
			err := userAssignedIdentity.AssignProperties_From_UserAssignedIdentity_STATUS(&userAssignedIdentityValue)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_UserAssignedIdentity_STATUS() to populate field UserAssignedIdentities")
			}
			userAssignedIdentityMap[userAssignedIdentityKey] = userAssignedIdentity
		}
		identity.UserAssignedIdentities = userAssignedIdentityMap
	} else {
		identity.UserAssignedIdentities = nil
	}

	// No error
	return nil
}

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

	// PrincipalId
	destination.PrincipalId = genruntime.ClonePointerToString(identity.PrincipalId)

	// TenantId
	destination.TenantId = genruntime.ClonePointerToString(identity.TenantId)

	// Type
	if identity.Type != nil {
		typeVar := string(*identity.Type)
		destination.Type = &typeVar
	} else {
		destination.Type = nil
	}

	// UserAssignedIdentities
	if identity.UserAssignedIdentities != nil {
		userAssignedIdentityMap := make(map[string]storage.UserAssignedIdentity_STATUS, len(identity.UserAssignedIdentities))
		for userAssignedIdentityKey, userAssignedIdentityValue := range identity.UserAssignedIdentities {
			var userAssignedIdentity storage.UserAssignedIdentity_STATUS
			err := userAssignedIdentityValue.AssignProperties_To_UserAssignedIdentity_STATUS(&userAssignedIdentity)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_UserAssignedIdentity_STATUS() to populate field UserAssignedIdentities")
			}
			userAssignedIdentityMap[userAssignedIdentityKey] = userAssignedIdentity
		}
		destination.UserAssignedIdentities = userAssignedIdentityMap
	} else {
		destination.UserAssignedIdentities = nil
	}

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

	// No error
	return nil
}

// Metadata pertaining to creation and last modification of the resource.
type SystemData_STATUS struct {
	// CreatedAt: The timestamp of resource creation (UTC).
	CreatedAt *string `json:"createdAt,omitempty"`

	// CreatedBy: The identity that created the resource.
	CreatedBy *string `json:"createdBy,omitempty"`

	// CreatedByType: The type of identity that created the resource.
	CreatedByType *SystemData_CreatedByType_STATUS `json:"createdByType,omitempty"`

	// LastModifiedAt: The timestamp of resource last modification (UTC)
	LastModifiedAt *string `json:"lastModifiedAt,omitempty"`

	// LastModifiedBy: The identity that last modified the resource.
	LastModifiedBy *string `json:"lastModifiedBy,omitempty"`

	// LastModifiedByType: The type of identity that last modified the resource.
	LastModifiedByType *SystemData_LastModifiedByType_STATUS `json:"lastModifiedByType,omitempty"`
}

var _ genruntime.FromARMConverter = &SystemData_STATUS{}

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

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

	// Set property "CreatedAt":
	if typedInput.CreatedAt != nil {
		createdAt := *typedInput.CreatedAt
		data.CreatedAt = &createdAt
	}

	// Set property "CreatedBy":
	if typedInput.CreatedBy != nil {
		createdBy := *typedInput.CreatedBy
		data.CreatedBy = &createdBy
	}

	// Set property "CreatedByType":
	if typedInput.CreatedByType != nil {
		var temp string
		temp = string(*typedInput.CreatedByType)
		createdByType := SystemData_CreatedByType_STATUS(temp)
		data.CreatedByType = &createdByType
	}

	// Set property "LastModifiedAt":
	if typedInput.LastModifiedAt != nil {
		lastModifiedAt := *typedInput.LastModifiedAt
		data.LastModifiedAt = &lastModifiedAt
	}

	// Set property "LastModifiedBy":
	if typedInput.LastModifiedBy != nil {
		lastModifiedBy := *typedInput.LastModifiedBy
		data.LastModifiedBy = &lastModifiedBy
	}

	// Set property "LastModifiedByType":
	if typedInput.LastModifiedByType != nil {
		var temp string
		temp = string(*typedInput.LastModifiedByType)
		lastModifiedByType := SystemData_LastModifiedByType_STATUS(temp)
		data.LastModifiedByType = &lastModifiedByType
	}

	// No error
	return nil
}

// AssignProperties_From_SystemData_STATUS populates our SystemData_STATUS from the provided source SystemData_STATUS
func (data *SystemData_STATUS) AssignProperties_From_SystemData_STATUS(source *storage.SystemData_STATUS) error {

	// CreatedAt
	data.CreatedAt = genruntime.ClonePointerToString(source.CreatedAt)

	// CreatedBy
	data.CreatedBy = genruntime.ClonePointerToString(source.CreatedBy)

	// CreatedByType
	if source.CreatedByType != nil {
		createdByType := *source.CreatedByType
		createdByTypeTemp := genruntime.ToEnum(createdByType, systemData_CreatedByType_STATUS_Values)
		data.CreatedByType = &createdByTypeTemp
	} else {
		data.CreatedByType = nil
	}

	// LastModifiedAt
	data.LastModifiedAt = genruntime.ClonePointerToString(source.LastModifiedAt)

	// LastModifiedBy
	data.LastModifiedBy = genruntime.ClonePointerToString(source.LastModifiedBy)

	// LastModifiedByType
	if source.LastModifiedByType != nil {
		lastModifiedByType := *source.LastModifiedByType
		lastModifiedByTypeTemp := genruntime.ToEnum(lastModifiedByType, systemData_LastModifiedByType_STATUS_Values)
		data.LastModifiedByType = &lastModifiedByTypeTemp
	} else {
		data.LastModifiedByType = nil
	}

	// No error
	return nil
}

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

	// CreatedAt
	destination.CreatedAt = genruntime.ClonePointerToString(data.CreatedAt)

	// CreatedBy
	destination.CreatedBy = genruntime.ClonePointerToString(data.CreatedBy)

	// CreatedByType
	if data.CreatedByType != nil {
		createdByType := string(*data.CreatedByType)
		destination.CreatedByType = &createdByType
	} else {
		destination.CreatedByType = nil
	}

	// LastModifiedAt
	destination.LastModifiedAt = genruntime.ClonePointerToString(data.LastModifiedAt)

	// LastModifiedBy
	destination.LastModifiedBy = genruntime.ClonePointerToString(data.LastModifiedBy)

	// LastModifiedByType
	if data.LastModifiedByType != nil {
		lastModifiedByType := string(*data.LastModifiedByType)
		destination.LastModifiedByType = &lastModifiedByType
	} else {
		destination.LastModifiedByType = nil
	}

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"shared"}
type Workbook_Kind_Spec string

const Workbook_Kind_Spec_Shared = Workbook_Kind_Spec("shared")

// Mapping from string to Workbook_Kind_Spec
var workbook_Kind_Spec_Values = map[string]Workbook_Kind_Spec{
	"shared": Workbook_Kind_Spec_Shared,
}

type Workbook_Kind_STATUS string

const Workbook_Kind_STATUS_Shared = Workbook_Kind_STATUS("shared")

// Mapping from string to Workbook_Kind_STATUS
var workbook_Kind_STATUS_Values = map[string]Workbook_Kind_STATUS{
	"shared": Workbook_Kind_STATUS_Shared,
}

// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure
type WorkbookOperatorSpec 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_WorkbookOperatorSpec populates our WorkbookOperatorSpec from the provided source WorkbookOperatorSpec
func (operator *WorkbookOperatorSpec) AssignProperties_From_WorkbookOperatorSpec(source *storage.WorkbookOperatorSpec) 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_WorkbookOperatorSpec populates the provided destination WorkbookOperatorSpec from our WorkbookOperatorSpec
func (operator *WorkbookOperatorSpec) AssignProperties_To_WorkbookOperatorSpec(destination *storage.WorkbookOperatorSpec) 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 of managed service identity (where both SystemAssigned and UserAssigned types are allowed).
// +kubebuilder:validation:Enum={"None","SystemAssigned","SystemAssigned,UserAssigned","UserAssigned"}
type ManagedServiceIdentityType string

const (
	ManagedServiceIdentityType_None                       = ManagedServiceIdentityType("None")
	ManagedServiceIdentityType_SystemAssigned             = ManagedServiceIdentityType("SystemAssigned")
	ManagedServiceIdentityType_SystemAssignedUserAssigned = ManagedServiceIdentityType("SystemAssigned,UserAssigned")
	ManagedServiceIdentityType_UserAssigned               = ManagedServiceIdentityType("UserAssigned")
)

// Mapping from string to ManagedServiceIdentityType
var managedServiceIdentityType_Values = map[string]ManagedServiceIdentityType{
	"none":                        ManagedServiceIdentityType_None,
	"systemassigned":              ManagedServiceIdentityType_SystemAssigned,
	"systemassigned,userassigned": ManagedServiceIdentityType_SystemAssignedUserAssigned,
	"userassigned":                ManagedServiceIdentityType_UserAssigned,
}

// Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).
type ManagedServiceIdentityType_STATUS string

const (
	ManagedServiceIdentityType_STATUS_None                       = ManagedServiceIdentityType_STATUS("None")
	ManagedServiceIdentityType_STATUS_SystemAssigned             = ManagedServiceIdentityType_STATUS("SystemAssigned")
	ManagedServiceIdentityType_STATUS_SystemAssignedUserAssigned = ManagedServiceIdentityType_STATUS("SystemAssigned,UserAssigned")
	ManagedServiceIdentityType_STATUS_UserAssigned               = ManagedServiceIdentityType_STATUS("UserAssigned")
)

// Mapping from string to ManagedServiceIdentityType_STATUS
var managedServiceIdentityType_STATUS_Values = map[string]ManagedServiceIdentityType_STATUS{
	"none":                        ManagedServiceIdentityType_STATUS_None,
	"systemassigned":              ManagedServiceIdentityType_STATUS_SystemAssigned,
	"systemassigned,userassigned": ManagedServiceIdentityType_STATUS_SystemAssignedUserAssigned,
	"userassigned":                ManagedServiceIdentityType_STATUS_UserAssigned,
}

type SystemData_CreatedByType_STATUS string

const (
	SystemData_CreatedByType_STATUS_Application     = SystemData_CreatedByType_STATUS("Application")
	SystemData_CreatedByType_STATUS_Key             = SystemData_CreatedByType_STATUS("Key")
	SystemData_CreatedByType_STATUS_ManagedIdentity = SystemData_CreatedByType_STATUS("ManagedIdentity")
	SystemData_CreatedByType_STATUS_User            = SystemData_CreatedByType_STATUS("User")
)

// Mapping from string to SystemData_CreatedByType_STATUS
var systemData_CreatedByType_STATUS_Values = map[string]SystemData_CreatedByType_STATUS{
	"application":     SystemData_CreatedByType_STATUS_Application,
	"key":             SystemData_CreatedByType_STATUS_Key,
	"managedidentity": SystemData_CreatedByType_STATUS_ManagedIdentity,
	"user":            SystemData_CreatedByType_STATUS_User,
}

type SystemData_LastModifiedByType_STATUS string

const (
	SystemData_LastModifiedByType_STATUS_Application     = SystemData_LastModifiedByType_STATUS("Application")
	SystemData_LastModifiedByType_STATUS_Key             = SystemData_LastModifiedByType_STATUS("Key")
	SystemData_LastModifiedByType_STATUS_ManagedIdentity = SystemData_LastModifiedByType_STATUS("ManagedIdentity")
	SystemData_LastModifiedByType_STATUS_User            = SystemData_LastModifiedByType_STATUS("User")
)

// Mapping from string to SystemData_LastModifiedByType_STATUS
var systemData_LastModifiedByType_STATUS_Values = map[string]SystemData_LastModifiedByType_STATUS{
	"application":     SystemData_LastModifiedByType_STATUS_Application,
	"key":             SystemData_LastModifiedByType_STATUS_Key,
	"managedidentity": SystemData_LastModifiedByType_STATUS_ManagedIdentity,
	"user":            SystemData_LastModifiedByType_STATUS_User,
}

// User assigned identity properties
type UserAssignedIdentity_STATUS struct {
	// ClientId: The client ID of the assigned identity.
	ClientId *string `json:"clientId,omitempty"`

	// PrincipalId: The principal ID of the assigned identity.
	PrincipalId *string `json:"principalId,omitempty"`
}

var _ genruntime.FromARMConverter = &UserAssignedIdentity_STATUS{}

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

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

	// Set property "ClientId":
	if typedInput.ClientId != nil {
		clientId := *typedInput.ClientId
		identity.ClientId = &clientId
	}

	// Set property "PrincipalId":
	if typedInput.PrincipalId != nil {
		principalId := *typedInput.PrincipalId
		identity.PrincipalId = &principalId
	}

	// No error
	return nil
}

// AssignProperties_From_UserAssignedIdentity_STATUS populates our UserAssignedIdentity_STATUS from the provided source UserAssignedIdentity_STATUS
func (identity *UserAssignedIdentity_STATUS) AssignProperties_From_UserAssignedIdentity_STATUS(source *storage.UserAssignedIdentity_STATUS) error {

	// ClientId
	identity.ClientId = genruntime.ClonePointerToString(source.ClientId)

	// PrincipalId
	identity.PrincipalId = genruntime.ClonePointerToString(source.PrincipalId)

	// No error
	return nil
}

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

	// ClientId
	destination.ClientId = genruntime.ClonePointerToString(identity.ClientId)

	// PrincipalId
	destination.PrincipalId = genruntime.ClonePointerToString(identity.PrincipalId)

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

	// No error
	return nil
}

// Information about the user assigned identity for the resource
type UserAssignedIdentityDetails struct {
	Reference genruntime.ResourceReference `armReference:"Reference" json:"reference,omitempty"`
}

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

	// Reference
	details.Reference = source.Reference.Copy()

	// No error
	return nil
}

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

	// Reference
	destination.Reference = details.Reference.Copy()

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

	// No error
	return nil
}

func init() {
	SchemeBuilder.Register(&Workbook{}, &WorkbookList{})
}
