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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/batch/v1api20210101/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/batch/v1api20210101/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,batch}
// +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: /batch/resource-manager/Microsoft.Batch/stable/2021-01-01/BatchManagement.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}
type BatchAccount struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              BatchAccount_Spec   `json:"spec,omitempty"`
	Status            BatchAccount_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &BatchAccount{}

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

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

var _ conversion.Convertible = &BatchAccount{}

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

	return account.AssignProperties_From_BatchAccount(source)
}

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

	return account.AssignProperties_To_BatchAccount(destination)
}

var _ configmaps.Exporter = &BatchAccount{}

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

var _ secrets.Exporter = &BatchAccount{}

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

var _ genruntime.ImportableResource = &BatchAccount{}

// InitializeSpec initializes the spec for this resource from the given status
func (account *BatchAccount) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*BatchAccount_STATUS); ok {
		return account.Spec.Initialize_From_BatchAccount_STATUS(s)
	}

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

var _ genruntime.KubernetesResource = &BatchAccount{}

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

// GetAPIVersion returns the ARM API version of the resource. This is always "2021-01-01"
func (account BatchAccount) GetAPIVersion() string {
	return "2021-01-01"
}

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.Batch/batchAccounts"
func (account *BatchAccount) GetType() string {
	return "Microsoft.Batch/batchAccounts"
}

// NewEmptyStatus returns a new empty (blank) status
func (account *BatchAccount) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &BatchAccount_STATUS{}
}

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

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

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

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

	account.Status = st
	return nil
}

// AssignProperties_From_BatchAccount populates our BatchAccount from the provided source BatchAccount
func (account *BatchAccount) AssignProperties_From_BatchAccount(source *storage.BatchAccount) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_BatchAccount populates the provided destination BatchAccount from our BatchAccount
func (account *BatchAccount) AssignProperties_To_BatchAccount(destination *storage.BatchAccount) error {

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /batch/resource-manager/Microsoft.Batch/stable/2021-01-01/BatchManagement.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}
type BatchAccountList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []BatchAccount `json:"items"`
}

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

const APIVersion_Value = APIVersion("2021-01-01")

type BatchAccount_Spec struct {
	// AutoStorage: The properties related to the auto-storage account.
	AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"`

	// +kubebuilder:validation:MaxLength=24
	// +kubebuilder:validation:MinLength=3
	// +kubebuilder:validation:Pattern="^[a-z0-9]+$"
	// 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"`

	// Encryption: Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using
	// a Microsoft managed key. For additional control, a customer-managed key can be used instead.
	Encryption *EncryptionProperties `json:"encryption,omitempty"`

	// Identity: The identity of the Batch account.
	Identity *BatchAccountIdentity `json:"identity,omitempty"`

	// KeyVaultReference: A reference to the Azure key vault associated with the Batch account.
	KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"`

	// +kubebuilder:validation:Required
	// Location: The region in which to create the account.
	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 *BatchAccountOperatorSpec `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"`

	// PoolAllocationMode: The pool allocation mode also affects how clients may authenticate to the Batch Service API. If the
	// mode is BatchService, clients may authenticate using access keys or Azure Active Directory. If the mode is
	// UserSubscription, clients must use Azure Active Directory. The default is BatchService.
	PoolAllocationMode *PoolAllocationMode `json:"poolAllocationMode,omitempty"`

	// PublicNetworkAccess: If not specified, the default value is 'enabled'.
	PublicNetworkAccess *PublicNetworkAccessType `json:"publicNetworkAccess,omitempty"`

	// Tags: The user-specified tags associated with the account.
	Tags map[string]string `json:"tags,omitempty"`
}

var _ genruntime.ARMTransformer = &BatchAccount_Spec{}

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

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

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

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

	// Set property "Properties":
	if account.AutoStorage != nil ||
		account.Encryption != nil ||
		account.KeyVaultReference != nil ||
		account.PoolAllocationMode != nil ||
		account.PublicNetworkAccess != nil {
		result.Properties = &arm.BatchAccountCreateProperties{}
	}
	if account.AutoStorage != nil {
		autoStorage_ARM, err := account.AutoStorage.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		autoStorage := *autoStorage_ARM.(*arm.AutoStorageBaseProperties)
		result.Properties.AutoStorage = &autoStorage
	}
	if account.Encryption != nil {
		encryption_ARM, err := account.Encryption.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		encryption := *encryption_ARM.(*arm.EncryptionProperties)
		result.Properties.Encryption = &encryption
	}
	if account.KeyVaultReference != nil {
		keyVaultReference_ARM, err := account.KeyVaultReference.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		keyVaultReference := *keyVaultReference_ARM.(*arm.KeyVaultReference)
		result.Properties.KeyVaultReference = &keyVaultReference
	}
	if account.PoolAllocationMode != nil {
		var temp string
		temp = string(*account.PoolAllocationMode)
		poolAllocationMode := arm.PoolAllocationMode(temp)
		result.Properties.PoolAllocationMode = &poolAllocationMode
	}
	if account.PublicNetworkAccess != nil {
		var temp string
		temp = string(*account.PublicNetworkAccess)
		publicNetworkAccess := arm.PublicNetworkAccessType(temp)
		result.Properties.PublicNetworkAccess = &publicNetworkAccess
	}

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

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

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

	// Set property "AutoStorage":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AutoStorage != nil {
			var autoStorage1 AutoStorageBaseProperties
			err := autoStorage1.PopulateFromARM(owner, *typedInput.Properties.AutoStorage)
			if err != nil {
				return err
			}
			autoStorage := autoStorage1
			account.AutoStorage = &autoStorage
		}
	}

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

	// Set property "Encryption":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Encryption != nil {
			var encryption1 EncryptionProperties
			err := encryption1.PopulateFromARM(owner, *typedInput.Properties.Encryption)
			if err != nil {
				return err
			}
			encryption := encryption1
			account.Encryption = &encryption
		}
	}

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

	// Set property "KeyVaultReference":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.KeyVaultReference != nil {
			var keyVaultReference1 KeyVaultReference
			err := keyVaultReference1.PopulateFromARM(owner, *typedInput.Properties.KeyVaultReference)
			if err != nil {
				return err
			}
			keyVaultReference := keyVaultReference1
			account.KeyVaultReference = &keyVaultReference
		}
	}

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

	// no assignment for property "OperatorSpec"

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

	// Set property "PoolAllocationMode":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PoolAllocationMode != nil {
			var temp string
			temp = string(*typedInput.Properties.PoolAllocationMode)
			poolAllocationMode := PoolAllocationMode(temp)
			account.PoolAllocationMode = &poolAllocationMode
		}
	}

	// Set property "PublicNetworkAccess":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PublicNetworkAccess != nil {
			var temp string
			temp = string(*typedInput.Properties.PublicNetworkAccess)
			publicNetworkAccess := PublicNetworkAccessType(temp)
			account.PublicNetworkAccess = &publicNetworkAccess
		}
	}

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

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &BatchAccount_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.BatchAccount_Spec{}
	err := account.AssignProperties_To_BatchAccount_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_BatchAccount_Spec populates our BatchAccount_Spec from the provided source BatchAccount_Spec
