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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/storage/v1api20230101/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/storage/v1api20230101/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,storage}
// +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: /storage/resource-manager/Microsoft.Storage/stable/2023-01-01/file.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default
type StorageAccountsFileService struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              StorageAccountsFileService_Spec   `json:"spec,omitempty"`
	Status            StorageAccountsFileService_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &StorageAccountsFileService{}

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

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

var _ conversion.Convertible = &StorageAccountsFileService{}

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

	return service.AssignProperties_From_StorageAccountsFileService(source)
}

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

	return service.AssignProperties_To_StorageAccountsFileService(destination)
}

var _ configmaps.Exporter = &StorageAccountsFileService{}

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

var _ secrets.Exporter = &StorageAccountsFileService{}

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

var _ genruntime.ImportableResource = &StorageAccountsFileService{}

// InitializeSpec initializes the spec for this resource from the given status
func (service *StorageAccountsFileService) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*StorageAccountsFileService_STATUS); ok {
		return service.Spec.Initialize_From_StorageAccountsFileService_STATUS(s)
	}

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

var _ genruntime.KubernetesResource = &StorageAccountsFileService{}

// AzureName returns the Azure name of the resource (always "default")
func (service *StorageAccountsFileService) AzureName() string {
	return "default"
}

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

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.Storage/storageAccounts/fileServices"
func (service *StorageAccountsFileService) GetType() string {
	return "Microsoft.Storage/storageAccounts/fileServices"
}

// NewEmptyStatus returns a new empty (blank) status
func (service *StorageAccountsFileService) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &StorageAccountsFileService_STATUS{}
}

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

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

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

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

	service.Status = st
	return nil
}

// AssignProperties_From_StorageAccountsFileService populates our StorageAccountsFileService from the provided source StorageAccountsFileService
func (service *StorageAccountsFileService) AssignProperties_From_StorageAccountsFileService(source *storage.StorageAccountsFileService) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_StorageAccountsFileService populates the provided destination StorageAccountsFileService from our StorageAccountsFileService
func (service *StorageAccountsFileService) AssignProperties_To_StorageAccountsFileService(destination *storage.StorageAccountsFileService) error {

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /storage/resource-manager/Microsoft.Storage/stable/2023-01-01/file.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default
type StorageAccountsFileServiceList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []StorageAccountsFileService `json:"items"`
}

type StorageAccountsFileService_Spec struct {
	// Cors: Specifies CORS rules for the File service. You can include up to five CorsRule elements in the request. If no
	// CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the
	// File service.
	Cors *CorsRules `json:"cors,omitempty"`

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

	// ProtocolSettings: Protocol settings for file service
	ProtocolSettings *ProtocolSettings `json:"protocolSettings,omitempty"`

	// ShareDeleteRetentionPolicy: The file service properties for share soft delete.
	ShareDeleteRetentionPolicy *DeleteRetentionPolicy `json:"shareDeleteRetentionPolicy,omitempty"`
}

var _ genruntime.ARMTransformer = &StorageAccountsFileService_Spec{}

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

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

	// Set property "Properties":
	if service.Cors != nil ||
		service.ProtocolSettings != nil ||
		service.ShareDeleteRetentionPolicy != nil {
		result.Properties = &arm.StorageAccounts_FileService_Properties_Spec{}
	}
	if service.Cors != nil {
		cors_ARM, err := service.Cors.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		cors := *cors_ARM.(*arm.CorsRules)
		result.Properties.Cors = &cors
	}
	if service.ProtocolSettings != nil {
		protocolSettings_ARM, err := service.ProtocolSettings.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		protocolSettings := *protocolSettings_ARM.(*arm.ProtocolSettings)
		result.Properties.ProtocolSettings = &protocolSettings
	}
	if service.ShareDeleteRetentionPolicy != nil {
		shareDeleteRetentionPolicy_ARM, err := service.ShareDeleteRetentionPolicy.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		shareDeleteRetentionPolicy := *shareDeleteRetentionPolicy_ARM.(*arm.DeleteRetentionPolicy)
		result.Properties.ShareDeleteRetentionPolicy = &shareDeleteRetentionPolicy
	}
	return result, nil
}

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

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

	// Set property "Cors":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Cors != nil {
			var cors1 CorsRules
			err := cors1.PopulateFromARM(owner, *typedInput.Properties.Cors)
			if err != nil {
				return err
			}
			cors := cors1
			service.Cors = &cors
		}
	}

	// no assignment for property "OperatorSpec"

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

	// Set property "ProtocolSettings":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ProtocolSettings != nil {
			var protocolSettings1 ProtocolSettings
			err := protocolSettings1.PopulateFromARM(owner, *typedInput.Properties.ProtocolSettings)
			if err != nil {
				return err
			}
			protocolSettings := protocolSettings1
			service.ProtocolSettings = &protocolSettings
		}
	}

	// Set property "ShareDeleteRetentionPolicy":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ShareDeleteRetentionPolicy != nil {
			var shareDeleteRetentionPolicy1 DeleteRetentionPolicy
			err := shareDeleteRetentionPolicy1.PopulateFromARM(owner, *typedInput.Properties.ShareDeleteRetentionPolicy)
			if err != nil {
				return err
			}
			shareDeleteRetentionPolicy := shareDeleteRetentionPolicy1
			service.ShareDeleteRetentionPolicy = &shareDeleteRetentionPolicy
		}
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &StorageAccountsFileService_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.StorageAccountsFileService_Spec{}
	err := service.AssignProperties_To_StorageAccountsFileService_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_StorageAccountsFileService_Spec populates our StorageAccountsFileService_Spec from the provided source StorageAccountsFileService_Spec
