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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/apimanagement/v1api20230501preview/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/apimanagement/v1api20230501preview/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,apimanagement}
// +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: /apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/apimauthorizationproviders.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}
type AuthorizationProvider struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              AuthorizationProvider_Spec   `json:"spec,omitempty"`
	Status            AuthorizationProvider_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &AuthorizationProvider{}

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

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

var _ conversion.Convertible = &AuthorizationProvider{}

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

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

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

	return nil
}

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

	return nil
}

var _ configmaps.Exporter = &AuthorizationProvider{}

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

var _ secrets.Exporter = &AuthorizationProvider{}

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

var _ genruntime.KubernetesResource = &AuthorizationProvider{}

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

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

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.ApiManagement/service/authorizationProviders"
func (provider *AuthorizationProvider) GetType() string {
	return "Microsoft.ApiManagement/service/authorizationProviders"
}

// NewEmptyStatus returns a new empty (blank) status
func (provider *AuthorizationProvider) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &AuthorizationProvider_STATUS{}
}

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

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

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

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

	provider.Status = st
	return nil
}

// AssignProperties_From_AuthorizationProvider populates our AuthorizationProvider from the provided source AuthorizationProvider
func (provider *AuthorizationProvider) AssignProperties_From_AuthorizationProvider(source *storage.AuthorizationProvider) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_AuthorizationProvider populates the provided destination AuthorizationProvider from our AuthorizationProvider
func (provider *AuthorizationProvider) AssignProperties_To_AuthorizationProvider(destination *storage.AuthorizationProvider) error {

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/apimauthorizationproviders.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}
type AuthorizationProviderList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []AuthorizationProvider `json:"items"`
}

type AuthorizationProvider_Spec struct {
	// +kubebuilder:validation:MaxLength=256
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:Pattern="^[^*#&+:<>?]+$"
	// AzureName: The name of the resource in Azure. This is often the same as the name of the resource in Kubernetes but it
	// doesn't have to be.
	AzureName string `json:"azureName,omitempty"`

	// +kubebuilder:validation:MaxLength=300
	// +kubebuilder:validation:MinLength=1
	// DisplayName: Authorization Provider name. Must be 1 to 300 characters long.
	DisplayName *string `json:"displayName,omitempty"`

	// IdentityProvider: Identity provider name. Must be 1 to 300 characters long.
	IdentityProvider *string `json:"identityProvider,omitempty"`

	// Oauth2: OAuth2 settings
	Oauth2 *AuthorizationProviderOAuth2Settings `json:"oauth2,omitempty"`

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

var _ genruntime.ARMTransformer = &AuthorizationProvider_Spec{}

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

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

	// Set property "Properties":
	if provider.DisplayName != nil ||
		provider.IdentityProvider != nil ||
		provider.Oauth2 != nil {
		result.Properties = &arm.AuthorizationProviderContractProperties{}
	}
	if provider.DisplayName != nil {
		displayName := *provider.DisplayName
		result.Properties.DisplayName = &displayName
	}
	if provider.IdentityProvider != nil {
		identityProvider := *provider.IdentityProvider
		result.Properties.IdentityProvider = &identityProvider
	}
	if provider.Oauth2 != nil {
		oauth2_ARM, err := provider.Oauth2.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		oauth2 := *oauth2_ARM.(*arm.AuthorizationProviderOAuth2Settings)
		result.Properties.Oauth2 = &oauth2
	}
	return result, nil
}

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

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

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

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

	// Set property "IdentityProvider":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IdentityProvider != nil {
			identityProvider := *typedInput.Properties.IdentityProvider
			provider.IdentityProvider = &identityProvider
		}
	}

	// Set property "Oauth2":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Oauth2 != nil {
			var oauth AuthorizationProviderOAuth2Settings
			err := oauth.PopulateFromARM(owner, *typedInput.Properties.Oauth2)
			if err != nil {
				return err
			}
			oauth2 := oauth
			provider.Oauth2 = &oauth2
		}
	}

	// no assignment for property "OperatorSpec"

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

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &AuthorizationProvider_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.AuthorizationProvider_Spec{}
	err := provider.AssignProperties_To_AuthorizationProvider_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_AuthorizationProvider_Spec populates our AuthorizationProvider_Spec from the provided source AuthorizationProvider_Spec