func (account *BatchAccount_Spec) AssignProperties_From_BatchAccount_Spec(source *storage.BatchAccount_Spec) error {

	// AutoStorage
	if source.AutoStorage != nil {
		var autoStorage AutoStorageBaseProperties
		err := autoStorage.AssignProperties_From_AutoStorageBaseProperties(source.AutoStorage)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_AutoStorageBaseProperties() to populate field AutoStorage")
		}
		account.AutoStorage = &autoStorage
	} else {
		account.AutoStorage = nil
	}

	// AzureName
	account.AzureName = source.AzureName

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

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

	// KeyVaultReference
	if source.KeyVaultReference != nil {
		var keyVaultReference KeyVaultReference
		err := keyVaultReference.AssignProperties_From_KeyVaultReference(source.KeyVaultReference)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_KeyVaultReference() to populate field KeyVaultReference")
		}
		account.KeyVaultReference = &keyVaultReference
	} else {
		account.KeyVaultReference = nil
	}

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

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

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

	// PoolAllocationMode
	if source.PoolAllocationMode != nil {
		poolAllocationMode := *source.PoolAllocationMode
		poolAllocationModeTemp := genruntime.ToEnum(poolAllocationMode, poolAllocationMode_Values)
		account.PoolAllocationMode = &poolAllocationModeTemp
	} else {
		account.PoolAllocationMode = nil
	}

	// PublicNetworkAccess
	if source.PublicNetworkAccess != nil {
		publicNetworkAccess := *source.PublicNetworkAccess
		publicNetworkAccessTemp := genruntime.ToEnum(publicNetworkAccess, publicNetworkAccessType_Values)
		account.PublicNetworkAccess = &publicNetworkAccessTemp
	} else {
		account.PublicNetworkAccess = nil
	}

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

	// No error
	return nil
}

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

	// AutoStorage
	if account.AutoStorage != nil {
		var autoStorage storage.AutoStorageBaseProperties
		err := account.AutoStorage.AssignProperties_To_AutoStorageBaseProperties(&autoStorage)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_AutoStorageBaseProperties() to populate field AutoStorage")
		}
		destination.AutoStorage = &autoStorage
	} else {
		destination.AutoStorage = nil
	}

	// AzureName
	destination.AzureName = account.AzureName

	// Encryption
	if account.Encryption != nil {
		var encryption storage.EncryptionProperties
		err := account.Encryption.AssignProperties_To_EncryptionProperties(&encryption)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_EncryptionProperties() to populate field Encryption")
		}
		destination.Encryption = &encryption
	} else {
		destination.Encryption = nil
	}

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

	// KeyVaultReference
	if account.KeyVaultReference != nil {
		var keyVaultReference storage.KeyVaultReference
		err := account.KeyVaultReference.AssignProperties_To_KeyVaultReference(&keyVaultReference)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_KeyVaultReference() to populate field KeyVaultReference")
		}
		destination.KeyVaultReference = &keyVaultReference
	} else {
		destination.KeyVaultReference = nil
	}

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

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

	// OriginalVersion
	destination.OriginalVersion = account.OriginalVersion()

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

	// PoolAllocationMode
	if account.PoolAllocationMode != nil {
		poolAllocationMode := string(*account.PoolAllocationMode)
		destination.PoolAllocationMode = &poolAllocationMode
	} else {
		destination.PoolAllocationMode = nil
	}

	// PublicNetworkAccess
	if account.PublicNetworkAccess != nil {
		publicNetworkAccess := string(*account.PublicNetworkAccess)
		destination.PublicNetworkAccess = &publicNetworkAccess
	} else {
		destination.PublicNetworkAccess = nil
	}

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

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

	// No error
	return nil
}

// Initialize_From_BatchAccount_STATUS populates our BatchAccount_Spec from the provided source BatchAccount_STATUS
func (account *BatchAccount_Spec) Initialize_From_BatchAccount_STATUS(source *BatchAccount_STATUS) error {

	// AutoStorage
	if source.AutoStorage != nil {
		var autoStorage AutoStorageBaseProperties
		err := autoStorage.Initialize_From_AutoStorageProperties_STATUS(source.AutoStorage)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_AutoStorageProperties_STATUS() to populate field AutoStorage")
		}
		account.AutoStorage = &autoStorage
	} else {
		account.AutoStorage = nil
	}

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

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

	// KeyVaultReference
	if source.KeyVaultReference != nil {
		var keyVaultReference KeyVaultReference
		err := keyVaultReference.Initialize_From_KeyVaultReference_STATUS(source.KeyVaultReference)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_KeyVaultReference_STATUS() to populate field KeyVaultReference")
		}
		account.KeyVaultReference = &keyVaultReference
	} else {
		account.KeyVaultReference = nil
	}

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

	// PoolAllocationMode
	if source.PoolAllocationMode != nil {
		poolAllocationMode := genruntime.ToEnum(string(*source.PoolAllocationMode), poolAllocationMode_Values)
		account.PoolAllocationMode = &poolAllocationMode
	} else {
		account.PoolAllocationMode = nil
	}

	// PublicNetworkAccess
	if source.PublicNetworkAccess != nil {
		publicNetworkAccess := genruntime.ToEnum(string(*source.PublicNetworkAccess), publicNetworkAccessType_Values)
		account.PublicNetworkAccess = &publicNetworkAccess
	} else {
		account.PublicNetworkAccess = nil
	}

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

	// No error
	return nil
}

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

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

// Contains information about an Azure Batch account.
type BatchAccount_STATUS struct {
	// AccountEndpoint: The account endpoint used to interact with the Batch service.
	AccountEndpoint              *string `json:"accountEndpoint,omitempty"`
	ActiveJobAndJobScheduleQuota *int    `json:"activeJobAndJobScheduleQuota,omitempty"`

	// AutoStorage: Contains information about the auto-storage account associated with a Batch account.
	AutoStorage *AutoStorageProperties_STATUS `json:"autoStorage,omitempty"`

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

	// DedicatedCoreQuota: For accounts with PoolAllocationMode set to UserSubscription, quota is managed on the subscription
	// so this value is not returned.
	DedicatedCoreQuota *int `json:"dedicatedCoreQuota,omitempty"`

	// DedicatedCoreQuotaPerVMFamily: A list of the dedicated core quota per Virtual Machine family for the Batch account. For
	// accounts with PoolAllocationMode set to UserSubscription, quota is managed on the subscription so this value is not
	// returned.
	DedicatedCoreQuotaPerVMFamily []VirtualMachineFamilyCoreQuota_STATUS `json:"dedicatedCoreQuotaPerVMFamily,omitempty"`

	// DedicatedCoreQuotaPerVMFamilyEnforced: Batch is transitioning its core quota system for dedicated cores to be enforced
	// per Virtual Machine family. During this transitional phase, the dedicated core quota per Virtual Machine family may not
	// yet be enforced. If this flag is false, dedicated core quota is enforced via the old dedicatedCoreQuota property on the
	// account and does not consider Virtual Machine family. If this flag is true, dedicated core quota is enforced via the
	// dedicatedCoreQuotaPerVMFamily property on the account, and the old dedicatedCoreQuota does not apply.
	DedicatedCoreQuotaPerVMFamilyEnforced *bool `json:"dedicatedCoreQuotaPerVMFamilyEnforced,omitempty"`

	// Encryption: Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using
	// a Microsoft managed key. For additional control, a customer-managed key can be used instead.
	Encryption *EncryptionProperties_STATUS `json:"encryption,omitempty"`

	// Id: The ID of the resource.
	Id *string `json:"id,omitempty"`

	// Identity: The identity of the Batch account.
	Identity *BatchAccountIdentity_STATUS `json:"identity,omitempty"`

	// KeyVaultReference: Identifies the Azure key vault associated with a Batch account.
	KeyVaultReference *KeyVaultReference_STATUS `json:"keyVaultReference,omitempty"`

	// Location: The location of the resource.
	Location *string `json:"location,omitempty"`

	// LowPriorityCoreQuota: For accounts with PoolAllocationMode set to UserSubscription, quota is managed on the subscription
	// so this value is not returned.
	LowPriorityCoreQuota *int `json:"lowPriorityCoreQuota,omitempty"`

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

	// PoolAllocationMode: The allocation mode for creating pools in the Batch account.
	PoolAllocationMode *PoolAllocationMode_STATUS `json:"poolAllocationMode,omitempty"`
	PoolQuota          *int                       `json:"poolQuota,omitempty"`

	// PrivateEndpointConnections: List of private endpoint connections associated with the Batch account
	PrivateEndpointConnections []PrivateEndpointConnection_STATUS `json:"privateEndpointConnections,omitempty"`

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

	// PublicNetworkAccess: If not specified, the default value is 'enabled'.
	PublicNetworkAccess *PublicNetworkAccessType_STATUS `json:"publicNetworkAccess,omitempty"`

	// Tags: The tags of the resource.
	Tags map[string]string `json:"tags,omitempty"`

	// Type: The type of the resource.
	Type *string `json:"type,omitempty"`
}