func (service *StorageAccountsFileService_Spec) AssignProperties_From_StorageAccountsFileService_Spec(source *storage.StorageAccountsFileService_Spec) error {

	// Cors
	if source.Cors != nil {
		var cor CorsRules
		err := cor.AssignProperties_From_CorsRules(source.Cors)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_CorsRules() to populate field Cors")
		}
		service.Cors = &cor
	} else {
		service.Cors = nil
	}

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

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

	// ProtocolSettings
	if source.ProtocolSettings != nil {
		var protocolSetting ProtocolSettings
		err := protocolSetting.AssignProperties_From_ProtocolSettings(source.ProtocolSettings)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ProtocolSettings() to populate field ProtocolSettings")
		}
		service.ProtocolSettings = &protocolSetting
	} else {
		service.ProtocolSettings = nil
	}

	// ShareDeleteRetentionPolicy
	if source.ShareDeleteRetentionPolicy != nil {
		var shareDeleteRetentionPolicy DeleteRetentionPolicy
		err := shareDeleteRetentionPolicy.AssignProperties_From_DeleteRetentionPolicy(source.ShareDeleteRetentionPolicy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_DeleteRetentionPolicy() to populate field ShareDeleteRetentionPolicy")
		}
		service.ShareDeleteRetentionPolicy = &shareDeleteRetentionPolicy
	} else {
		service.ShareDeleteRetentionPolicy = nil
	}

	// No error
	return nil
}

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

	// Cors
	if service.Cors != nil {
		var cor storage.CorsRules
		err := service.Cors.AssignProperties_To_CorsRules(&cor)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_CorsRules() to populate field Cors")
		}
		destination.Cors = &cor
	} else {
		destination.Cors = nil
	}

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

	// OriginalVersion
	destination.OriginalVersion = service.OriginalVersion()

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

	// ProtocolSettings
	if service.ProtocolSettings != nil {
		var protocolSetting storage.ProtocolSettings
		err := service.ProtocolSettings.AssignProperties_To_ProtocolSettings(&protocolSetting)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ProtocolSettings() to populate field ProtocolSettings")
		}
		destination.ProtocolSettings = &protocolSetting
	} else {
		destination.ProtocolSettings = nil
	}

	// ShareDeleteRetentionPolicy
	if service.ShareDeleteRetentionPolicy != nil {
		var shareDeleteRetentionPolicy storage.DeleteRetentionPolicy
		err := service.ShareDeleteRetentionPolicy.AssignProperties_To_DeleteRetentionPolicy(&shareDeleteRetentionPolicy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_DeleteRetentionPolicy() to populate field ShareDeleteRetentionPolicy")
		}
		destination.ShareDeleteRetentionPolicy = &shareDeleteRetentionPolicy
	} else {
		destination.ShareDeleteRetentionPolicy = nil
	}

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

	// No error
	return nil
}