func (provider *AuthorizationProvider_Spec) AssignProperties_From_AuthorizationProvider_Spec(source *storage.AuthorizationProvider_Spec) error {

	// AzureName
	provider.AzureName = source.AzureName

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

	// IdentityProvider
	provider.IdentityProvider = genruntime.ClonePointerToString(source.IdentityProvider)

	// Oauth2
	if source.Oauth2 != nil {
		var oauth2 AuthorizationProviderOAuth2Settings
		err := oauth2.AssignProperties_From_AuthorizationProviderOAuth2Settings(source.Oauth2)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_AuthorizationProviderOAuth2Settings() to populate field Oauth2")
		}
		provider.Oauth2 = &oauth2
	} else {
		provider.Oauth2 = nil
	}

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

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

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = provider.AzureName

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

	// IdentityProvider
	destination.IdentityProvider = genruntime.ClonePointerToString(provider.IdentityProvider)

	// Oauth2
	if provider.Oauth2 != nil {
		var oauth2 storage.AuthorizationProviderOAuth2Settings
		err := provider.Oauth2.AssignProperties_To_AuthorizationProviderOAuth2Settings(&oauth2)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_AuthorizationProviderOAuth2Settings() to populate field Oauth2")
		}
		destination.Oauth2 = &oauth2
	} else {
		destination.Oauth2 = nil
	}

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

	// OriginalVersion
	destination.OriginalVersion = provider.OriginalVersion()

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

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

	// No error
	return nil
}

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

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

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

	// DisplayName: Authorization Provider name. Must be 1 to 300 characters long.
	DisplayName *string `json:"displayName,omitempty"`

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

	// IdentityProvider: Identity provider name. Must be 1 to 300 characters long.
	IdentityProvider *string `json:"identityProvider,omitempty"`

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

	// Oauth2: OAuth2 settings
	Oauth2 *AuthorizationProviderOAuth2Settings_STATUS `json:"oauth2,omitempty"`

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

var _ genruntime.ConvertibleStatus = &AuthorizationProvider_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.AuthorizationProvider_STATUS{}
	err := provider.AssignProperties_To_AuthorizationProvider_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 = &AuthorizationProvider_STATUS{}

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

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

	// no assignment for property "Conditions"

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

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

	// Set property "IdentityProvider":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IdentityProvider != nil {
			identityProvider := *typedInput.Properties.IdentityProvider
			provider.IdentityProvider = &identityProvider
		}
	}

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

	// Set property "Oauth2":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Oauth2 != nil {
			var oauth AuthorizationProviderOAuth2Settings_STATUS
			err := oauth.PopulateFromARM(owner, *typedInput.Properties.Oauth2)
			if err != nil {
				return err
			}
			oauth2 := oauth
			provider.Oauth2 = &oauth2
		}
	}

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

	// No error
	return nil
}

// AssignProperties_From_AuthorizationProvider_STATUS populates our AuthorizationProvider_STATUS from the provided source AuthorizationProvider_STATUS
func (provider *AuthorizationProvider_STATUS) AssignProperties_From_AuthorizationProvider_STATUS(source *storage.AuthorizationProvider_STATUS) error {

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

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

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

	// IdentityProvider
	provider.IdentityProvider = genruntime.ClonePointerToString(source.IdentityProvider)

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

	// Oauth2
	if source.Oauth2 != nil {
		var oauth2 AuthorizationProviderOAuth2Settings_STATUS
		err := oauth2.AssignProperties_From_AuthorizationProviderOAuth2Settings_STATUS(source.Oauth2)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_AuthorizationProviderOAuth2Settings_STATUS() to populate field Oauth2")
		}
		provider.Oauth2 = &oauth2
	} else {
		provider.Oauth2 = nil
	}

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

	// No error
	return nil
}

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

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

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

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

	// IdentityProvider
	destination.IdentityProvider = genruntime.ClonePointerToString(provider.IdentityProvider)

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

	// Oauth2
	if provider.Oauth2 != nil {
		var oauth2 storage.AuthorizationProviderOAuth2Settings_STATUS
		err := provider.Oauth2.AssignProperties_To_AuthorizationProviderOAuth2Settings_STATUS(&oauth2)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_AuthorizationProviderOAuth2Settings_STATUS() to populate field Oauth2")
		}
		destination.Oauth2 = &oauth2
	} else {
		destination.Oauth2 = nil
	}

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

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

	// No error
	return nil
}

// OAuth2 settings details
type AuthorizationProviderOAuth2Settings struct {
	// GrantTypes: OAuth2 settings
	GrantTypes *AuthorizationProviderOAuth2GrantTypes `json:"grantTypes,omitempty"`

	// RedirectUrl: Redirect URL to be set in the OAuth application.
	RedirectUrl *string `json:"redirectUrl,omitempty"`
}