var _ genruntime.ConvertibleStatus = &BatchAccount_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.BatchAccount_STATUS{}
	err := account.AssignProperties_To_BatchAccount_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 = &BatchAccount_STATUS{}

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

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

	// Set property "AccountEndpoint":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AccountEndpoint != nil {
			accountEndpoint := *typedInput.Properties.AccountEndpoint
			account.AccountEndpoint = &accountEndpoint
		}
	}

	// Set property "ActiveJobAndJobScheduleQuota":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ActiveJobAndJobScheduleQuota != nil {
			activeJobAndJobScheduleQuota := *typedInput.Properties.ActiveJobAndJobScheduleQuota
			account.ActiveJobAndJobScheduleQuota = &activeJobAndJobScheduleQuota
		}
	}

	// Set property "AutoStorage":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AutoStorage != nil {
			var autoStorage1 AutoStorageProperties_STATUS
			err := autoStorage1.PopulateFromARM(owner, *typedInput.Properties.AutoStorage)
			if err != nil {
				return err
			}
			autoStorage := autoStorage1
			account.AutoStorage = &autoStorage
		}
	}

	// no assignment for property "Conditions"

	// Set property "DedicatedCoreQuota":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DedicatedCoreQuota != nil {
			dedicatedCoreQuota := *typedInput.Properties.DedicatedCoreQuota
			account.DedicatedCoreQuota = &dedicatedCoreQuota
		}
	}

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

	// Set property "DedicatedCoreQuotaPerVMFamilyEnforced":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DedicatedCoreQuotaPerVMFamilyEnforced != nil {
			dedicatedCoreQuotaPerVMFamilyEnforced := *typedInput.Properties.DedicatedCoreQuotaPerVMFamilyEnforced
			account.DedicatedCoreQuotaPerVMFamilyEnforced = &dedicatedCoreQuotaPerVMFamilyEnforced
		}
	}

	// Set property "Encryption":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Encryption != nil {
			var encryption1 EncryptionProperties_STATUS
			err := encryption1.PopulateFromARM(owner, *typedInput.Properties.Encryption)
			if err != nil {
				return err
			}
			encryption := encryption1
			account.Encryption = &encryption
		}
	}

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

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

	// Set property "KeyVaultReference":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.KeyVaultReference != nil {
			var keyVaultReference1 KeyVaultReference_STATUS
			err := keyVaultReference1.PopulateFromARM(owner, *typedInput.Properties.KeyVaultReference)
			if err != nil {
				return err
			}
			keyVaultReference := keyVaultReference1
			account.KeyVaultReference = &keyVaultReference
		}
	}

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

	// Set property "LowPriorityCoreQuota":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.LowPriorityCoreQuota != nil {
			lowPriorityCoreQuota := *typedInput.Properties.LowPriorityCoreQuota
			account.LowPriorityCoreQuota = &lowPriorityCoreQuota
		}
	}

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

	// Set property "PoolAllocationMode":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PoolAllocationMode != nil {
			var temp string
			temp = string(*typedInput.Properties.PoolAllocationMode)
			poolAllocationMode := PoolAllocationMode_STATUS(temp)
			account.PoolAllocationMode = &poolAllocationMode
		}
	}

	// Set property "PoolQuota":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PoolQuota != nil {
			poolQuota := *typedInput.Properties.PoolQuota
			account.PoolQuota = &poolQuota
		}
	}

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

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

	// Set property "PublicNetworkAccess":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PublicNetworkAccess != nil {
			var temp string
			temp = string(*typedInput.Properties.PublicNetworkAccess)
			publicNetworkAccess := PublicNetworkAccessType_STATUS(temp)
			account.PublicNetworkAccess = &publicNetworkAccess
		}
	}

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

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

	// No error
	return nil
}