// Initialize_From_StorageAccountsFileService_STATUS populates our StorageAccountsFileService_Spec from the provided source StorageAccountsFileService_STATUS
func (service *StorageAccountsFileService_Spec) Initialize_From_StorageAccountsFileService_STATUS(source *StorageAccountsFileService_STATUS) error {

	// Cors
	if source.Cors != nil {
		var cor CorsRules
		err := cor.Initialize_From_CorsRules_STATUS(source.Cors)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_CorsRules_STATUS() to populate field Cors")
		}
		service.Cors = &cor
	} else {
		service.Cors = nil
	}

	// ProtocolSettings
	if source.ProtocolSettings != nil {
		var protocolSetting ProtocolSettings
		err := protocolSetting.Initialize_From_ProtocolSettings_STATUS(source.ProtocolSettings)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_ProtocolSettings_STATUS() to populate field ProtocolSettings")
		}
		service.ProtocolSettings = &protocolSetting
	} else {
		service.ProtocolSettings = nil
	}

	// ShareDeleteRetentionPolicy
	if source.ShareDeleteRetentionPolicy != nil {
		var shareDeleteRetentionPolicy DeleteRetentionPolicy
		err := shareDeleteRetentionPolicy.Initialize_From_DeleteRetentionPolicy_STATUS(source.ShareDeleteRetentionPolicy)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_DeleteRetentionPolicy_STATUS() to populate field ShareDeleteRetentionPolicy")
		}
		service.ShareDeleteRetentionPolicy = &shareDeleteRetentionPolicy
	} else {
		service.ShareDeleteRetentionPolicy = nil
	}

	// No error
	return nil
}

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

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

	// Cors: Specifies CORS rules for the File service. You can include up to five CorsRule elements in the request. If no
	// CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the
	// File service.
	Cors *CorsRules_STATUS `json:"cors,omitempty"`

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

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

	// ProtocolSettings: Protocol settings for file service
	ProtocolSettings *ProtocolSettings_STATUS `json:"protocolSettings,omitempty"`

	// ShareDeleteRetentionPolicy: The file service properties for share soft delete.
	ShareDeleteRetentionPolicy *DeleteRetentionPolicy_STATUS `json:"shareDeleteRetentionPolicy,omitempty"`

	// Sku: Sku name and tier.
	Sku *Sku_STATUS `json:"sku,omitempty"`

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

var _ genruntime.ConvertibleStatus = &StorageAccountsFileService_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.StorageAccountsFileService_STATUS{}
	err := service.AssignProperties_To_StorageAccountsFileService_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 = &StorageAccountsFileService_STATUS{}

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

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

	// no assignment for property "Conditions"

	// Set property "Cors":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Cors != nil {
			var cors1 CorsRules_STATUS
			err := cors1.PopulateFromARM(owner, *typedInput.Properties.Cors)
			if err != nil {
				return err
			}
			cors := cors1
			service.Cors = &cors
		}
	}

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

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

	// Set property "ProtocolSettings":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ProtocolSettings != nil {
			var protocolSettings1 ProtocolSettings_STATUS
			err := protocolSettings1.PopulateFromARM(owner, *typedInput.Properties.ProtocolSettings)
			if err != nil {
				return err
			}
			protocolSettings := protocolSettings1
			service.ProtocolSettings = &protocolSettings
		}
	}

	// Set property "ShareDeleteRetentionPolicy":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ShareDeleteRetentionPolicy != nil {
			var shareDeleteRetentionPolicy1 DeleteRetentionPolicy_STATUS
			err := shareDeleteRetentionPolicy1.PopulateFromARM(owner, *typedInput.Properties.ShareDeleteRetentionPolicy)
			if err != nil {
				return err
			}
			shareDeleteRetentionPolicy := shareDeleteRetentionPolicy1
			service.ShareDeleteRetentionPolicy = &shareDeleteRetentionPolicy
		}
	}

	// Set property "Sku":
	if typedInput.Sku != nil {
		var sku1 Sku_STATUS
		err := sku1.PopulateFromARM(owner, *typedInput.Sku)
		if err != nil {
			return err
		}
		sku := sku1
		service.Sku = &sku
	}

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

	// No error
	return nil
}