var _ genruntime.ARMTransformer = &AuthorizationProviderOAuth2Settings{}

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

	// Set property "GrantTypes":
	if settings.GrantTypes != nil {
		grantTypes_ARM, err := settings.GrantTypes.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		grantTypes := *grantTypes_ARM.(*arm.AuthorizationProviderOAuth2GrantTypes)
		result.GrantTypes = &grantTypes
	}

	// Set property "RedirectUrl":
	if settings.RedirectUrl != nil {
		redirectUrl := *settings.RedirectUrl
		result.RedirectUrl = &redirectUrl
	}
	return result, nil
}

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

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

	// Set property "GrantTypes":
	if typedInput.GrantTypes != nil {
		var grantTypes1 AuthorizationProviderOAuth2GrantTypes
		err := grantTypes1.PopulateFromARM(owner, *typedInput.GrantTypes)
		if err != nil {
			return err
		}
		grantTypes := grantTypes1
		settings.GrantTypes = &grantTypes
	}

	// Set property "RedirectUrl":
	if typedInput.RedirectUrl != nil {
		redirectUrl := *typedInput.RedirectUrl
		settings.RedirectUrl = &redirectUrl
	}

	// No error
	return nil
}

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

	// GrantTypes
	if source.GrantTypes != nil {
		var grantType AuthorizationProviderOAuth2GrantTypes
		err := grantType.AssignProperties_From_AuthorizationProviderOAuth2GrantTypes(source.GrantTypes)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_AuthorizationProviderOAuth2GrantTypes() to populate field GrantTypes")
		}
		settings.GrantTypes = &grantType
	} else {
		settings.GrantTypes = nil
	}

	// RedirectUrl
	settings.RedirectUrl = genruntime.ClonePointerToString(source.RedirectUrl)

	// No error
	return nil
}

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

	// GrantTypes
	if settings.GrantTypes != nil {
		var grantType storage.AuthorizationProviderOAuth2GrantTypes
		err := settings.GrantTypes.AssignProperties_To_AuthorizationProviderOAuth2GrantTypes(&grantType)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_AuthorizationProviderOAuth2GrantTypes() to populate field GrantTypes")
		}
		destination.GrantTypes = &grantType
	} else {
		destination.GrantTypes = nil
	}

	// RedirectUrl
	destination.RedirectUrl = genruntime.ClonePointerToString(settings.RedirectUrl)

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

	// No error
	return nil
}

// OAuth2 settings details
type AuthorizationProviderOAuth2Settings_STATUS struct {
	// GrantTypes: OAuth2 settings
	GrantTypes *AuthorizationProviderOAuth2GrantTypes_STATUS `json:"grantTypes,omitempty"`

	// RedirectUrl: Redirect URL to be set in the OAuth application.
	RedirectUrl *string `json:"redirectUrl,omitempty"`
}

var _ genruntime.FromARMConverter = &AuthorizationProviderOAuth2Settings_STATUS{}

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

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

	// Set property "GrantTypes":
	if typedInput.GrantTypes != nil {
		var grantTypes1 AuthorizationProviderOAuth2GrantTypes_STATUS
		err := grantTypes1.PopulateFromARM(owner, *typedInput.GrantTypes)
		if err != nil {
			return err
		}
		grantTypes := grantTypes1
		settings.GrantTypes = &grantTypes
	}

	// Set property "RedirectUrl":
	if typedInput.RedirectUrl != nil {
		redirectUrl := *typedInput.RedirectUrl
		settings.RedirectUrl = &redirectUrl
	}

	// No error
	return nil
}

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

	// GrantTypes
	if source.GrantTypes != nil {
		var grantType AuthorizationProviderOAuth2GrantTypes_STATUS
		err := grantType.AssignProperties_From_AuthorizationProviderOAuth2GrantTypes_STATUS(source.GrantTypes)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_AuthorizationProviderOAuth2GrantTypes_STATUS() to populate field GrantTypes")
		}
		settings.GrantTypes = &grantType
	} else {
		settings.GrantTypes = nil
	}

	// RedirectUrl
	settings.RedirectUrl = genruntime.ClonePointerToString(source.RedirectUrl)

	// No error
	return nil
}

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

	// GrantTypes
	if settings.GrantTypes != nil {
		var grantType storage.AuthorizationProviderOAuth2GrantTypes_STATUS
		err := settings.GrantTypes.AssignProperties_To_AuthorizationProviderOAuth2GrantTypes_STATUS(&grantType)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_AuthorizationProviderOAuth2GrantTypes_STATUS() to populate field GrantTypes")
		}
		destination.GrantTypes = &grantType
	} else {
		destination.GrantTypes = nil
	}

	// RedirectUrl
	destination.RedirectUrl = genruntime.ClonePointerToString(settings.RedirectUrl)

	// 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 AuthorizationProviderOperatorSpec 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_AuthorizationProviderOperatorSpec populates our AuthorizationProviderOperatorSpec from the provided source AuthorizationProviderOperatorSpec
func (operator *AuthorizationProviderOperatorSpec) AssignProperties_From_AuthorizationProviderOperatorSpec(source *storage.AuthorizationProviderOperatorSpec) 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_AuthorizationProviderOperatorSpec populates the provided destination AuthorizationProviderOperatorSpec from our AuthorizationProviderOperatorSpec
func (operator *AuthorizationProviderOperatorSpec) AssignProperties_To_AuthorizationProviderOperatorSpec(destination *storage.AuthorizationProviderOperatorSpec) 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
}