// AssignProperties_From_BatchAccount_STATUS populates our BatchAccount_STATUS from the provided source BatchAccount_STATUS
func (account *BatchAccount_STATUS) AssignProperties_From_BatchAccount_STATUS(source *storage.BatchAccount_STATUS) error {

	// AccountEndpoint
	account.AccountEndpoint = genruntime.ClonePointerToString(source.AccountEndpoint)

	// ActiveJobAndJobScheduleQuota
	account.ActiveJobAndJobScheduleQuota = genruntime.ClonePointerToInt(source.ActiveJobAndJobScheduleQuota)

	// AutoStorage
	if source.AutoStorage != nil {
		var autoStorage AutoStorageProperties_STATUS
		err := autoStorage.AssignProperties_From_AutoStorageProperties_STATUS(source.AutoStorage)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_AutoStorageProperties_STATUS() to populate field AutoStorage")
		}
		account.AutoStorage = &autoStorage
	} else {
		account.AutoStorage = nil
	}

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

	// DedicatedCoreQuota
	account.DedicatedCoreQuota = genruntime.ClonePointerToInt(source.DedicatedCoreQuota)

	// DedicatedCoreQuotaPerVMFamily
	if source.DedicatedCoreQuotaPerVMFamily != nil {
		dedicatedCoreQuotaPerVMFamilyList := make([]VirtualMachineFamilyCoreQuota_STATUS, len(source.DedicatedCoreQuotaPerVMFamily))
		for dedicatedCoreQuotaPerVMFamilyIndex, dedicatedCoreQuotaPerVMFamilyItem := range source.DedicatedCoreQuotaPerVMFamily {
			var dedicatedCoreQuotaPerVMFamily VirtualMachineFamilyCoreQuota_STATUS
			err := dedicatedCoreQuotaPerVMFamily.AssignProperties_From_VirtualMachineFamilyCoreQuota_STATUS(&dedicatedCoreQuotaPerVMFamilyItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_VirtualMachineFamilyCoreQuota_STATUS() to populate field DedicatedCoreQuotaPerVMFamily")
			}
			dedicatedCoreQuotaPerVMFamilyList[dedicatedCoreQuotaPerVMFamilyIndex] = dedicatedCoreQuotaPerVMFamily
		}
		account.DedicatedCoreQuotaPerVMFamily = dedicatedCoreQuotaPerVMFamilyList
	} else {
		account.DedicatedCoreQuotaPerVMFamily = nil
	}

	// DedicatedCoreQuotaPerVMFamilyEnforced
	if source.DedicatedCoreQuotaPerVMFamilyEnforced != nil {
		dedicatedCoreQuotaPerVMFamilyEnforced := *source.DedicatedCoreQuotaPerVMFamilyEnforced
		account.DedicatedCoreQuotaPerVMFamilyEnforced = &dedicatedCoreQuotaPerVMFamilyEnforced
	} else {
		account.DedicatedCoreQuotaPerVMFamilyEnforced = nil
	}

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

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

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

	// KeyVaultReference
	if source.KeyVaultReference != nil {
		var keyVaultReference KeyVaultReference_STATUS
		err := keyVaultReference.AssignProperties_From_KeyVaultReference_STATUS(source.KeyVaultReference)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_KeyVaultReference_STATUS() to populate field KeyVaultReference")
		}
		account.KeyVaultReference = &keyVaultReference
	} else {
		account.KeyVaultReference = nil
	}

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

	// LowPriorityCoreQuota
	account.LowPriorityCoreQuota = genruntime.ClonePointerToInt(source.LowPriorityCoreQuota)

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

	// PoolAllocationMode
	if source.PoolAllocationMode != nil {
		poolAllocationMode := *source.PoolAllocationMode
		poolAllocationModeTemp := genruntime.ToEnum(poolAllocationMode, poolAllocationMode_STATUS_Values)
		account.PoolAllocationMode = &poolAllocationModeTemp
	} else {
		account.PoolAllocationMode = nil
	}

	// PoolQuota
	account.PoolQuota = genruntime.ClonePointerToInt(source.PoolQuota)

	// PrivateEndpointConnections
	if source.PrivateEndpointConnections != nil {
		privateEndpointConnectionList := make([]PrivateEndpointConnection_STATUS, len(source.PrivateEndpointConnections))
		for privateEndpointConnectionIndex, privateEndpointConnectionItem := range source.PrivateEndpointConnections {
			var privateEndpointConnection PrivateEndpointConnection_STATUS
			err := privateEndpointConnection.AssignProperties_From_PrivateEndpointConnection_STATUS(&privateEndpointConnectionItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_PrivateEndpointConnection_STATUS() to populate field PrivateEndpointConnections")
			}
			privateEndpointConnectionList[privateEndpointConnectionIndex] = privateEndpointConnection
		}
		account.PrivateEndpointConnections = privateEndpointConnectionList
	} else {
		account.PrivateEndpointConnections = nil
	}

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

	// PublicNetworkAccess
	if source.PublicNetworkAccess != nil {
		publicNetworkAccess := *source.PublicNetworkAccess
		publicNetworkAccessTemp := genruntime.ToEnum(publicNetworkAccess, publicNetworkAccessType_STATUS_Values)
		account.PublicNetworkAccess = &publicNetworkAccessTemp
	} else {
		account.PublicNetworkAccess = nil
	}

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

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

	// No error
	return nil
}

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

	// AccountEndpoint
	destination.AccountEndpoint = genruntime.ClonePointerToString(account.AccountEndpoint)

	// ActiveJobAndJobScheduleQuota
	destination.ActiveJobAndJobScheduleQuota = genruntime.ClonePointerToInt(account.ActiveJobAndJobScheduleQuota)

	// AutoStorage
	if account.AutoStorage != nil {
		var autoStorage storage.AutoStorageProperties_STATUS
		err := account.AutoStorage.AssignProperties_To_AutoStorageProperties_STATUS(&autoStorage)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_AutoStorageProperties_STATUS() to populate field AutoStorage")
		}
		destination.AutoStorage = &autoStorage
	} else {
		destination.AutoStorage = nil
	}

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

	// DedicatedCoreQuota
	destination.DedicatedCoreQuota = genruntime.ClonePointerToInt(account.DedicatedCoreQuota)

	// DedicatedCoreQuotaPerVMFamily
	if account.DedicatedCoreQuotaPerVMFamily != nil {
		dedicatedCoreQuotaPerVMFamilyList := make([]storage.VirtualMachineFamilyCoreQuota_STATUS, len(account.DedicatedCoreQuotaPerVMFamily))
		for dedicatedCoreQuotaPerVMFamilyIndex, dedicatedCoreQuotaPerVMFamilyItem := range account.DedicatedCoreQuotaPerVMFamily {
			var dedicatedCoreQuotaPerVMFamily storage.VirtualMachineFamilyCoreQuota_STATUS
			err := dedicatedCoreQuotaPerVMFamilyItem.AssignProperties_To_VirtualMachineFamilyCoreQuota_STATUS(&dedicatedCoreQuotaPerVMFamily)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_VirtualMachineFamilyCoreQuota_STATUS() to populate field DedicatedCoreQuotaPerVMFamily")
			}
			dedicatedCoreQuotaPerVMFamilyList[dedicatedCoreQuotaPerVMFamilyIndex] = dedicatedCoreQuotaPerVMFamily
		}
		destination.DedicatedCoreQuotaPerVMFamily = dedicatedCoreQuotaPerVMFamilyList
	} else {
		destination.DedicatedCoreQuotaPerVMFamily = nil
	}

	// DedicatedCoreQuotaPerVMFamilyEnforced
	if account.DedicatedCoreQuotaPerVMFamilyEnforced != nil {
		dedicatedCoreQuotaPerVMFamilyEnforced := *account.DedicatedCoreQuotaPerVMFamilyEnforced
		destination.DedicatedCoreQuotaPerVMFamilyEnforced = &dedicatedCoreQuotaPerVMFamilyEnforced
	} else {
		destination.DedicatedCoreQuotaPerVMFamilyEnforced = nil
	}

	// Encryption
	if account.Encryption != nil {
		var encryption storage.EncryptionProperties_STATUS
		err := account.Encryption.AssignProperties_To_EncryptionProperties_STATUS(&encryption)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_EncryptionProperties_STATUS() to populate field Encryption")
		}
		destination.Encryption = &encryption
	} else {
		destination.Encryption = nil
	}

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

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

	// KeyVaultReference
	if account.KeyVaultReference != nil {
		var keyVaultReference storage.KeyVaultReference_STATUS
		err := account.KeyVaultReference.AssignProperties_To_KeyVaultReference_STATUS(&keyVaultReference)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_KeyVaultReference_STATUS() to populate field KeyVaultReference")
		}
		destination.KeyVaultReference = &keyVaultReference
	} else {
		destination.KeyVaultReference = nil
	}

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

	// LowPriorityCoreQuota
	destination.LowPriorityCoreQuota = genruntime.ClonePointerToInt(account.LowPriorityCoreQuota)

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

	// PoolAllocationMode
	if account.PoolAllocationMode != nil {
		poolAllocationMode := string(*account.PoolAllocationMode)
		destination.PoolAllocationMode = &poolAllocationMode
	} else {
		destination.PoolAllocationMode = nil
	}

	// PoolQuota
	destination.PoolQuota = genruntime.ClonePointerToInt(account.PoolQuota)

	// PrivateEndpointConnections
	if account.PrivateEndpointConnections != nil {
		privateEndpointConnectionList := make([]storage.PrivateEndpointConnection_STATUS, len(account.PrivateEndpointConnections))
		for privateEndpointConnectionIndex, privateEndpointConnectionItem := range account.PrivateEndpointConnections {
			var privateEndpointConnection storage.PrivateEndpointConnection_STATUS
			err := privateEndpointConnectionItem.AssignProperties_To_PrivateEndpointConnection_STATUS(&privateEndpointConnection)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_PrivateEndpointConnection_STATUS() to populate field PrivateEndpointConnections")
			}
			privateEndpointConnectionList[privateEndpointConnectionIndex] = privateEndpointConnection
		}
		destination.PrivateEndpointConnections = privateEndpointConnectionList
	} else {
		destination.PrivateEndpointConnections = nil
	}

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

	// PublicNetworkAccess
	if account.PublicNetworkAccess != nil {
		publicNetworkAccess := string(*account.PublicNetworkAccess)
		destination.PublicNetworkAccess = &publicNetworkAccess
	} else {
		destination.PublicNetworkAccess = nil
	}

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

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

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

	// No error
	return nil
}