// AssignProperties_From_StorageAccountsFileService_STATUS populates our StorageAccountsFileService_STATUS from the provided source StorageAccountsFileService_STATUS
func (service *StorageAccountsFileService_STATUS) AssignProperties_From_StorageAccountsFileService_STATUS(source *storage.StorageAccountsFileService_STATUS) error {

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

	// Cors
	if source.Cors != nil {
		var cor CorsRules_STATUS
		err := cor.AssignProperties_From_CorsRules_STATUS(source.Cors)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_CorsRules_STATUS() to populate field Cors")
		}
		service.Cors = &cor
	} else {
		service.Cors = nil
	}

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

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

	// ProtocolSettings
	if source.ProtocolSettings != nil {
		var protocolSetting ProtocolSettings_STATUS
		err := protocolSetting.AssignProperties_From_ProtocolSettings_STATUS(source.ProtocolSettings)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ProtocolSettings_STATUS() to populate field ProtocolSettings")
		}
		service.ProtocolSettings = &protocolSetting
	} else {
		service.ProtocolSettings = nil
	}

	// ShareDeleteRetentionPolicy
	if source.ShareDeleteRetentionPolicy != nil {
		var shareDeleteRetentionPolicy DeleteRetentionPolicy_STATUS
		err := shareDeleteRetentionPolicy.AssignProperties_From_DeleteRetentionPolicy_STATUS(source.ShareDeleteRetentionPolicy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_DeleteRetentionPolicy_STATUS() to populate field ShareDeleteRetentionPolicy")
		}
		service.ShareDeleteRetentionPolicy = &shareDeleteRetentionPolicy
	} else {
		service.ShareDeleteRetentionPolicy = nil
	}

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

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

	// No error
	return nil
}

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

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

	// Cors
	if service.Cors != nil {
		var cor storage.CorsRules_STATUS
		err := service.Cors.AssignProperties_To_CorsRules_STATUS(&cor)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_CorsRules_STATUS() to populate field Cors")
		}
		destination.Cors = &cor
	} else {
		destination.Cors = nil
	}

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

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

	// ProtocolSettings
	if service.ProtocolSettings != nil {
		var protocolSetting storage.ProtocolSettings_STATUS
		err := service.ProtocolSettings.AssignProperties_To_ProtocolSettings_STATUS(&protocolSetting)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ProtocolSettings_STATUS() to populate field ProtocolSettings")
		}
		destination.ProtocolSettings = &protocolSetting
	} else {
		destination.ProtocolSettings = nil
	}

	// ShareDeleteRetentionPolicy
	if service.ShareDeleteRetentionPolicy != nil {
		var shareDeleteRetentionPolicy storage.DeleteRetentionPolicy_STATUS
		err := service.ShareDeleteRetentionPolicy.AssignProperties_To_DeleteRetentionPolicy_STATUS(&shareDeleteRetentionPolicy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_DeleteRetentionPolicy_STATUS() to populate field ShareDeleteRetentionPolicy")
		}
		destination.ShareDeleteRetentionPolicy = &shareDeleteRetentionPolicy
	} else {
		destination.ShareDeleteRetentionPolicy = nil
	}

	// Sku
	if service.Sku != nil {
		var sku storage.Sku_STATUS
		err := service.Sku.AssignProperties_To_Sku_STATUS(&sku)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Sku_STATUS() to populate field Sku")
		}
		destination.Sku = &sku
	} else {
		destination.Sku = nil
	}

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

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

	// No error
	return nil
}

// Protocol settings for file service
type ProtocolSettings struct {
	// Smb: Setting for SMB protocol
	Smb *SmbSetting `json:"smb,omitempty"`
}

var _ genruntime.ARMTransformer = &ProtocolSettings{}

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

	// Set property "Smb":
	if settings.Smb != nil {
		smb_ARM, err := settings.Smb.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		smb := *smb_ARM.(*arm.SmbSetting)
		result.Smb = &smb
	}
	return result, nil
}

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

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

	// Set property "Smb":
	if typedInput.Smb != nil {
		var smb1 SmbSetting
		err := smb1.PopulateFromARM(owner, *typedInput.Smb)
		if err != nil {
			return err
		}
		smb := smb1
		settings.Smb = &smb
	}

	// No error
	return nil
}