// Authorization Provider oauth2 grant types settings
type AuthorizationProviderOAuth2GrantTypes struct {
	// AuthorizationCode: OAuth2 authorization code grant parameters
	AuthorizationCode *genruntime.SecretMapReference `json:"authorizationCode,omitempty"`

	// ClientCredentials: OAuth2 client credential grant parameters
	ClientCredentials *genruntime.SecretMapReference `json:"clientCredentials,omitempty"`
}

var _ genruntime.ARMTransformer = &AuthorizationProviderOAuth2GrantTypes{}

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

	// Set property "AuthorizationCode":
	if types.AuthorizationCode != nil {
		var temp map[string]string
		tempSecret, err := resolved.ResolvedSecretMaps.Lookup(*types.AuthorizationCode)
		if err != nil {
			return nil, eris.Wrap(err, "looking up secret for property temp")
		}
		temp = tempSecret
		result.AuthorizationCode = temp
	}

	// Set property "ClientCredentials":
	if types.ClientCredentials != nil {
		var temp map[string]string
		tempSecret, err := resolved.ResolvedSecretMaps.Lookup(*types.ClientCredentials)
		if err != nil {
			return nil, eris.Wrap(err, "looking up secret for property temp")
		}
		temp = tempSecret
		result.ClientCredentials = temp
	}
	return result, nil
}

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

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

	// no assignment for property "AuthorizationCode"

	// no assignment for property "ClientCredentials"

	// No error
	return nil
}

// AssignProperties_From_AuthorizationProviderOAuth2GrantTypes populates our AuthorizationProviderOAuth2GrantTypes from the provided source AuthorizationProviderOAuth2GrantTypes
func (types *AuthorizationProviderOAuth2GrantTypes) AssignProperties_From_AuthorizationProviderOAuth2GrantTypes(source *storage.AuthorizationProviderOAuth2GrantTypes) error {

	// AuthorizationCode
	if source.AuthorizationCode != nil {
		authorizationCode := source.AuthorizationCode.Copy()
		types.AuthorizationCode = &authorizationCode
	} else {
		types.AuthorizationCode = nil
	}

	// ClientCredentials
	if source.ClientCredentials != nil {
		clientCredential := source.ClientCredentials.Copy()
		types.ClientCredentials = &clientCredential
	} else {
		types.ClientCredentials = nil
	}

	// No error
	return nil
}

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

	// AuthorizationCode
	if types.AuthorizationCode != nil {
		authorizationCode := types.AuthorizationCode.Copy()
		destination.AuthorizationCode = &authorizationCode
	} else {
		destination.AuthorizationCode = nil
	}

	// ClientCredentials
	if types.ClientCredentials != nil {
		clientCredential := types.ClientCredentials.Copy()
		destination.ClientCredentials = &clientCredential
	} else {
		destination.ClientCredentials = nil
	}

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

	// No error
	return nil
}

// Authorization Provider oauth2 grant types settings
type AuthorizationProviderOAuth2GrantTypes_STATUS struct {
	// AuthorizationCode: OAuth2 authorization code grant parameters
	AuthorizationCode map[string]string `json:"authorizationCode,omitempty"`

	// ClientCredentials: OAuth2 client credential grant parameters
	ClientCredentials map[string]string `json:"clientCredentials,omitempty"`
}

var _ genruntime.FromARMConverter = &AuthorizationProviderOAuth2GrantTypes_STATUS{}

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

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

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

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

	// No error
	return nil
}

// AssignProperties_From_AuthorizationProviderOAuth2GrantTypes_STATUS populates our AuthorizationProviderOAuth2GrantTypes_STATUS from the provided source AuthorizationProviderOAuth2GrantTypes_STATUS
func (types *AuthorizationProviderOAuth2GrantTypes_STATUS) AssignProperties_From_AuthorizationProviderOAuth2GrantTypes_STATUS(source *storage.AuthorizationProviderOAuth2GrantTypes_STATUS) error {

	// AuthorizationCode
	types.AuthorizationCode = genruntime.CloneMapOfStringToString(source.AuthorizationCode)

	// ClientCredentials
	types.ClientCredentials = genruntime.CloneMapOfStringToString(source.ClientCredentials)

	// No error
	return nil
}

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

	// AuthorizationCode
	destination.AuthorizationCode = genruntime.CloneMapOfStringToString(types.AuthorizationCode)

	// ClientCredentials
	destination.ClientCredentials = genruntime.CloneMapOfStringToString(types.ClientCredentials)

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

	// No error
	return nil
}

func init() {
	SchemeBuilder.Register(&AuthorizationProvider{}, &AuthorizationProviderList{})
}