// The properties related to the auto-storage account.
type AutoStorageBaseProperties struct {
	// +kubebuilder:validation:Required
	// StorageAccountReference: The resource ID of the storage account to be used for auto-storage account.
	StorageAccountReference *genruntime.ResourceReference `armReference:"StorageAccountId" json:"storageAccountReference,omitempty"`
}

var _ genruntime.ARMTransformer = &AutoStorageBaseProperties{}

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

	// Set property "StorageAccountId":
	if properties.StorageAccountReference != nil {
		storageAccountReferenceARMID, err := resolved.ResolvedReferences.Lookup(*properties.StorageAccountReference)
		if err != nil {
			return nil, err
		}
		storageAccountReference := storageAccountReferenceARMID
		result.StorageAccountId = &storageAccountReference
	}
	return result, nil
}

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

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

	// no assignment for property "StorageAccountReference"

	// No error
	return nil
}

// AssignProperties_From_AutoStorageBaseProperties populates our AutoStorageBaseProperties from the provided source AutoStorageBaseProperties
func (properties *AutoStorageBaseProperties) AssignProperties_From_AutoStorageBaseProperties(source *storage.AutoStorageBaseProperties) error {

	// StorageAccountReference
	if source.StorageAccountReference != nil {
		storageAccountReference := source.StorageAccountReference.Copy()
		properties.StorageAccountReference = &storageAccountReference
	} else {
		properties.StorageAccountReference = nil
	}

	// No error
	return nil
}

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

	// StorageAccountReference
	if properties.StorageAccountReference != nil {
		storageAccountReference := properties.StorageAccountReference.Copy()
		destination.StorageAccountReference = &storageAccountReference
	} else {
		destination.StorageAccountReference = nil
	}

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

	// No error
	return nil
}

// Initialize_From_AutoStorageProperties_STATUS populates our AutoStorageBaseProperties from the provided source AutoStorageProperties_STATUS
func (properties *AutoStorageBaseProperties) Initialize_From_AutoStorageProperties_STATUS(source *AutoStorageProperties_STATUS) error {

	// StorageAccountReference
	if source.StorageAccountId != nil {
		storageAccountReference := genruntime.CreateResourceReferenceFromARMID(*source.StorageAccountId)
		properties.StorageAccountReference = &storageAccountReference
	} else {
		properties.StorageAccountReference = nil
	}

	// No error
	return nil
}

// Contains information about the auto-storage account associated with a Batch account.
type AutoStorageProperties_STATUS struct {
	// LastKeySync: The UTC time at which storage keys were last synchronized with the Batch account.
	LastKeySync *string `json:"lastKeySync,omitempty"`

	// StorageAccountId: The resource ID of the storage account to be used for auto-storage account.
	StorageAccountId *string `json:"storageAccountId,omitempty"`
}

var _ genruntime.FromARMConverter = &AutoStorageProperties_STATUS{}

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

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

	// Set property "LastKeySync":
	if typedInput.LastKeySync != nil {
		lastKeySync := *typedInput.LastKeySync
		properties.LastKeySync = &lastKeySync
	}

	// Set property "StorageAccountId":
	if typedInput.StorageAccountId != nil {
		storageAccountId := *typedInput.StorageAccountId
		properties.StorageAccountId = &storageAccountId
	}

	// No error
	return nil
}

// AssignProperties_From_AutoStorageProperties_STATUS populates our AutoStorageProperties_STATUS from the provided source AutoStorageProperties_STATUS
func (properties *AutoStorageProperties_STATUS) AssignProperties_From_AutoStorageProperties_STATUS(source *storage.AutoStorageProperties_STATUS) error {

	// LastKeySync
	properties.LastKeySync = genruntime.ClonePointerToString(source.LastKeySync)

	// StorageAccountId
	properties.StorageAccountId = genruntime.ClonePointerToString(source.StorageAccountId)

	// No error
	return nil
}

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

	// LastKeySync
	destination.LastKeySync = genruntime.ClonePointerToString(properties.LastKeySync)

	// StorageAccountId
	destination.StorageAccountId = genruntime.ClonePointerToString(properties.StorageAccountId)

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

	// No error
	return nil
}

// The identity of the Batch account, if configured. This is only used when the user specifies 'Microsoft.KeyVault' as
// their Batch account encryption configuration.
type BatchAccountIdentity struct {
	// +kubebuilder:validation:Required
	// Type: The type of identity used for the Batch account.
	Type *BatchAccountIdentity_Type `json:"type,omitempty"`

	// UserAssignedIdentities: The list of user identities associated with the Batch account. The user identity dictionary key
	// references will be ARM resource ids in the form:
	// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
	UserAssignedIdentities []UserAssignedIdentityDetails `json:"userAssignedIdentities,omitempty"`
}

var _ genruntime.ARMTransformer = &BatchAccountIdentity{}

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

	// Set property "Type":
	if identity.Type != nil {
		var temp string
		temp = string(*identity.Type)
		typeVar := arm.BatchAccountIdentity_Type(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 *BatchAccountIdentity) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.BatchAccountIdentity{}
}

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

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

	// no assignment for property "UserAssignedIdentities"

	// No error
	return nil
}

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

	// Type
	if source.Type != nil {
		typeVar := *source.Type
		typeTemp := genruntime.ToEnum(typeVar, batchAccountIdentity_Type_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_BatchAccountIdentity populates the provided destination BatchAccountIdentity from our BatchAccountIdentity
func (identity *BatchAccountIdentity) AssignProperties_To_BatchAccountIdentity(destination *storage.BatchAccountIdentity) 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_BatchAccountIdentity_STATUS populates our BatchAccountIdentity from the provided source BatchAccountIdentity_STATUS
func (identity *BatchAccountIdentity) Initialize_From_BatchAccountIdentity_STATUS(source *BatchAccountIdentity_STATUS) error {

	// Type
	if source.Type != nil {
		typeVar := genruntime.ToEnum(string(*source.Type), batchAccountIdentity_Type_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
}

// The identity of the Batch account, if configured. This is only used when the user specifies 'Microsoft.KeyVault' as
// their Batch account encryption configuration.
type BatchAccountIdentity_STATUS struct {
	// PrincipalId: The principal id of the Batch account. This property will only be provided for a system assigned identity.
	PrincipalId *string `json:"principalId,omitempty"`

	// TenantId: The tenant id associated with the Batch account. This property will only be provided for a system assigned
	// identity.
	TenantId *string `json:"tenantId,omitempty"`

	// Type: The type of identity used for the Batch account.
	Type *BatchAccountIdentity_Type_STATUS `json:"type,omitempty"`

	// UserAssignedIdentities: The list of user identities associated with the Batch account. The user identity dictionary key
	// references will be ARM resource ids in the form:
	// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
	UserAssignedIdentities map[string]BatchAccountIdentity_UserAssignedIdentities_STATUS `json:"userAssignedIdentities,omitempty"`
}

var _ genruntime.FromARMConverter = &BatchAccountIdentity_STATUS{}

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

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (identity *BatchAccountIdentity_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.BatchAccountIdentity_STATUS)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.BatchAccountIdentity_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 := BatchAccountIdentity_Type_STATUS(temp)
		identity.Type = &typeVar
	}

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

	// No error
	return nil
}

// AssignProperties_From_BatchAccountIdentity_STATUS populates our BatchAccountIdentity_STATUS from the provided source BatchAccountIdentity_STATUS
func (identity *BatchAccountIdentity_STATUS) AssignProperties_From_BatchAccountIdentity_STATUS(source *storage.BatchAccountIdentity_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, batchAccountIdentity_Type_STATUS_Values)
		identity.Type = &typeTemp
	} else {
		identity.Type = nil
	}

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

	// No error
	return nil
}