// AssignProperties_From_ProtocolSettings populates our ProtocolSettings from the provided source ProtocolSettings
func (settings *ProtocolSettings) AssignProperties_From_ProtocolSettings(source *storage.ProtocolSettings) error {

	// Smb
	if source.Smb != nil {
		var smb SmbSetting
		err := smb.AssignProperties_From_SmbSetting(source.Smb)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SmbSetting() to populate field Smb")
		}
		settings.Smb = &smb
	} else {
		settings.Smb = nil
	}

	// No error
	return nil
}

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

	// Smb
	if settings.Smb != nil {
		var smb storage.SmbSetting
		err := settings.Smb.AssignProperties_To_SmbSetting(&smb)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SmbSetting() to populate field Smb")
		}
		destination.Smb = &smb
	} else {
		destination.Smb = nil
	}

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

	// No error
	return nil
}

// Initialize_From_ProtocolSettings_STATUS populates our ProtocolSettings from the provided source ProtocolSettings_STATUS
func (settings *ProtocolSettings) Initialize_From_ProtocolSettings_STATUS(source *ProtocolSettings_STATUS) error {

	// Smb
	if source.Smb != nil {
		var smb SmbSetting
		err := smb.Initialize_From_SmbSetting_STATUS(source.Smb)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_SmbSetting_STATUS() to populate field Smb")
		}
		settings.Smb = &smb
	} else {
		settings.Smb = nil
	}

	// No error
	return nil
}

// Protocol settings for file service
type ProtocolSettings_STATUS struct {
	// Smb: Setting for SMB protocol
	Smb *SmbSetting_STATUS `json:"smb,omitempty"`
}

var _ genruntime.FromARMConverter = &ProtocolSettings_STATUS{}

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

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

	// Set property "Smb":
	if typedInput.Smb != nil {
		var smb1 SmbSetting_STATUS
		err := smb1.PopulateFromARM(owner, *typedInput.Smb)
		if err != nil {
			return err
		}
		smb := smb1
		settings.Smb = &smb
	}

	// No error
	return nil
}

// AssignProperties_From_ProtocolSettings_STATUS populates our ProtocolSettings_STATUS from the provided source ProtocolSettings_STATUS
func (settings *ProtocolSettings_STATUS) AssignProperties_From_ProtocolSettings_STATUS(source *storage.ProtocolSettings_STATUS) error {

	// Smb
	if source.Smb != nil {
		var smb SmbSetting_STATUS
		err := smb.AssignProperties_From_SmbSetting_STATUS(source.Smb)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SmbSetting_STATUS() to populate field Smb")
		}
		settings.Smb = &smb
	} else {
		settings.Smb = nil
	}

	// No error
	return nil
}

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

	// Smb
	if settings.Smb != nil {
		var smb storage.SmbSetting_STATUS
		err := settings.Smb.AssignProperties_To_SmbSetting_STATUS(&smb)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SmbSetting_STATUS() to populate field Smb")
		}
		destination.Smb = &smb
	} else {
		destination.Smb = 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 StorageAccountsFileServiceOperatorSpec 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_StorageAccountsFileServiceOperatorSpec populates our StorageAccountsFileServiceOperatorSpec from the provided source StorageAccountsFileServiceOperatorSpec
func (operator *StorageAccountsFileServiceOperatorSpec) AssignProperties_From_StorageAccountsFileServiceOperatorSpec(source *storage.StorageAccountsFileServiceOperatorSpec) 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_StorageAccountsFileServiceOperatorSpec populates the provided destination StorageAccountsFileServiceOperatorSpec from our StorageAccountsFileServiceOperatorSpec
func (operator *StorageAccountsFileServiceOperatorSpec) AssignProperties_To_StorageAccountsFileServiceOperatorSpec(destination *storage.StorageAccountsFileServiceOperatorSpec) 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
}

// Setting for SMB protocol
type SmbSetting struct {
	// AuthenticationMethods: SMB authentication methods supported by server. Valid values are NTLMv2, Kerberos. Should be
	// passed as a string with delimiter ';'.
	AuthenticationMethods *string `json:"authenticationMethods,omitempty"`

	// ChannelEncryption: SMB channel encryption supported by server. Valid values are AES-128-CCM, AES-128-GCM, AES-256-GCM.
	// Should be passed as a string with delimiter ';'.
	ChannelEncryption *string `json:"channelEncryption,omitempty"`

	// KerberosTicketEncryption: Kerberos ticket encryption supported by server. Valid values are RC4-HMAC, AES-256. Should be
	// passed as a string with delimiter ';'
	KerberosTicketEncryption *string `json:"kerberosTicketEncryption,omitempty"`

	// Multichannel: Multichannel setting. Applies to Premium FileStorage only.
	Multichannel *Multichannel `json:"multichannel,omitempty"`

	// Versions: SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, SMB3.1.1. Should be passed as a
	// string with delimiter ';'.
	Versions *string `json:"versions,omitempty"`
}