// AssignProperties_To_BatchAccountIdentity_STATUS populates the provided destination BatchAccountIdentity_STATUS from our BatchAccountIdentity_STATUS
func (identity *BatchAccountIdentity_STATUS) AssignProperties_To_BatchAccountIdentity_STATUS(destination *storage.BatchAccountIdentity_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.BatchAccountIdentity_UserAssignedIdentities_STATUS, len(identity.UserAssignedIdentities))
		for userAssignedIdentityKey, userAssignedIdentityValue := range identity.UserAssignedIdentities {
			var userAssignedIdentity storage.BatchAccountIdentity_UserAssignedIdentities_STATUS
			err := userAssignedIdentityValue.AssignProperties_To_BatchAccountIdentity_UserAssignedIdentities_STATUS(&userAssignedIdentity)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_BatchAccountIdentity_UserAssignedIdentities_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
}

// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure
type BatchAccountOperatorSpec 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_BatchAccountOperatorSpec populates our BatchAccountOperatorSpec from the provided source BatchAccountOperatorSpec
func (operator *BatchAccountOperatorSpec) AssignProperties_From_BatchAccountOperatorSpec(source *storage.BatchAccountOperatorSpec) 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_BatchAccountOperatorSpec populates the provided destination BatchAccountOperatorSpec from our BatchAccountOperatorSpec
func (operator *BatchAccountOperatorSpec) AssignProperties_To_BatchAccountOperatorSpec(destination *storage.BatchAccountOperatorSpec) 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 BatchAccountProperties_ProvisioningState_STATUS string

const (
	BatchAccountProperties_ProvisioningState_STATUS_Cancelled = BatchAccountProperties_ProvisioningState_STATUS("Cancelled")
	BatchAccountProperties_ProvisioningState_STATUS_Creating  = BatchAccountProperties_ProvisioningState_STATUS("Creating")
	BatchAccountProperties_ProvisioningState_STATUS_Deleting  = BatchAccountProperties_ProvisioningState_STATUS("Deleting")
	BatchAccountProperties_ProvisioningState_STATUS_Failed    = BatchAccountProperties_ProvisioningState_STATUS("Failed")
	BatchAccountProperties_ProvisioningState_STATUS_Invalid   = BatchAccountProperties_ProvisioningState_STATUS("Invalid")
	BatchAccountProperties_ProvisioningState_STATUS_Succeeded = BatchAccountProperties_ProvisioningState_STATUS("Succeeded")
)

// Mapping from string to BatchAccountProperties_ProvisioningState_STATUS
var batchAccountProperties_ProvisioningState_STATUS_Values = map[string]BatchAccountProperties_ProvisioningState_STATUS{
	"cancelled": BatchAccountProperties_ProvisioningState_STATUS_Cancelled,
	"creating":  BatchAccountProperties_ProvisioningState_STATUS_Creating,
	"deleting":  BatchAccountProperties_ProvisioningState_STATUS_Deleting,
	"failed":    BatchAccountProperties_ProvisioningState_STATUS_Failed,
	"invalid":   BatchAccountProperties_ProvisioningState_STATUS_Invalid,
	"succeeded": BatchAccountProperties_ProvisioningState_STATUS_Succeeded,
}

// Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft
// managed key. For additional control, a customer-managed key can be used instead.
type EncryptionProperties struct {
	// KeySource: Type of the key source.
	KeySource *EncryptionProperties_KeySource `json:"keySource,omitempty"`

	// KeyVaultProperties: Additional details when using Microsoft.KeyVault
	KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"`
}

var _ genruntime.ARMTransformer = &EncryptionProperties{}

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

	// Set property "KeySource":
	if properties.KeySource != nil {
		var temp string
		temp = string(*properties.KeySource)
		keySource := arm.EncryptionProperties_KeySource(temp)
		result.KeySource = &keySource
	}

	// Set property "KeyVaultProperties":
	if properties.KeyVaultProperties != nil {
		keyVaultProperties_ARM, err := properties.KeyVaultProperties.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		keyVaultProperties := *keyVaultProperties_ARM.(*arm.KeyVaultProperties)
		result.KeyVaultProperties = &keyVaultProperties
	}
	return result, nil
}

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

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

	// Set property "KeySource":
	if typedInput.KeySource != nil {
		var temp string
		temp = string(*typedInput.KeySource)
		keySource := EncryptionProperties_KeySource(temp)
		properties.KeySource = &keySource
	}

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

	// No error
	return nil
}

// AssignProperties_From_EncryptionProperties populates our EncryptionProperties from the provided source EncryptionProperties
func (properties *EncryptionProperties) AssignProperties_From_EncryptionProperties(source *storage.EncryptionProperties) error {

	// KeySource
	if source.KeySource != nil {
		keySource := *source.KeySource
		keySourceTemp := genruntime.ToEnum(keySource, encryptionProperties_KeySource_Values)
		properties.KeySource = &keySourceTemp
	} else {
		properties.KeySource = nil
	}

	// 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")
		}
		properties.KeyVaultProperties = &keyVaultProperty
	} else {
		properties.KeyVaultProperties = nil
	}

	// No error
	return nil
}

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

	// KeySource
	if properties.KeySource != nil {
		keySource := string(*properties.KeySource)
		destination.KeySource = &keySource
	} else {
		destination.KeySource = nil
	}

	// KeyVaultProperties
	if properties.KeyVaultProperties != nil {
		var keyVaultProperty storage.KeyVaultProperties
		err := properties.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
	}

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

	// No error
	return nil
}

// Initialize_From_EncryptionProperties_STATUS populates our EncryptionProperties from the provided source EncryptionProperties_STATUS
func (properties *EncryptionProperties) Initialize_From_EncryptionProperties_STATUS(source *EncryptionProperties_STATUS) error {

	// KeySource
	if source.KeySource != nil {
		keySource := genruntime.ToEnum(string(*source.KeySource), encryptionProperties_KeySource_Values)
		properties.KeySource = &keySource
	} else {
		properties.KeySource = nil
	}

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

	// No error
	return nil
}

// Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft
// managed key. For additional control, a customer-managed key can be used instead.
type EncryptionProperties_STATUS struct {
	// KeySource: Type of the key source.
	KeySource *EncryptionProperties_KeySource_STATUS `json:"keySource,omitempty"`

	// KeyVaultProperties: Additional details when using Microsoft.KeyVault
	KeyVaultProperties *KeyVaultProperties_STATUS `json:"keyVaultProperties,omitempty"`
}

var _ genruntime.FromARMConverter = &EncryptionProperties_STATUS{}

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

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

	// Set property "KeySource":
	if typedInput.KeySource != nil {
		var temp string
		temp = string(*typedInput.KeySource)
		keySource := EncryptionProperties_KeySource_STATUS(temp)
		properties.KeySource = &keySource
	}

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

	// No error
	return nil
}

// AssignProperties_From_EncryptionProperties_STATUS populates our EncryptionProperties_STATUS from the provided source EncryptionProperties_STATUS
func (properties *EncryptionProperties_STATUS) AssignProperties_From_EncryptionProperties_STATUS(source *storage.EncryptionProperties_STATUS) error {

	// KeySource
	if source.KeySource != nil {
		keySource := *source.KeySource
		keySourceTemp := genruntime.ToEnum(keySource, encryptionProperties_KeySource_STATUS_Values)
		properties.KeySource = &keySourceTemp
	} else {
		properties.KeySource = 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")
		}
		properties.KeyVaultProperties = &keyVaultProperty
	} else {
		properties.KeyVaultProperties = nil
	}

	// No error
	return nil
}

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

	// KeySource
	if properties.KeySource != nil {
		keySource := string(*properties.KeySource)
		destination.KeySource = &keySource
	} else {
		destination.KeySource = nil
	}

	// KeyVaultProperties
	if properties.KeyVaultProperties != nil {
		var keyVaultProperty storage.KeyVaultProperties_STATUS
		err := properties.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
	}

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

	// No error
	return nil
}

// Identifies the Azure key vault associated with a Batch account.
type KeyVaultReference struct {
	// +kubebuilder:validation:Required
	// Reference: The resource ID of the Azure key vault associated with the Batch account.
	Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"`

	// +kubebuilder:validation:Required
	// Url: The URL of the Azure key vault associated with the Batch account.
	Url *string `json:"url,omitempty"`
}

var _ genruntime.ARMTransformer = &KeyVaultReference{}

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

	// Set property "Id":
	if reference.Reference != nil {
		referenceARMID, err := resolved.ResolvedReferences.Lookup(*reference.Reference)
		if err != nil {
			return nil, err
		}
		reference1 := referenceARMID
		result.Id = &reference1
	}

	// Set property "Url":
	if reference.Url != nil {
		url := *reference.Url
		result.Url = &url
	}
	return result, nil
}

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

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

	// no assignment for property "Reference"

	// Set property "Url":
	if typedInput.Url != nil {
		url := *typedInput.Url
		reference.Url = &url
	}

	// No error
	return nil
}

// AssignProperties_From_KeyVaultReference populates our KeyVaultReference from the provided source KeyVaultReference
func (reference *KeyVaultReference) AssignProperties_From_KeyVaultReference(source *storage.KeyVaultReference) error {

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

	// Url
	reference.Url = genruntime.ClonePointerToString(source.Url)

	// No error
	return nil
}

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

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

	// Url
	destination.Url = genruntime.ClonePointerToString(reference.Url)

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

	// No error
	return nil
}

// Initialize_From_KeyVaultReference_STATUS populates our KeyVaultReference from the provided source KeyVaultReference_STATUS
func (reference *KeyVaultReference) Initialize_From_KeyVaultReference_STATUS(source *KeyVaultReference_STATUS) error {

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

	// Url
	reference.Url = genruntime.ClonePointerToString(source.Url)

	// No error
	return nil
}

// Identifies the Azure key vault associated with a Batch account.
type KeyVaultReference_STATUS struct {
	// Id: The resource ID of the Azure key vault associated with the Batch account.
	Id *string `json:"id,omitempty"`

	// Url: The URL of the Azure key vault associated with the Batch account.
	Url *string `json:"url,omitempty"`
}

var _ genruntime.FromARMConverter = &KeyVaultReference_STATUS{}

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

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

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

	// Set property "Url":
	if typedInput.Url != nil {
		url := *typedInput.Url
		reference.Url = &url
	}

	// No error
	return nil
}

// AssignProperties_From_KeyVaultReference_STATUS populates our KeyVaultReference_STATUS from the provided source KeyVaultReference_STATUS
func (reference *KeyVaultReference_STATUS) AssignProperties_From_KeyVaultReference_STATUS(source *storage.KeyVaultReference_STATUS) error {

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

	// Url
	reference.Url = genruntime.ClonePointerToString(source.Url)

	// No error
	return nil
}

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

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

	// Url
	destination.Url = genruntime.ClonePointerToString(reference.Url)

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

	// No error
	return nil
}

// The allocation mode for creating pools in the Batch account.
// +kubebuilder:validation:Enum={"BatchService","UserSubscription"}
type PoolAllocationMode string

const (
	PoolAllocationMode_BatchService     = PoolAllocationMode("BatchService")
	PoolAllocationMode_UserSubscription = PoolAllocationMode("UserSubscription")
)

// Mapping from string to PoolAllocationMode
var poolAllocationMode_Values = map[string]PoolAllocationMode{
	"batchservice":     PoolAllocationMode_BatchService,
	"usersubscription": PoolAllocationMode_UserSubscription,
}

// The allocation mode for creating pools in the Batch account.
type PoolAllocationMode_STATUS string

const (
	PoolAllocationMode_STATUS_BatchService     = PoolAllocationMode_STATUS("BatchService")
	PoolAllocationMode_STATUS_UserSubscription = PoolAllocationMode_STATUS("UserSubscription")
)

// Mapping from string to PoolAllocationMode_STATUS
var poolAllocationMode_STATUS_Values = map[string]PoolAllocationMode_STATUS{
	"batchservice":     PoolAllocationMode_STATUS_BatchService,
	"usersubscription": PoolAllocationMode_STATUS_UserSubscription,
}

// Contains information about a private link resource.
type PrivateEndpointConnection_STATUS struct {
	// Id: The ID of the resource.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &PrivateEndpointConnection_STATUS{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_PrivateEndpointConnection_STATUS populates our PrivateEndpointConnection_STATUS from the provided source PrivateEndpointConnection_STATUS
func (connection *PrivateEndpointConnection_STATUS) AssignProperties_From_PrivateEndpointConnection_STATUS(source *storage.PrivateEndpointConnection_STATUS) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// The network access type for operating on the resources in the Batch account.
// +kubebuilder:validation:Enum={"Disabled","Enabled"}
type PublicNetworkAccessType string

const (
	PublicNetworkAccessType_Disabled = PublicNetworkAccessType("Disabled")
	PublicNetworkAccessType_Enabled  = PublicNetworkAccessType("Enabled")
)

// Mapping from string to PublicNetworkAccessType
var publicNetworkAccessType_Values = map[string]PublicNetworkAccessType{
	"disabled": PublicNetworkAccessType_Disabled,
	"enabled":  PublicNetworkAccessType_Enabled,
}

// The network access type for operating on the resources in the Batch account.
type PublicNetworkAccessType_STATUS string

const (
	PublicNetworkAccessType_STATUS_Disabled = PublicNetworkAccessType_STATUS("Disabled")
	PublicNetworkAccessType_STATUS_Enabled  = PublicNetworkAccessType_STATUS("Enabled")
)

// Mapping from string to PublicNetworkAccessType_STATUS
var publicNetworkAccessType_STATUS_Values = map[string]PublicNetworkAccessType_STATUS{
	"disabled": PublicNetworkAccessType_STATUS_Disabled,
	"enabled":  PublicNetworkAccessType_STATUS_Enabled,
}

// A VM Family and its associated core quota for the Batch account.
type VirtualMachineFamilyCoreQuota_STATUS struct {
	// CoreQuota: The core quota for the VM family for the Batch account.
	CoreQuota *int `json:"coreQuota,omitempty"`

	// Name: The Virtual Machine family name.
	Name *string `json:"name,omitempty"`
}

var _ genruntime.FromARMConverter = &VirtualMachineFamilyCoreQuota_STATUS{}

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

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

	// Set property "CoreQuota":
	if typedInput.CoreQuota != nil {
		coreQuota := *typedInput.CoreQuota
		quota.CoreQuota = &coreQuota
	}

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

	// No error
	return nil
}

// AssignProperties_From_VirtualMachineFamilyCoreQuota_STATUS populates our VirtualMachineFamilyCoreQuota_STATUS from the provided source VirtualMachineFamilyCoreQuota_STATUS
func (quota *VirtualMachineFamilyCoreQuota_STATUS) AssignProperties_From_VirtualMachineFamilyCoreQuota_STATUS(source *storage.VirtualMachineFamilyCoreQuota_STATUS) error {

	// CoreQuota
	quota.CoreQuota = genruntime.ClonePointerToInt(source.CoreQuota)

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

	// No error
	return nil
}

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

	// CoreQuota
	destination.CoreQuota = genruntime.ClonePointerToInt(quota.CoreQuota)

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

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"None","SystemAssigned","UserAssigned"}
type BatchAccountIdentity_Type string