var _ genruntime.ARMTransformer = &SmbSetting{}

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

	// Set property "AuthenticationMethods":
	if setting.AuthenticationMethods != nil {
		authenticationMethods := *setting.AuthenticationMethods
		result.AuthenticationMethods = &authenticationMethods
	}

	// Set property "ChannelEncryption":
	if setting.ChannelEncryption != nil {
		channelEncryption := *setting.ChannelEncryption
		result.ChannelEncryption = &channelEncryption
	}

	// Set property "KerberosTicketEncryption":
	if setting.KerberosTicketEncryption != nil {
		kerberosTicketEncryption := *setting.KerberosTicketEncryption
		result.KerberosTicketEncryption = &kerberosTicketEncryption
	}

	// Set property "Multichannel":
	if setting.Multichannel != nil {
		multichannel_ARM, err := setting.Multichannel.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		multichannel := *multichannel_ARM.(*arm.Multichannel)
		result.Multichannel = &multichannel
	}

	// Set property "Versions":
	if setting.Versions != nil {
		versions := *setting.Versions
		result.Versions = &versions
	}
	return result, nil
}

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

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

	// Set property "AuthenticationMethods":
	if typedInput.AuthenticationMethods != nil {
		authenticationMethods := *typedInput.AuthenticationMethods
		setting.AuthenticationMethods = &authenticationMethods
	}

	// Set property "ChannelEncryption":
	if typedInput.ChannelEncryption != nil {
		channelEncryption := *typedInput.ChannelEncryption
		setting.ChannelEncryption = &channelEncryption
	}

	// Set property "KerberosTicketEncryption":
	if typedInput.KerberosTicketEncryption != nil {
		kerberosTicketEncryption := *typedInput.KerberosTicketEncryption
		setting.KerberosTicketEncryption = &kerberosTicketEncryption
	}

	// Set property "Multichannel":
	if typedInput.Multichannel != nil {
		var multichannel1 Multichannel
		err := multichannel1.PopulateFromARM(owner, *typedInput.Multichannel)
		if err != nil {
			return err
		}
		multichannel := multichannel1
		setting.Multichannel = &multichannel
	}

	// Set property "Versions":
	if typedInput.Versions != nil {
		versions := *typedInput.Versions
		setting.Versions = &versions
	}

	// No error
	return nil
}

// AssignProperties_From_SmbSetting populates our SmbSetting from the provided source SmbSetting
func (setting *SmbSetting) AssignProperties_From_SmbSetting(source *storage.SmbSetting) error {

	// AuthenticationMethods
	setting.AuthenticationMethods = genruntime.ClonePointerToString(source.AuthenticationMethods)

	// ChannelEncryption
	setting.ChannelEncryption = genruntime.ClonePointerToString(source.ChannelEncryption)

	// KerberosTicketEncryption
	setting.KerberosTicketEncryption = genruntime.ClonePointerToString(source.KerberosTicketEncryption)

	// Multichannel
	if source.Multichannel != nil {
		var multichannel Multichannel
		err := multichannel.AssignProperties_From_Multichannel(source.Multichannel)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Multichannel() to populate field Multichannel")
		}
		setting.Multichannel = &multichannel
	} else {
		setting.Multichannel = nil
	}

	// Versions
	setting.Versions = genruntime.ClonePointerToString(source.Versions)

	// No error
	return nil
}

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

	// AuthenticationMethods
	destination.AuthenticationMethods = genruntime.ClonePointerToString(setting.AuthenticationMethods)

	// ChannelEncryption
	destination.ChannelEncryption = genruntime.ClonePointerToString(setting.ChannelEncryption)

	// KerberosTicketEncryption
	destination.KerberosTicketEncryption = genruntime.ClonePointerToString(setting.KerberosTicketEncryption)

	// Multichannel
	if setting.Multichannel != nil {
		var multichannel storage.Multichannel
		err := setting.Multichannel.AssignProperties_To_Multichannel(&multichannel)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Multichannel() to populate field Multichannel")
		}
		destination.Multichannel = &multichannel
	} else {
		destination.Multichannel = nil
	}

	// Versions
	destination.Versions = genruntime.ClonePointerToString(setting.Versions)

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

	// No error
	return nil
}