const (
	BatchAccountIdentity_Type_None           = BatchAccountIdentity_Type("None")
	BatchAccountIdentity_Type_SystemAssigned = BatchAccountIdentity_Type("SystemAssigned")
	BatchAccountIdentity_Type_UserAssigned   = BatchAccountIdentity_Type("UserAssigned")
)

// Mapping from string to BatchAccountIdentity_Type
var batchAccountIdentity_Type_Values = map[string]BatchAccountIdentity_Type{
	"none":           BatchAccountIdentity_Type_None,
	"systemassigned": BatchAccountIdentity_Type_SystemAssigned,
	"userassigned":   BatchAccountIdentity_Type_UserAssigned,
}

type BatchAccountIdentity_Type_STATUS string

const (
	BatchAccountIdentity_Type_STATUS_None           = BatchAccountIdentity_Type_STATUS("None")
	BatchAccountIdentity_Type_STATUS_SystemAssigned = BatchAccountIdentity_Type_STATUS("SystemAssigned")
	BatchAccountIdentity_Type_STATUS_UserAssigned   = BatchAccountIdentity_Type_STATUS("UserAssigned")
)

// Mapping from string to BatchAccountIdentity_Type_STATUS
var batchAccountIdentity_Type_STATUS_Values = map[string]BatchAccountIdentity_Type_STATUS{
	"none":           BatchAccountIdentity_Type_STATUS_None,
	"systemassigned": BatchAccountIdentity_Type_STATUS_SystemAssigned,
	"userassigned":   BatchAccountIdentity_Type_STATUS_UserAssigned,
}

type BatchAccountIdentity_UserAssignedIdentities_STATUS struct {
	// ClientId: The client id of user assigned identity.
	ClientId *string `json:"clientId,omitempty"`

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

var _ genruntime.FromARMConverter = &BatchAccountIdentity_UserAssignedIdentities_STATUS{}

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

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

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

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

	// No error
	return nil
}

// AssignProperties_From_BatchAccountIdentity_UserAssignedIdentities_STATUS populates our BatchAccountIdentity_UserAssignedIdentities_STATUS from the provided source BatchAccountIdentity_UserAssignedIdentities_STATUS
func (identities *BatchAccountIdentity_UserAssignedIdentities_STATUS) AssignProperties_From_BatchAccountIdentity_UserAssignedIdentities_STATUS(source *storage.BatchAccountIdentity_UserAssignedIdentities_STATUS) error {

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

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

	// No error
	return nil
}

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

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

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

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"Microsoft.Batch","Microsoft.KeyVault"}
type EncryptionProperties_KeySource string

const (
	EncryptionProperties_KeySource_MicrosoftBatch    = EncryptionProperties_KeySource("Microsoft.Batch")
	EncryptionProperties_KeySource_MicrosoftKeyVault = EncryptionProperties_KeySource("Microsoft.KeyVault")
)

// Mapping from string to EncryptionProperties_KeySource
var encryptionProperties_KeySource_Values = map[string]EncryptionProperties_KeySource{
	"microsoft.batch":    EncryptionProperties_KeySource_MicrosoftBatch,
	"microsoft.keyvault": EncryptionProperties_KeySource_MicrosoftKeyVault,
}

type EncryptionProperties_KeySource_STATUS string

const (
	EncryptionProperties_KeySource_STATUS_MicrosoftBatch    = EncryptionProperties_KeySource_STATUS("Microsoft.Batch")
	EncryptionProperties_KeySource_STATUS_MicrosoftKeyVault = EncryptionProperties_KeySource_STATUS("Microsoft.KeyVault")
)

// Mapping from string to EncryptionProperties_KeySource_STATUS
var encryptionProperties_KeySource_STATUS_Values = map[string]EncryptionProperties_KeySource_STATUS{
	"microsoft.batch":    EncryptionProperties_KeySource_STATUS_MicrosoftBatch,
	"microsoft.keyvault": EncryptionProperties_KeySource_STATUS_MicrosoftKeyVault,
}

// KeyVault configuration when using an encryption KeySource of Microsoft.KeyVault.
type KeyVaultProperties struct {
	// KeyIdentifier: Full path to the versioned secret. Example
	// https://mykeyvault.vault.azure.net/keys/testkey/6e34a81fef704045975661e297a4c053. To be usable the following
	// prerequisites must be met:
	// The Batch Account has a System Assigned identity
	// The account identity has been granted Key/Get, Key/Unwrap and Key/Wrap permissions
	// The KeyVault has soft-delete and purge protection enabled
	KeyIdentifier *string `json:"keyIdentifier,omitempty"`
}

var _ genruntime.ARMTransformer = &KeyVaultProperties{}

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

	// Set property "KeyIdentifier":
	if properties.KeyIdentifier != nil {
		keyIdentifier := *properties.KeyIdentifier
		result.KeyIdentifier = &keyIdentifier
	}
	return result, nil
}

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

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

	// Set property "KeyIdentifier":
	if typedInput.KeyIdentifier != nil {
		keyIdentifier := *typedInput.KeyIdentifier
		properties.KeyIdentifier = &keyIdentifier
	}

	// No error
	return nil
}

// AssignProperties_From_KeyVaultProperties populates our KeyVaultProperties from the provided source KeyVaultProperties
func (properties *KeyVaultProperties) AssignProperties_From_KeyVaultProperties(source *storage.KeyVaultProperties) error {

	// KeyIdentifier
	properties.KeyIdentifier = genruntime.ClonePointerToString(source.KeyIdentifier)

	// No error
	return nil
}

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

	// KeyIdentifier
	destination.KeyIdentifier = genruntime.ClonePointerToString(properties.KeyIdentifier)

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

	// No error
	return nil
}

// Initialize_From_KeyVaultProperties_STATUS populates our KeyVaultProperties from the provided source KeyVaultProperties_STATUS
func (properties *KeyVaultProperties) Initialize_From_KeyVaultProperties_STATUS(source *KeyVaultProperties_STATUS) error {

	// KeyIdentifier
	properties.KeyIdentifier = genruntime.ClonePointerToString(source.KeyIdentifier)

	// No error
	return nil
}

// KeyVault configuration when using an encryption KeySource of Microsoft.KeyVault.
type KeyVaultProperties_STATUS struct {
	// KeyIdentifier: Full path to the versioned secret. Example
	// https://mykeyvault.vault.azure.net/keys/testkey/6e34a81fef704045975661e297a4c053. To be usable the following
	// prerequisites must be met:
	// The Batch Account has a System Assigned identity
	// The account identity has been granted Key/Get, Key/Unwrap and Key/Wrap permissions
	// The KeyVault has soft-delete and purge protection enabled
	KeyIdentifier *string `json:"keyIdentifier,omitempty"`
}

var _ genruntime.FromARMConverter = &KeyVaultProperties_STATUS{}

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

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

	// Set property "KeyIdentifier":
	if typedInput.KeyIdentifier != nil {
		keyIdentifier := *typedInput.KeyIdentifier
		properties.KeyIdentifier = &keyIdentifier
	}

	// No error
	return nil
}

// AssignProperties_From_KeyVaultProperties_STATUS populates our KeyVaultProperties_STATUS from the provided source KeyVaultProperties_STATUS
func (properties *KeyVaultProperties_STATUS) AssignProperties_From_KeyVaultProperties_STATUS(source *storage.KeyVaultProperties_STATUS) error {

	// KeyIdentifier
	properties.KeyIdentifier = genruntime.ClonePointerToString(source.KeyIdentifier)

	// No error
	return nil
}

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

	// KeyIdentifier
	destination.KeyIdentifier = genruntime.ClonePointerToString(properties.KeyIdentifier)

	// 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(&BatchAccount{}, &BatchAccountList{})
}