// Initialize_From_SmbSetting_STATUS populates our SmbSetting from the provided source SmbSetting_STATUS
func (setting *SmbSetting) Initialize_From_SmbSetting_STATUS(source *SmbSetting_STATUS) error {

	// AuthenticationMethods
	setting.AuthenticationMethods = genruntime.ClonePointerToString(source.AuthenticationMethods)

	// ChannelEncryption
	setting.ChannelEncryption = genruntime.ClonePointerToString(source.ChannelEncryption)

	// KerberosTicketEncryption
	setting.KerberosTicketEncryption = genruntime.ClonePointerToString(source.KerberosTicketEncryption)

	// Multichannel
	if source.Multichannel != nil {
		var multichannel Multichannel
		err := multichannel.Initialize_From_Multichannel_STATUS(source.Multichannel)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_Multichannel_STATUS() to populate field Multichannel")
		}
		setting.Multichannel = &multichannel
	} else {
		setting.Multichannel = nil
	}

	// Versions
	setting.Versions = genruntime.ClonePointerToString(source.Versions)

	// No error
	return nil
}

// Setting for SMB protocol
type SmbSetting_STATUS struct {
	// AuthenticationMethods: SMB authentication methods supported by server. Valid values are NTLMv2, Kerberos. Should be
	// passed as a string with delimiter ';'.
	AuthenticationMethods *string `json:"authenticationMethods,omitempty"`

	// ChannelEncryption: SMB channel encryption supported by server. Valid values are AES-128-CCM, AES-128-GCM, AES-256-GCM.
	// Should be passed as a string with delimiter ';'.
	ChannelEncryption *string `json:"channelEncryption,omitempty"`

	// KerberosTicketEncryption: Kerberos ticket encryption supported by server. Valid values are RC4-HMAC, AES-256. Should be
	// passed as a string with delimiter ';'
	KerberosTicketEncryption *string `json:"kerberosTicketEncryption,omitempty"`

	// Multichannel: Multichannel setting. Applies to Premium FileStorage only.
	Multichannel *Multichannel_STATUS `json:"multichannel,omitempty"`

	// Versions: SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, SMB3.1.1. Should be passed as a
	// string with delimiter ';'.
	Versions *string `json:"versions,omitempty"`
}

var _ genruntime.FromARMConverter = &SmbSetting_STATUS{}

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

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

	// Set property "AuthenticationMethods":
	if typedInput.AuthenticationMethods != nil {
		authenticationMethods := *typedInput.AuthenticationMethods
		setting.AuthenticationMethods = &authenticationMethods
	}

	// Set property "ChannelEncryption":
	if typedInput.ChannelEncryption != nil {
		channelEncryption := *typedInput.ChannelEncryption
		setting.ChannelEncryption = &channelEncryption
	}

	// Set property "KerberosTicketEncryption":
	if typedInput.KerberosTicketEncryption != nil {
		kerberosTicketEncryption := *typedInput.KerberosTicketEncryption
		setting.KerberosTicketEncryption = &kerberosTicketEncryption
	}

	// Set property "Multichannel":
	if typedInput.Multichannel != nil {
		var multichannel1 Multichannel_STATUS
		err := multichannel1.PopulateFromARM(owner, *typedInput.Multichannel)
		if err != nil {
			return err
		}
		multichannel := multichannel1
		setting.Multichannel = &multichannel
	}

	// Set property "Versions":
	if typedInput.Versions != nil {
		versions := *typedInput.Versions
		setting.Versions = &versions
	}

	// No error
	return nil
}

// AssignProperties_From_SmbSetting_STATUS populates our SmbSetting_STATUS from the provided source SmbSetting_STATUS
func (setting *SmbSetting_STATUS) AssignProperties_From_SmbSetting_STATUS(source *storage.SmbSetting_STATUS) error {

	// AuthenticationMethods
	setting.AuthenticationMethods = genruntime.ClonePointerToString(source.AuthenticationMethods)

	// ChannelEncryption
	setting.ChannelEncryption = genruntime.ClonePointerToString(source.ChannelEncryption)

	// KerberosTicketEncryption
	setting.KerberosTicketEncryption = genruntime.ClonePointerToString(source.KerberosTicketEncryption)

	// Multichannel
	if source.Multichannel != nil {
		var multichannel Multichannel_STATUS
		err := multichannel.AssignProperties_From_Multichannel_STATUS(source.Multichannel)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Multichannel_STATUS() to populate field Multichannel")
		}
		setting.Multichannel = &multichannel
	} else {
		setting.Multichannel = nil
	}

	// Versions
	setting.Versions = genruntime.ClonePointerToString(source.Versions)

	// No error
	return nil
}

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

	// AuthenticationMethods
	destination.AuthenticationMethods = genruntime.ClonePointerToString(setting.AuthenticationMethods)

	// ChannelEncryption
	destination.ChannelEncryption = genruntime.ClonePointerToString(setting.ChannelEncryption)

	// KerberosTicketEncryption
	destination.KerberosTicketEncryption = genruntime.ClonePointerToString(setting.KerberosTicketEncryption)

	// Multichannel
	if setting.Multichannel != nil {
		var multichannel storage.Multichannel_STATUS
		err := setting.Multichannel.AssignProperties_To_Multichannel_STATUS(&multichannel)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Multichannel_STATUS() to populate field Multichannel")
		}
		destination.Multichannel = &multichannel
	} else {
		destination.Multichannel = nil
	}

	// Versions
	destination.Versions = genruntime.ClonePointerToString(setting.Versions)

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

	// No error
	return nil
}

// Multichannel setting. Applies to Premium FileStorage only.
type Multichannel struct {
	// Enabled: Indicates whether multichannel is enabled
	Enabled *bool `json:"enabled,omitempty"`
}

var _ genruntime.ARMTransformer = &Multichannel{}

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

	// Set property "Enabled":
	if multichannel.Enabled != nil {
		enabled := *multichannel.Enabled
		result.Enabled = &enabled
	}
	return result, nil
}

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

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

	// Set property "Enabled":
	if typedInput.Enabled != nil {
		enabled := *typedInput.Enabled
		multichannel.Enabled = &enabled
	}

	// No error
	return nil
}

// AssignProperties_From_Multichannel populates our Multichannel from the provided source Multichannel
func (multichannel *Multichannel) AssignProperties_From_Multichannel(source *storage.Multichannel) error {

	// Enabled
	if source.Enabled != nil {
		enabled := *source.Enabled
		multichannel.Enabled = &enabled
	} else {
		multichannel.Enabled = nil
	}

	// No error
	return nil
}

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

	// Enabled
	if multichannel.Enabled != nil {
		enabled := *multichannel.Enabled
		destination.Enabled = &enabled
	} else {
		destination.Enabled = nil
	}

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

	// No error
	return nil
}

// Initialize_From_Multichannel_STATUS populates our Multichannel from the provided source Multichannel_STATUS
func (multichannel *Multichannel) Initialize_From_Multichannel_STATUS(source *Multichannel_STATUS) error {

	// Enabled
	if source.Enabled != nil {
		enabled := *source.Enabled
		multichannel.Enabled = &enabled
	} else {
		multichannel.Enabled = nil
	}

	// No error
	return nil
}

// Multichannel setting. Applies to Premium FileStorage only.
type Multichannel_STATUS struct {
	// Enabled: Indicates whether multichannel is enabled
	Enabled *bool `json:"enabled,omitempty"`
}

var _ genruntime.FromARMConverter = &Multichannel_STATUS{}

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

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

	// Set property "Enabled":
	if typedInput.Enabled != nil {
		enabled := *typedInput.Enabled
		multichannel.Enabled = &enabled
	}

	// No error
	return nil
}

// AssignProperties_From_Multichannel_STATUS populates our Multichannel_STATUS from the provided source Multichannel_STATUS
func (multichannel *Multichannel_STATUS) AssignProperties_From_Multichannel_STATUS(source *storage.Multichannel_STATUS) error {

	// Enabled
	if source.Enabled != nil {
		enabled := *source.Enabled
		multichannel.Enabled = &enabled
	} else {
		multichannel.Enabled = nil
	}

	// No error
	return nil
}

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

	// Enabled
	if multichannel.Enabled != nil {
		enabled := *multichannel.Enabled
		destination.Enabled = &enabled
	} else {
		destination.Enabled = nil
	}

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

	// No error
	return nil
}

func init() {
	SchemeBuilder.Register(&StorageAccountsFileService{}, &StorageAccountsFileServiceList{})
}
