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

import (
	"context"
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/insights/v1api20200202/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/insights/v1api20200202/storage"
	"github.com/Azure/azure-service-operator/v2/internal/genericarmclient"
	"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/go-logr/logr"
	"github.com/rotisserie/eris"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"sigs.k8s.io/controller-runtime/pkg/client"
	"sigs.k8s.io/controller-runtime/pkg/conversion"
)

// +kubebuilder:object:root=true
// +kubebuilder:resource:categories={azure,insights}
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="Severity",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].severity"
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message"
// Generator information:
// - Generated from: /applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/components_API.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}
type Component struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              Component_Spec   `json:"spec,omitempty"`
	Status            Component_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &Component{}

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

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

var _ conversion.Convertible = &Component{}

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

	return component.AssignProperties_From_Component(source)
}

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

	return component.AssignProperties_To_Component(destination)
}

var _ configmaps.Exporter = &Component{}

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

var _ secrets.Exporter = &Component{}

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

var _ genruntime.ImportableResource = &Component{}

// InitializeSpec initializes the spec for this resource from the given status
func (component *Component) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*Component_STATUS); ok {
		return component.Spec.Initialize_From_Component_STATUS(s)
	}

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

var _ genruntime.KubernetesConfigExporter = &Component{}

// ExportKubernetesConfigMaps defines a resource which can create ConfigMaps in Kubernetes.
func (component *Component) ExportKubernetesConfigMaps(_ context.Context, _ genruntime.MetaObject, _ *genericarmclient.GenericClient, _ logr.Logger) ([]client.Object, error) {
	collector := configmaps.NewCollector(component.Namespace)
	if component.Spec.OperatorSpec != nil && component.Spec.OperatorSpec.ConfigMaps != nil {
		if component.Status.ConnectionString != nil {
			collector.AddValue(component.Spec.OperatorSpec.ConfigMaps.ConnectionString, *component.Status.ConnectionString)
		}
	}
	if component.Spec.OperatorSpec != nil && component.Spec.OperatorSpec.ConfigMaps != nil {
		if component.Status.InstrumentationKey != nil {
			collector.AddValue(component.Spec.OperatorSpec.ConfigMaps.InstrumentationKey, *component.Status.InstrumentationKey)
		}
	}
	result, err := collector.Values()
	if err != nil {
		return nil, err
	}
	return configmaps.SliceToClientObjectSlice(result), nil
}

var _ genruntime.KubernetesResource = &Component{}

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

// GetAPIVersion returns the ARM API version of the resource. This is always "2020-02-02"
func (component Component) GetAPIVersion() string {
	return "2020-02-02"
}

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.Insights/components"
func (component *Component) GetType() string {
	return "Microsoft.Insights/components"
}

// NewEmptyStatus returns a new empty (blank) status
func (component *Component) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &Component_STATUS{}
}

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

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

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

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

	component.Status = st
	return nil
}

// AssignProperties_From_Component populates our Component from the provided source Component
func (component *Component) AssignProperties_From_Component(source *storage.Component) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_Component populates the provided destination Component from our Component
func (component *Component) AssignProperties_To_Component(destination *storage.Component) error {

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/components_API.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}
type ComponentList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Component `json:"items"`
}

// +kubebuilder:validation:Enum={"2020-02-02"}
type APIVersion string

const APIVersion_Value = APIVersion("2020-02-02")

type Component_Spec struct {
	// +kubebuilder:validation:Required
	// Application_Type: Type of application being monitored.
	Application_Type *ApplicationInsightsComponentProperties_Application_Type `json:"Application_Type,omitempty"`

	// 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"`

	// DisableIpMasking: Disable IP masking.
	DisableIpMasking *bool `json:"DisableIpMasking,omitempty"`

	// DisableLocalAuth: Disable Non-AAD based Auth.
	DisableLocalAuth *bool `json:"DisableLocalAuth,omitempty"`

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

	// Flow_Type: Used by the Application Insights system to determine what kind of flow this component was created by. This is
	// to be set to 'Bluefield' when creating/updating a component via the REST API.
	Flow_Type *ApplicationInsightsComponentProperties_Flow_Type `json:"Flow_Type,omitempty"`

	// ForceCustomerStorageForProfiler: Force users to create their own storage account for profiler and debugger.
	ForceCustomerStorageForProfiler *bool `json:"ForceCustomerStorageForProfiler,omitempty"`

	// HockeyAppId: The unique application ID created when a new application is added to HockeyApp, used for communications
	// with HockeyApp.
	HockeyAppId *string `json:"HockeyAppId,omitempty"`

	// ImmediatePurgeDataOn30Days: Purge data immediately after 30 days.
	ImmediatePurgeDataOn30Days *bool `json:"ImmediatePurgeDataOn30Days,omitempty"`

	// IngestionMode: Indicates the flow of the ingestion.
	IngestionMode *ApplicationInsightsComponentProperties_IngestionMode `json:"IngestionMode,omitempty"`

	// +kubebuilder:validation:Required
	// Kind: The kind of application that this component refers to, used to customize UI. This value is a freeform string,
	// values should typically be one of the following: web, ios, other, store, java, phone.
	Kind *string `json:"kind,omitempty"`

	// +kubebuilder:validation:Required
	// Location: Resource location
	Location *string `json:"location,omitempty"`

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

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

	// PublicNetworkAccessForIngestion: The network access type for accessing Application Insights ingestion.
	PublicNetworkAccessForIngestion *PublicNetworkAccessType `json:"publicNetworkAccessForIngestion,omitempty"`

	// PublicNetworkAccessForQuery: The network access type for accessing Application Insights query.
	PublicNetworkAccessForQuery *PublicNetworkAccessType `json:"publicNetworkAccessForQuery,omitempty"`

	// Request_Source: Describes what tool created this Application Insights component. Customers using this API should set
	// this to the default 'rest'.
	Request_Source *ApplicationInsightsComponentProperties_Request_Source `json:"Request_Source,omitempty"`

	// RetentionInDays: Retention period in days.
	RetentionInDays *int `json:"RetentionInDays,omitempty"`

	// SamplingPercentage: Percentage of the data produced by the application being monitored that is being sampled for
	// Application Insights telemetry.
	SamplingPercentage *float64 `json:"SamplingPercentage,omitempty"`

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

	// WorkspaceResourceReference: Resource Id of the log analytics workspace which the data will be ingested to. This property
	// is required to create an application with this API version. Applications from older versions will not have this property.
	WorkspaceResourceReference *genruntime.ResourceReference `armReference:"WorkspaceResourceId" json:"workspaceResourceReference,omitempty"`
}

var _ genruntime.ARMTransformer = &Component_Spec{}

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

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

	// Set property "Kind":
	if component.Kind != nil {
		kind := *component.Kind
		result.Kind = &kind
	}

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

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

	// Set property "Properties":
	if component.Application_Type != nil ||
		component.DisableIpMasking != nil ||
		component.DisableLocalAuth != nil ||
		component.Flow_Type != nil ||
		component.ForceCustomerStorageForProfiler != nil ||
		component.HockeyAppId != nil ||
		component.ImmediatePurgeDataOn30Days != nil ||
		component.IngestionMode != nil ||
		component.PublicNetworkAccessForIngestion != nil ||
		component.PublicNetworkAccessForQuery != nil ||
		component.Request_Source != nil ||
		component.RetentionInDays != nil ||
		component.SamplingPercentage != nil ||
		component.WorkspaceResourceReference != nil {
		result.Properties = &arm.ApplicationInsightsComponentProperties{}
	}
	if component.Application_Type != nil {
		var temp string
		temp = string(*component.Application_Type)
		applicationType := arm.ApplicationInsightsComponentProperties_Application_Type(temp)
		result.Properties.Application_Type = &applicationType
	}
	if component.DisableIpMasking != nil {
		disableIpMasking := *component.DisableIpMasking
		result.Properties.DisableIpMasking = &disableIpMasking
	}
	if component.DisableLocalAuth != nil {
		disableLocalAuth := *component.DisableLocalAuth
		result.Properties.DisableLocalAuth = &disableLocalAuth
	}
	if component.Flow_Type != nil {
		var temp string
		temp = string(*component.Flow_Type)
		flowType := arm.ApplicationInsightsComponentProperties_Flow_Type(temp)
		result.Properties.Flow_Type = &flowType
	}
	if component.ForceCustomerStorageForProfiler != nil {
		forceCustomerStorageForProfiler := *component.ForceCustomerStorageForProfiler
		result.Properties.ForceCustomerStorageForProfiler = &forceCustomerStorageForProfiler
	}
	if component.HockeyAppId != nil {
		hockeyAppId := *component.HockeyAppId
		result.Properties.HockeyAppId = &hockeyAppId
	}
	if component.ImmediatePurgeDataOn30Days != nil {
		immediatePurgeDataOn30Days := *component.ImmediatePurgeDataOn30Days
		result.Properties.ImmediatePurgeDataOn30Days = &immediatePurgeDataOn30Days
	}
	if component.IngestionMode != nil {
		var temp string
		temp = string(*component.IngestionMode)
		ingestionMode := arm.ApplicationInsightsComponentProperties_IngestionMode(temp)
		result.Properties.IngestionMode = &ingestionMode
	}
	if component.PublicNetworkAccessForIngestion != nil {
		var temp string
		temp = string(*component.PublicNetworkAccessForIngestion)
		publicNetworkAccessForIngestion := arm.PublicNetworkAccessType(temp)
		result.Properties.PublicNetworkAccessForIngestion = &publicNetworkAccessForIngestion
	}
	if component.PublicNetworkAccessForQuery != nil {
		var temp string
		temp = string(*component.PublicNetworkAccessForQuery)
		publicNetworkAccessForQuery := arm.PublicNetworkAccessType(temp)
		result.Properties.PublicNetworkAccessForQuery = &publicNetworkAccessForQuery
	}
	if component.Request_Source != nil {
		var temp string
		temp = string(*component.Request_Source)
		requestSource := arm.ApplicationInsightsComponentProperties_Request_Source(temp)
		result.Properties.Request_Source = &requestSource
	}
	if component.RetentionInDays != nil {
		retentionInDays := *component.RetentionInDays
		result.Properties.RetentionInDays = &retentionInDays
	}
	if component.SamplingPercentage != nil {
		samplingPercentage := *component.SamplingPercentage
		result.Properties.SamplingPercentage = &samplingPercentage
	}
	if component.WorkspaceResourceReference != nil {
		workspaceResourceIdARMID, err := resolved.ResolvedReferences.Lookup(*component.WorkspaceResourceReference)
		if err != nil {
			return nil, err
		}
		workspaceResourceId := workspaceResourceIdARMID
		result.Properties.WorkspaceResourceId = &workspaceResourceId
	}

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

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

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

	// Set property "Application_Type":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Application_Type != nil {
			var temp string
			temp = string(*typedInput.Properties.Application_Type)
			applicationType := ApplicationInsightsComponentProperties_Application_Type(temp)
			component.Application_Type = &applicationType
		}
	}

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

	// Set property "DisableIpMasking":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DisableIpMasking != nil {
			disableIpMasking := *typedInput.Properties.DisableIpMasking
			component.DisableIpMasking = &disableIpMasking
		}
	}

	// Set property "DisableLocalAuth":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DisableLocalAuth != nil {
			disableLocalAuth := *typedInput.Properties.DisableLocalAuth
			component.DisableLocalAuth = &disableLocalAuth
		}
	}

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

	// Set property "Flow_Type":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Flow_Type != nil {
			var temp string
			temp = string(*typedInput.Properties.Flow_Type)
			flowType := ApplicationInsightsComponentProperties_Flow_Type(temp)
			component.Flow_Type = &flowType
		}
	}

	// Set property "ForceCustomerStorageForProfiler":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ForceCustomerStorageForProfiler != nil {
			forceCustomerStorageForProfiler := *typedInput.Properties.ForceCustomerStorageForProfiler
			component.ForceCustomerStorageForProfiler = &forceCustomerStorageForProfiler
		}
	}

	// Set property "HockeyAppId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.HockeyAppId != nil {
			hockeyAppId := *typedInput.Properties.HockeyAppId
			component.HockeyAppId = &hockeyAppId
		}
	}

	// Set property "ImmediatePurgeDataOn30Days":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ImmediatePurgeDataOn30Days != nil {
			immediatePurgeDataOn30Days := *typedInput.Properties.ImmediatePurgeDataOn30Days
			component.ImmediatePurgeDataOn30Days = &immediatePurgeDataOn30Days
		}
	}

	// Set property "IngestionMode":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IngestionMode != nil {
			var temp string
			temp = string(*typedInput.Properties.IngestionMode)
			ingestionMode := ApplicationInsightsComponentProperties_IngestionMode(temp)
			component.IngestionMode = &ingestionMode
		}
	}

	// Set property "Kind":
	if typedInput.Kind != nil {
		kind := *typedInput.Kind
		component.Kind = &kind
	}

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

	// no assignment for property "OperatorSpec"

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

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

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

	// Set property "Request_Source":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Request_Source != nil {
			var temp string
			temp = string(*typedInput.Properties.Request_Source)
			requestSource := ApplicationInsightsComponentProperties_Request_Source(temp)
			component.Request_Source = &requestSource
		}
	}

	// Set property "RetentionInDays":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RetentionInDays != nil {
			retentionInDays := *typedInput.Properties.RetentionInDays
			component.RetentionInDays = &retentionInDays
		}
	}

	// Set property "SamplingPercentage":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SamplingPercentage != nil {
			samplingPercentage := *typedInput.Properties.SamplingPercentage
			component.SamplingPercentage = &samplingPercentage
		}
	}

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

	// no assignment for property "WorkspaceResourceReference"

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &Component_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.Component_Spec{}
	err := component.AssignProperties_To_Component_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_Component_Spec populates our Component_Spec from the provided source Component_Spec
func (component *Component_Spec) AssignProperties_From_Component_Spec(source *storage.Component_Spec) error {

	// Application_Type
	if source.Application_Type != nil {
		applicationType := *source.Application_Type
		applicationTypeTemp := genruntime.ToEnum(applicationType, applicationInsightsComponentProperties_Application_Type_Values)
		component.Application_Type = &applicationTypeTemp
	} else {
		component.Application_Type = nil
	}

	// AzureName
	component.AzureName = source.AzureName

	// DisableIpMasking
	if source.DisableIpMasking != nil {
		disableIpMasking := *source.DisableIpMasking
		component.DisableIpMasking = &disableIpMasking
	} else {
		component.DisableIpMasking = nil
	}

	// DisableLocalAuth
	if source.DisableLocalAuth != nil {
		disableLocalAuth := *source.DisableLocalAuth
		component.DisableLocalAuth = &disableLocalAuth
	} else {
		component.DisableLocalAuth = nil
	}

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

	// Flow_Type
	if source.Flow_Type != nil {
		flowType := *source.Flow_Type
		flowTypeTemp := genruntime.ToEnum(flowType, applicationInsightsComponentProperties_Flow_Type_Values)
		component.Flow_Type = &flowTypeTemp
	} else {
		component.Flow_Type = nil
	}

	// ForceCustomerStorageForProfiler
	if source.ForceCustomerStorageForProfiler != nil {
		forceCustomerStorageForProfiler := *source.ForceCustomerStorageForProfiler
		component.ForceCustomerStorageForProfiler = &forceCustomerStorageForProfiler
	} else {
		component.ForceCustomerStorageForProfiler = nil
	}

	// HockeyAppId
	component.HockeyAppId = genruntime.ClonePointerToString(source.HockeyAppId)

	// ImmediatePurgeDataOn30Days
	if source.ImmediatePurgeDataOn30Days != nil {
		immediatePurgeDataOn30Day := *source.ImmediatePurgeDataOn30Days
		component.ImmediatePurgeDataOn30Days = &immediatePurgeDataOn30Day
	} else {
		component.ImmediatePurgeDataOn30Days = nil
	}

	// IngestionMode
	if source.IngestionMode != nil {
		ingestionMode := *source.IngestionMode
		ingestionModeTemp := genruntime.ToEnum(ingestionMode, applicationInsightsComponentProperties_IngestionMode_Values)
		component.IngestionMode = &ingestionModeTemp
	} else {
		component.IngestionMode = nil
	}

	// Kind
	component.Kind = genruntime.ClonePointerToString(source.Kind)

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

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

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

	// PublicNetworkAccessForIngestion
	if source.PublicNetworkAccessForIngestion != nil {
		publicNetworkAccessForIngestion := *source.PublicNetworkAccessForIngestion
		publicNetworkAccessForIngestionTemp := genruntime.ToEnum(publicNetworkAccessForIngestion, publicNetworkAccessType_Values)
		component.PublicNetworkAccessForIngestion = &publicNetworkAccessForIngestionTemp
	} else {
		component.PublicNetworkAccessForIngestion = nil
	}

	// PublicNetworkAccessForQuery
	if source.PublicNetworkAccessForQuery != nil {
		publicNetworkAccessForQuery := *source.PublicNetworkAccessForQuery
		publicNetworkAccessForQueryTemp := genruntime.ToEnum(publicNetworkAccessForQuery, publicNetworkAccessType_Values)
		component.PublicNetworkAccessForQuery = &publicNetworkAccessForQueryTemp
	} else {
		component.PublicNetworkAccessForQuery = nil
	}

	// Request_Source
	if source.Request_Source != nil {
		requestSource := *source.Request_Source
		requestSourceTemp := genruntime.ToEnum(requestSource, applicationInsightsComponentProperties_Request_Source_Values)
		component.Request_Source = &requestSourceTemp
	} else {
		component.Request_Source = nil
	}

	// RetentionInDays
	component.RetentionInDays = genruntime.ClonePointerToInt(source.RetentionInDays)

	// SamplingPercentage
	if source.SamplingPercentage != nil {
		samplingPercentage := *source.SamplingPercentage
		component.SamplingPercentage = &samplingPercentage
	} else {
		component.SamplingPercentage = nil
	}

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

	// WorkspaceResourceReference
	if source.WorkspaceResourceReference != nil {
		workspaceResourceReference := source.WorkspaceResourceReference.Copy()
		component.WorkspaceResourceReference = &workspaceResourceReference
	} else {
		component.WorkspaceResourceReference = nil
	}

	// No error
	return nil
}

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

	// Application_Type
	if component.Application_Type != nil {
		applicationType := string(*component.Application_Type)
		destination.Application_Type = &applicationType
	} else {
		destination.Application_Type = nil
	}

	// AzureName
	destination.AzureName = component.AzureName

	// DisableIpMasking
	if component.DisableIpMasking != nil {
		disableIpMasking := *component.DisableIpMasking
		destination.DisableIpMasking = &disableIpMasking
	} else {
		destination.DisableIpMasking = nil
	}

	// DisableLocalAuth
	if component.DisableLocalAuth != nil {
		disableLocalAuth := *component.DisableLocalAuth
		destination.DisableLocalAuth = &disableLocalAuth
	} else {
		destination.DisableLocalAuth = nil
	}

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

	// Flow_Type
	if component.Flow_Type != nil {
		flowType := string(*component.Flow_Type)
		destination.Flow_Type = &flowType
	} else {
		destination.Flow_Type = nil
	}

	// ForceCustomerStorageForProfiler
	if component.ForceCustomerStorageForProfiler != nil {
		forceCustomerStorageForProfiler := *component.ForceCustomerStorageForProfiler
		destination.ForceCustomerStorageForProfiler = &forceCustomerStorageForProfiler
	} else {
		destination.ForceCustomerStorageForProfiler = nil
	}

	// HockeyAppId
	destination.HockeyAppId = genruntime.ClonePointerToString(component.HockeyAppId)

	// ImmediatePurgeDataOn30Days
	if component.ImmediatePurgeDataOn30Days != nil {
		immediatePurgeDataOn30Day := *component.ImmediatePurgeDataOn30Days
		destination.ImmediatePurgeDataOn30Days = &immediatePurgeDataOn30Day
	} else {
		destination.ImmediatePurgeDataOn30Days = nil
	}

	// IngestionMode
	if component.IngestionMode != nil {
		ingestionMode := string(*component.IngestionMode)
		destination.IngestionMode = &ingestionMode
	} else {
		destination.IngestionMode = nil
	}

	// Kind
	destination.Kind = genruntime.ClonePointerToString(component.Kind)

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

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

	// OriginalVersion
	destination.OriginalVersion = component.OriginalVersion()

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

	// PublicNetworkAccessForIngestion
	if component.PublicNetworkAccessForIngestion != nil {
		publicNetworkAccessForIngestion := string(*component.PublicNetworkAccessForIngestion)
		destination.PublicNetworkAccessForIngestion = &publicNetworkAccessForIngestion
	} else {
		destination.PublicNetworkAccessForIngestion = nil
	}

	// PublicNetworkAccessForQuery
	if component.PublicNetworkAccessForQuery != nil {
		publicNetworkAccessForQuery := string(*component.PublicNetworkAccessForQuery)
		destination.PublicNetworkAccessForQuery = &publicNetworkAccessForQuery
	} else {
		destination.PublicNetworkAccessForQuery = nil
	}

	// Request_Source
	if component.Request_Source != nil {
		requestSource := string(*component.Request_Source)
		destination.Request_Source = &requestSource
	} else {
		destination.Request_Source = nil
	}

	// RetentionInDays
	destination.RetentionInDays = genruntime.ClonePointerToInt(component.RetentionInDays)

	// SamplingPercentage
	if component.SamplingPercentage != nil {
		samplingPercentage := *component.SamplingPercentage
		destination.SamplingPercentage = &samplingPercentage
	} else {
		destination.SamplingPercentage = nil
	}

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

	// WorkspaceResourceReference
	if component.WorkspaceResourceReference != nil {
		workspaceResourceReference := component.WorkspaceResourceReference.Copy()
		destination.WorkspaceResourceReference = &workspaceResourceReference
	} else {
		destination.WorkspaceResourceReference = nil
	}

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

	// No error
	return nil
}

// Initialize_From_Component_STATUS populates our Component_Spec from the provided source Component_STATUS
func (component *Component_Spec) Initialize_From_Component_STATUS(source *Component_STATUS) error {

	// Application_Type
	if source.Application_Type != nil {
		applicationType := genruntime.ToEnum(string(*source.Application_Type), applicationInsightsComponentProperties_Application_Type_Values)
		component.Application_Type = &applicationType
	} else {
		component.Application_Type = nil
	}

	// DisableIpMasking
	if source.DisableIpMasking != nil {
		disableIpMasking := *source.DisableIpMasking
		component.DisableIpMasking = &disableIpMasking
	} else {
		component.DisableIpMasking = nil
	}

	// DisableLocalAuth
	if source.DisableLocalAuth != nil {
		disableLocalAuth := *source.DisableLocalAuth
		component.DisableLocalAuth = &disableLocalAuth
	} else {
		component.DisableLocalAuth = nil
	}

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

	// Flow_Type
	if source.Flow_Type != nil {
		flowType := genruntime.ToEnum(string(*source.Flow_Type), applicationInsightsComponentProperties_Flow_Type_Values)
		component.Flow_Type = &flowType
	} else {
		component.Flow_Type = nil
	}

	// ForceCustomerStorageForProfiler
	if source.ForceCustomerStorageForProfiler != nil {
		forceCustomerStorageForProfiler := *source.ForceCustomerStorageForProfiler
		component.ForceCustomerStorageForProfiler = &forceCustomerStorageForProfiler
	} else {
		component.ForceCustomerStorageForProfiler = nil
	}

	// HockeyAppId
	component.HockeyAppId = genruntime.ClonePointerToString(source.HockeyAppId)

	// ImmediatePurgeDataOn30Days
	if source.ImmediatePurgeDataOn30Days != nil {
		immediatePurgeDataOn30Day := *source.ImmediatePurgeDataOn30Days
		component.ImmediatePurgeDataOn30Days = &immediatePurgeDataOn30Day
	} else {
		component.ImmediatePurgeDataOn30Days = nil
	}

	// IngestionMode
	if source.IngestionMode != nil {
		ingestionMode := genruntime.ToEnum(string(*source.IngestionMode), applicationInsightsComponentProperties_IngestionMode_Values)
		component.IngestionMode = &ingestionMode
	} else {
		component.IngestionMode = nil
	}

	// Kind
	component.Kind = genruntime.ClonePointerToString(source.Kind)

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

	// PublicNetworkAccessForIngestion
	if source.PublicNetworkAccessForIngestion != nil {
		publicNetworkAccessForIngestion := genruntime.ToEnum(string(*source.PublicNetworkAccessForIngestion), publicNetworkAccessType_Values)
		component.PublicNetworkAccessForIngestion = &publicNetworkAccessForIngestion
	} else {
		component.PublicNetworkAccessForIngestion = nil
	}

	// PublicNetworkAccessForQuery
	if source.PublicNetworkAccessForQuery != nil {
		publicNetworkAccessForQuery := genruntime.ToEnum(string(*source.PublicNetworkAccessForQuery), publicNetworkAccessType_Values)
		component.PublicNetworkAccessForQuery = &publicNetworkAccessForQuery
	} else {
		component.PublicNetworkAccessForQuery = nil
	}

	// Request_Source
	if source.Request_Source != nil {
		requestSource := genruntime.ToEnum(string(*source.Request_Source), applicationInsightsComponentProperties_Request_Source_Values)
		component.Request_Source = &requestSource
	} else {
		component.Request_Source = nil
	}

	// RetentionInDays
	component.RetentionInDays = genruntime.ClonePointerToInt(source.RetentionInDays)

	// SamplingPercentage
	if source.SamplingPercentage != nil {
		samplingPercentage := *source.SamplingPercentage
		component.SamplingPercentage = &samplingPercentage
	} else {
		component.SamplingPercentage = nil
	}

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

	// WorkspaceResourceReference
	if source.WorkspaceResourceId != nil {
		workspaceResourceReference := genruntime.CreateResourceReferenceFromARMID(*source.WorkspaceResourceId)
		component.WorkspaceResourceReference = &workspaceResourceReference
	} else {
		component.WorkspaceResourceReference = nil
	}

	// No error
	return nil
}

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

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

type Component_STATUS struct {
	// AppId: Application Insights Unique ID for your Application.
	AppId *string `json:"AppId,omitempty"`

	// ApplicationId: The unique ID of your application. This field mirrors the 'Name' field and cannot be changed.
	ApplicationId *string `json:"ApplicationId,omitempty"`

	// Application_Type: Type of application being monitored.
	Application_Type *ApplicationInsightsComponentProperties_Application_Type_STATUS `json:"Application_Type,omitempty"`

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

	// ConnectionString: Application Insights component connection string.
	ConnectionString *string `json:"ConnectionString,omitempty"`

	// CreationDate: Creation Date for the Application Insights component, in ISO 8601 format.
	CreationDate *string `json:"CreationDate,omitempty"`

	// DisableIpMasking: Disable IP masking.
	DisableIpMasking *bool `json:"DisableIpMasking,omitempty"`

	// DisableLocalAuth: Disable Non-AAD based Auth.
	DisableLocalAuth *bool `json:"DisableLocalAuth,omitempty"`

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

	// Flow_Type: Used by the Application Insights system to determine what kind of flow this component was created by. This is
	// to be set to 'Bluefield' when creating/updating a component via the REST API.
	Flow_Type *ApplicationInsightsComponentProperties_Flow_Type_STATUS `json:"Flow_Type,omitempty"`

	// ForceCustomerStorageForProfiler: Force users to create their own storage account for profiler and debugger.
	ForceCustomerStorageForProfiler *bool `json:"ForceCustomerStorageForProfiler,omitempty"`

	// HockeyAppId: The unique application ID created when a new application is added to HockeyApp, used for communications
	// with HockeyApp.
	HockeyAppId *string `json:"HockeyAppId,omitempty"`

	// HockeyAppToken: Token used to authenticate communications with between Application Insights and HockeyApp.
	HockeyAppToken *string `json:"HockeyAppToken,omitempty"`

	// Id: Azure resource Id
	Id *string `json:"id,omitempty"`

	// ImmediatePurgeDataOn30Days: Purge data immediately after 30 days.
	ImmediatePurgeDataOn30Days *bool `json:"ImmediatePurgeDataOn30Days,omitempty"`

	// IngestionMode: Indicates the flow of the ingestion.
	IngestionMode *ApplicationInsightsComponentProperties_IngestionMode_STATUS `json:"IngestionMode,omitempty"`

	// InstrumentationKey: Application Insights Instrumentation key. A read-only value that applications can use to identify
	// the destination for all telemetry sent to Azure Application Insights. This value will be supplied upon construction of
	// each new Application Insights component.
	InstrumentationKey *string `json:"InstrumentationKey,omitempty"`

	// Kind: The kind of application that this component refers to, used to customize UI. This value is a freeform string,
	// values should typically be one of the following: web, ios, other, store, java, phone.
	Kind *string `json:"kind,omitempty"`

	// LaMigrationDate: The date which the component got migrated to LA, in ISO 8601 format.
	LaMigrationDate *string `json:"LaMigrationDate,omitempty"`

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

	// Name: Azure resource name
	Name *string `json:"name,omitempty"`

	// PrivateLinkScopedResources: List of linked private link scope resources.
	PrivateLinkScopedResources []PrivateLinkScopedResource_STATUS `json:"PrivateLinkScopedResources,omitempty"`

	// PropertiesName: Application name.
	PropertiesName *string `json:"properties_name,omitempty"`

	// ProvisioningState: Current state of this component: whether or not is has been provisioned within the resource group it
	// is defined. Users cannot change this value but are able to read from it. Values will include Succeeded, Deploying,
	// Canceled, and Failed.
	ProvisioningState *string `json:"provisioningState,omitempty"`

	// PublicNetworkAccessForIngestion: The network access type for accessing Application Insights ingestion.
	PublicNetworkAccessForIngestion *PublicNetworkAccessType_STATUS `json:"publicNetworkAccessForIngestion,omitempty"`

	// PublicNetworkAccessForQuery: The network access type for accessing Application Insights query.
	PublicNetworkAccessForQuery *PublicNetworkAccessType_STATUS `json:"publicNetworkAccessForQuery,omitempty"`

	// Request_Source: Describes what tool created this Application Insights component. Customers using this API should set
	// this to the default 'rest'.
	Request_Source *ApplicationInsightsComponentProperties_Request_Source_STATUS `json:"Request_Source,omitempty"`

	// RetentionInDays: Retention period in days.
	RetentionInDays *int `json:"RetentionInDays,omitempty"`

	// SamplingPercentage: Percentage of the data produced by the application being monitored that is being sampled for
	// Application Insights telemetry.
	SamplingPercentage *float64 `json:"SamplingPercentage,omitempty"`

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

	// TenantId: Azure Tenant Id.
	TenantId *string `json:"TenantId,omitempty"`

	// Type: Azure resource type
	Type *string `json:"type,omitempty"`

	// WorkspaceResourceId: Resource Id of the log analytics workspace which the data will be ingested to. This property is
	// required to create an application with this API version. Applications from older versions will not have this property.
	WorkspaceResourceId *string `json:"WorkspaceResourceId,omitempty"`
}

var _ genruntime.ConvertibleStatus = &Component_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.Component_STATUS{}
	err := component.AssignProperties_To_Component_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 = &Component_STATUS{}

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

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

	// Set property "AppId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AppId != nil {
			appId := *typedInput.Properties.AppId
			component.AppId = &appId
		}
	}

	// Set property "ApplicationId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ApplicationId != nil {
			applicationId := *typedInput.Properties.ApplicationId
			component.ApplicationId = &applicationId
		}
	}

	// Set property "Application_Type":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Application_Type != nil {
			var temp string
			temp = string(*typedInput.Properties.Application_Type)
			applicationType := ApplicationInsightsComponentProperties_Application_Type_STATUS(temp)
			component.Application_Type = &applicationType
		}
	}

	// no assignment for property "Conditions"

	// Set property "ConnectionString":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ConnectionString != nil {
			connectionString := *typedInput.Properties.ConnectionString
			component.ConnectionString = &connectionString
		}
	}

	// Set property "CreationDate":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CreationDate != nil {
			creationDate := *typedInput.Properties.CreationDate
			component.CreationDate = &creationDate
		}
	}

	// Set property "DisableIpMasking":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DisableIpMasking != nil {
			disableIpMasking := *typedInput.Properties.DisableIpMasking
			component.DisableIpMasking = &disableIpMasking
		}
	}

	// Set property "DisableLocalAuth":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DisableLocalAuth != nil {
			disableLocalAuth := *typedInput.Properties.DisableLocalAuth
			component.DisableLocalAuth = &disableLocalAuth
		}
	}

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

	// Set property "Flow_Type":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Flow_Type != nil {
			var temp string
			temp = string(*typedInput.Properties.Flow_Type)
			flowType := ApplicationInsightsComponentProperties_Flow_Type_STATUS(temp)
			component.Flow_Type = &flowType
		}
	}

	// Set property "ForceCustomerStorageForProfiler":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ForceCustomerStorageForProfiler != nil {
			forceCustomerStorageForProfiler := *typedInput.Properties.ForceCustomerStorageForProfiler
			component.ForceCustomerStorageForProfiler = &forceCustomerStorageForProfiler
		}
	}

	// Set property "HockeyAppId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.HockeyAppId != nil {
			hockeyAppId := *typedInput.Properties.HockeyAppId
			component.HockeyAppId = &hockeyAppId
		}
	}

	// Set property "HockeyAppToken":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.HockeyAppToken != nil {
			hockeyAppToken := *typedInput.Properties.HockeyAppToken
			component.HockeyAppToken = &hockeyAppToken
		}
	}

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

	// Set property "ImmediatePurgeDataOn30Days":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ImmediatePurgeDataOn30Days != nil {
			immediatePurgeDataOn30Days := *typedInput.Properties.ImmediatePurgeDataOn30Days
			component.ImmediatePurgeDataOn30Days = &immediatePurgeDataOn30Days
		}
	}

	// Set property "IngestionMode":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IngestionMode != nil {
			var temp string
			temp = string(*typedInput.Properties.IngestionMode)
			ingestionMode := ApplicationInsightsComponentProperties_IngestionMode_STATUS(temp)
			component.IngestionMode = &ingestionMode
		}
	}

	// Set property "InstrumentationKey":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.InstrumentationKey != nil {
			instrumentationKey := *typedInput.Properties.InstrumentationKey
			component.InstrumentationKey = &instrumentationKey
		}
	}

	// Set property "Kind":
	if typedInput.Kind != nil {
		kind := *typedInput.Kind
		component.Kind = &kind
	}

	// Set property "LaMigrationDate":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.LaMigrationDate != nil {
			laMigrationDate := *typedInput.Properties.LaMigrationDate
			component.LaMigrationDate = &laMigrationDate
		}
	}

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

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

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

	// Set property "PropertiesName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Name != nil {
			propertiesName := *typedInput.Properties.Name
			component.PropertiesName = &propertiesName
		}
	}

	// Set property "ProvisioningState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ProvisioningState != nil {
			provisioningState := *typedInput.Properties.ProvisioningState
			component.ProvisioningState = &provisioningState
		}
	}

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

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

	// Set property "Request_Source":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Request_Source != nil {
			var temp string
			temp = string(*typedInput.Properties.Request_Source)
			requestSource := ApplicationInsightsComponentProperties_Request_Source_STATUS(temp)
			component.Request_Source = &requestSource
		}
	}

	// Set property "RetentionInDays":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RetentionInDays != nil {
			retentionInDays := *typedInput.Properties.RetentionInDays
			component.RetentionInDays = &retentionInDays
		}
	}

	// Set property "SamplingPercentage":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SamplingPercentage != nil {
			samplingPercentage := *typedInput.Properties.SamplingPercentage
			component.SamplingPercentage = &samplingPercentage
		}
	}

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

	// Set property "TenantId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.TenantId != nil {
			tenantId := *typedInput.Properties.TenantId
			component.TenantId = &tenantId
		}
	}

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

	// Set property "WorkspaceResourceId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.WorkspaceResourceId != nil {
			workspaceResourceId := *typedInput.Properties.WorkspaceResourceId
			component.WorkspaceResourceId = &workspaceResourceId
		}
	}

	// No error
	return nil
}

// AssignProperties_From_Component_STATUS populates our Component_STATUS from the provided source Component_STATUS
func (component *Component_STATUS) AssignProperties_From_Component_STATUS(source *storage.Component_STATUS) error {

	// AppId
	component.AppId = genruntime.ClonePointerToString(source.AppId)

	// ApplicationId
	component.ApplicationId = genruntime.ClonePointerToString(source.ApplicationId)

	// Application_Type
	if source.Application_Type != nil {
		applicationType := *source.Application_Type
		applicationTypeTemp := genruntime.ToEnum(applicationType, applicationInsightsComponentProperties_Application_Type_STATUS_Values)
		component.Application_Type = &applicationTypeTemp
	} else {
		component.Application_Type = nil
	}

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

	// ConnectionString
	component.ConnectionString = genruntime.ClonePointerToString(source.ConnectionString)

	// CreationDate
	component.CreationDate = genruntime.ClonePointerToString(source.CreationDate)

	// DisableIpMasking
	if source.DisableIpMasking != nil {
		disableIpMasking := *source.DisableIpMasking
		component.DisableIpMasking = &disableIpMasking
	} else {
		component.DisableIpMasking = nil
	}

	// DisableLocalAuth
	if source.DisableLocalAuth != nil {
		disableLocalAuth := *source.DisableLocalAuth
		component.DisableLocalAuth = &disableLocalAuth
	} else {
		component.DisableLocalAuth = nil
	}

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

	// Flow_Type
	if source.Flow_Type != nil {
		flowType := *source.Flow_Type
		flowTypeTemp := genruntime.ToEnum(flowType, applicationInsightsComponentProperties_Flow_Type_STATUS_Values)
		component.Flow_Type = &flowTypeTemp
	} else {
		component.Flow_Type = nil
	}

	// ForceCustomerStorageForProfiler
	if source.ForceCustomerStorageForProfiler != nil {
		forceCustomerStorageForProfiler := *source.ForceCustomerStorageForProfiler
		component.ForceCustomerStorageForProfiler = &forceCustomerStorageForProfiler
	} else {
		component.ForceCustomerStorageForProfiler = nil
	}

	// HockeyAppId
	component.HockeyAppId = genruntime.ClonePointerToString(source.HockeyAppId)

	// HockeyAppToken
	component.HockeyAppToken = genruntime.ClonePointerToString(source.HockeyAppToken)

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

	// ImmediatePurgeDataOn30Days
	if source.ImmediatePurgeDataOn30Days != nil {
		immediatePurgeDataOn30Day := *source.ImmediatePurgeDataOn30Days
		component.ImmediatePurgeDataOn30Days = &immediatePurgeDataOn30Day
	} else {
		component.ImmediatePurgeDataOn30Days = nil
	}

	// IngestionMode
	if source.IngestionMode != nil {
		ingestionMode := *source.IngestionMode
		ingestionModeTemp := genruntime.ToEnum(ingestionMode, applicationInsightsComponentProperties_IngestionMode_STATUS_Values)
		component.IngestionMode = &ingestionModeTemp
	} else {
		component.IngestionMode = nil
	}

	// InstrumentationKey
	component.InstrumentationKey = genruntime.ClonePointerToString(source.InstrumentationKey)

	// Kind
	component.Kind = genruntime.ClonePointerToString(source.Kind)

	// LaMigrationDate
	component.LaMigrationDate = genruntime.ClonePointerToString(source.LaMigrationDate)

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

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

	// PrivateLinkScopedResources
	if source.PrivateLinkScopedResources != nil {
		privateLinkScopedResourceList := make([]PrivateLinkScopedResource_STATUS, len(source.PrivateLinkScopedResources))
		for privateLinkScopedResourceIndex, privateLinkScopedResourceItem := range source.PrivateLinkScopedResources {
			var privateLinkScopedResource PrivateLinkScopedResource_STATUS
			err := privateLinkScopedResource.AssignProperties_From_PrivateLinkScopedResource_STATUS(&privateLinkScopedResourceItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_PrivateLinkScopedResource_STATUS() to populate field PrivateLinkScopedResources")
			}
			privateLinkScopedResourceList[privateLinkScopedResourceIndex] = privateLinkScopedResource
		}
		component.PrivateLinkScopedResources = privateLinkScopedResourceList
	} else {
		component.PrivateLinkScopedResources = nil
	}

	// PropertiesName
	component.PropertiesName = genruntime.ClonePointerToString(source.PropertiesName)

	// ProvisioningState
	component.ProvisioningState = genruntime.ClonePointerToString(source.ProvisioningState)

	// PublicNetworkAccessForIngestion
	if source.PublicNetworkAccessForIngestion != nil {
		publicNetworkAccessForIngestion := *source.PublicNetworkAccessForIngestion
		publicNetworkAccessForIngestionTemp := genruntime.ToEnum(publicNetworkAccessForIngestion, publicNetworkAccessType_STATUS_Values)
		component.PublicNetworkAccessForIngestion = &publicNetworkAccessForIngestionTemp
	} else {
		component.PublicNetworkAccessForIngestion = nil
	}

	// PublicNetworkAccessForQuery
	if source.PublicNetworkAccessForQuery != nil {
		publicNetworkAccessForQuery := *source.PublicNetworkAccessForQuery
		publicNetworkAccessForQueryTemp := genruntime.ToEnum(publicNetworkAccessForQuery, publicNetworkAccessType_STATUS_Values)
		component.PublicNetworkAccessForQuery = &publicNetworkAccessForQueryTemp
	} else {
		component.PublicNetworkAccessForQuery = nil
	}

	// Request_Source
	if source.Request_Source != nil {
		requestSource := *source.Request_Source
		requestSourceTemp := genruntime.ToEnum(requestSource, applicationInsightsComponentProperties_Request_Source_STATUS_Values)
		component.Request_Source = &requestSourceTemp
	} else {
		component.Request_Source = nil
	}

	// RetentionInDays
	component.RetentionInDays = genruntime.ClonePointerToInt(source.RetentionInDays)

	// SamplingPercentage
	if source.SamplingPercentage != nil {
		samplingPercentage := *source.SamplingPercentage
		component.SamplingPercentage = &samplingPercentage
	} else {
		component.SamplingPercentage = nil
	}

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

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

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

	// WorkspaceResourceId
	component.WorkspaceResourceId = genruntime.ClonePointerToString(source.WorkspaceResourceId)

	// No error
	return nil
}

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

	// AppId
	destination.AppId = genruntime.ClonePointerToString(component.AppId)

	// ApplicationId
	destination.ApplicationId = genruntime.ClonePointerToString(component.ApplicationId)

	// Application_Type
	if component.Application_Type != nil {
		applicationType := string(*component.Application_Type)
		destination.Application_Type = &applicationType
	} else {
		destination.Application_Type = nil
	}

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

	// ConnectionString
	destination.ConnectionString = genruntime.ClonePointerToString(component.ConnectionString)

	// CreationDate
	destination.CreationDate = genruntime.ClonePointerToString(component.CreationDate)

	// DisableIpMasking
	if component.DisableIpMasking != nil {
		disableIpMasking := *component.DisableIpMasking
		destination.DisableIpMasking = &disableIpMasking
	} else {
		destination.DisableIpMasking = nil
	}

	// DisableLocalAuth
	if component.DisableLocalAuth != nil {
		disableLocalAuth := *component.DisableLocalAuth
		destination.DisableLocalAuth = &disableLocalAuth
	} else {
		destination.DisableLocalAuth = nil
	}

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

	// Flow_Type
	if component.Flow_Type != nil {
		flowType := string(*component.Flow_Type)
		destination.Flow_Type = &flowType
	} else {
		destination.Flow_Type = nil
	}

	// ForceCustomerStorageForProfiler
	if component.ForceCustomerStorageForProfiler != nil {
		forceCustomerStorageForProfiler := *component.ForceCustomerStorageForProfiler
		destination.ForceCustomerStorageForProfiler = &forceCustomerStorageForProfiler
	} else {
		destination.ForceCustomerStorageForProfiler = nil
	}

	// HockeyAppId
	destination.HockeyAppId = genruntime.ClonePointerToString(component.HockeyAppId)

	// HockeyAppToken
	destination.HockeyAppToken = genruntime.ClonePointerToString(component.HockeyAppToken)

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

	// ImmediatePurgeDataOn30Days
	if component.ImmediatePurgeDataOn30Days != nil {
		immediatePurgeDataOn30Day := *component.ImmediatePurgeDataOn30Days
		destination.ImmediatePurgeDataOn30Days = &immediatePurgeDataOn30Day
	} else {
		destination.ImmediatePurgeDataOn30Days = nil
	}

	// IngestionMode
	if component.IngestionMode != nil {
		ingestionMode := string(*component.IngestionMode)
		destination.IngestionMode = &ingestionMode
	} else {
		destination.IngestionMode = nil
	}

	// InstrumentationKey
	destination.InstrumentationKey = genruntime.ClonePointerToString(component.InstrumentationKey)

	// Kind
	destination.Kind = genruntime.ClonePointerToString(component.Kind)

	// LaMigrationDate
	destination.LaMigrationDate = genruntime.ClonePointerToString(component.LaMigrationDate)

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

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

	// PrivateLinkScopedResources
	if component.PrivateLinkScopedResources != nil {
		privateLinkScopedResourceList := make([]storage.PrivateLinkScopedResource_STATUS, len(component.PrivateLinkScopedResources))
		for privateLinkScopedResourceIndex, privateLinkScopedResourceItem := range component.PrivateLinkScopedResources {
			var privateLinkScopedResource storage.PrivateLinkScopedResource_STATUS
			err := privateLinkScopedResourceItem.AssignProperties_To_PrivateLinkScopedResource_STATUS(&privateLinkScopedResource)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_PrivateLinkScopedResource_STATUS() to populate field PrivateLinkScopedResources")
			}
			privateLinkScopedResourceList[privateLinkScopedResourceIndex] = privateLinkScopedResource
		}
		destination.PrivateLinkScopedResources = privateLinkScopedResourceList
	} else {
		destination.PrivateLinkScopedResources = nil
	}

	// PropertiesName
	destination.PropertiesName = genruntime.ClonePointerToString(component.PropertiesName)

	// ProvisioningState
	destination.ProvisioningState = genruntime.ClonePointerToString(component.ProvisioningState)

	// PublicNetworkAccessForIngestion
	if component.PublicNetworkAccessForIngestion != nil {
		publicNetworkAccessForIngestion := string(*component.PublicNetworkAccessForIngestion)
		destination.PublicNetworkAccessForIngestion = &publicNetworkAccessForIngestion
	} else {
		destination.PublicNetworkAccessForIngestion = nil
	}

	// PublicNetworkAccessForQuery
	if component.PublicNetworkAccessForQuery != nil {
		publicNetworkAccessForQuery := string(*component.PublicNetworkAccessForQuery)
		destination.PublicNetworkAccessForQuery = &publicNetworkAccessForQuery
	} else {
		destination.PublicNetworkAccessForQuery = nil
	}

	// Request_Source
	if component.Request_Source != nil {
		requestSource := string(*component.Request_Source)
		destination.Request_Source = &requestSource
	} else {
		destination.Request_Source = nil
	}

	// RetentionInDays
	destination.RetentionInDays = genruntime.ClonePointerToInt(component.RetentionInDays)

	// SamplingPercentage
	if component.SamplingPercentage != nil {
		samplingPercentage := *component.SamplingPercentage
		destination.SamplingPercentage = &samplingPercentage
	} else {
		destination.SamplingPercentage = nil
	}

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

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

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

	// WorkspaceResourceId
	destination.WorkspaceResourceId = genruntime.ClonePointerToString(component.WorkspaceResourceId)

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"other","web"}
type ApplicationInsightsComponentProperties_Application_Type string

const (
	ApplicationInsightsComponentProperties_Application_Type_Other = ApplicationInsightsComponentProperties_Application_Type("other")
	ApplicationInsightsComponentProperties_Application_Type_Web   = ApplicationInsightsComponentProperties_Application_Type("web")
)

// Mapping from string to ApplicationInsightsComponentProperties_Application_Type
var applicationInsightsComponentProperties_Application_Type_Values = map[string]ApplicationInsightsComponentProperties_Application_Type{
	"other": ApplicationInsightsComponentProperties_Application_Type_Other,
	"web":   ApplicationInsightsComponentProperties_Application_Type_Web,
}

type ApplicationInsightsComponentProperties_Application_Type_STATUS string

const (
	ApplicationInsightsComponentProperties_Application_Type_STATUS_Other = ApplicationInsightsComponentProperties_Application_Type_STATUS("other")
	ApplicationInsightsComponentProperties_Application_Type_STATUS_Web   = ApplicationInsightsComponentProperties_Application_Type_STATUS("web")
)

// Mapping from string to ApplicationInsightsComponentProperties_Application_Type_STATUS
var applicationInsightsComponentProperties_Application_Type_STATUS_Values = map[string]ApplicationInsightsComponentProperties_Application_Type_STATUS{
	"other": ApplicationInsightsComponentProperties_Application_Type_STATUS_Other,
	"web":   ApplicationInsightsComponentProperties_Application_Type_STATUS_Web,
}

// +kubebuilder:validation:Enum={"Bluefield"}
type ApplicationInsightsComponentProperties_Flow_Type string

const ApplicationInsightsComponentProperties_Flow_Type_Bluefield = ApplicationInsightsComponentProperties_Flow_Type("Bluefield")

// Mapping from string to ApplicationInsightsComponentProperties_Flow_Type
var applicationInsightsComponentProperties_Flow_Type_Values = map[string]ApplicationInsightsComponentProperties_Flow_Type{
	"bluefield": ApplicationInsightsComponentProperties_Flow_Type_Bluefield,
}

type ApplicationInsightsComponentProperties_Flow_Type_STATUS string

const ApplicationInsightsComponentProperties_Flow_Type_STATUS_Bluefield = ApplicationInsightsComponentProperties_Flow_Type_STATUS("Bluefield")

// Mapping from string to ApplicationInsightsComponentProperties_Flow_Type_STATUS
var applicationInsightsComponentProperties_Flow_Type_STATUS_Values = map[string]ApplicationInsightsComponentProperties_Flow_Type_STATUS{
	"bluefield": ApplicationInsightsComponentProperties_Flow_Type_STATUS_Bluefield,
}

// +kubebuilder:validation:Enum={"ApplicationInsights","ApplicationInsightsWithDiagnosticSettings","LogAnalytics"}
type ApplicationInsightsComponentProperties_IngestionMode string

const (
	ApplicationInsightsComponentProperties_IngestionMode_ApplicationInsights                       = ApplicationInsightsComponentProperties_IngestionMode("ApplicationInsights")
	ApplicationInsightsComponentProperties_IngestionMode_ApplicationInsightsWithDiagnosticSettings = ApplicationInsightsComponentProperties_IngestionMode("ApplicationInsightsWithDiagnosticSettings")
	ApplicationInsightsComponentProperties_IngestionMode_LogAnalytics                              = ApplicationInsightsComponentProperties_IngestionMode("LogAnalytics")
)

// Mapping from string to ApplicationInsightsComponentProperties_IngestionMode
var applicationInsightsComponentProperties_IngestionMode_Values = map[string]ApplicationInsightsComponentProperties_IngestionMode{
	"applicationinsights":                       ApplicationInsightsComponentProperties_IngestionMode_ApplicationInsights,
	"applicationinsightswithdiagnosticsettings": ApplicationInsightsComponentProperties_IngestionMode_ApplicationInsightsWithDiagnosticSettings,
	"loganalytics":                              ApplicationInsightsComponentProperties_IngestionMode_LogAnalytics,
}

type ApplicationInsightsComponentProperties_IngestionMode_STATUS string

const (
	ApplicationInsightsComponentProperties_IngestionMode_STATUS_ApplicationInsights                       = ApplicationInsightsComponentProperties_IngestionMode_STATUS("ApplicationInsights")
	ApplicationInsightsComponentProperties_IngestionMode_STATUS_ApplicationInsightsWithDiagnosticSettings = ApplicationInsightsComponentProperties_IngestionMode_STATUS("ApplicationInsightsWithDiagnosticSettings")
	ApplicationInsightsComponentProperties_IngestionMode_STATUS_LogAnalytics                              = ApplicationInsightsComponentProperties_IngestionMode_STATUS("LogAnalytics")
)

// Mapping from string to ApplicationInsightsComponentProperties_IngestionMode_STATUS
var applicationInsightsComponentProperties_IngestionMode_STATUS_Values = map[string]ApplicationInsightsComponentProperties_IngestionMode_STATUS{
	"applicationinsights":                       ApplicationInsightsComponentProperties_IngestionMode_STATUS_ApplicationInsights,
	"applicationinsightswithdiagnosticsettings": ApplicationInsightsComponentProperties_IngestionMode_STATUS_ApplicationInsightsWithDiagnosticSettings,
	"loganalytics":                              ApplicationInsightsComponentProperties_IngestionMode_STATUS_LogAnalytics,
}

// +kubebuilder:validation:Enum={"rest"}
type ApplicationInsightsComponentProperties_Request_Source string

const ApplicationInsightsComponentProperties_Request_Source_Rest = ApplicationInsightsComponentProperties_Request_Source("rest")

// Mapping from string to ApplicationInsightsComponentProperties_Request_Source
var applicationInsightsComponentProperties_Request_Source_Values = map[string]ApplicationInsightsComponentProperties_Request_Source{
	"rest": ApplicationInsightsComponentProperties_Request_Source_Rest,
}

type ApplicationInsightsComponentProperties_Request_Source_STATUS string

const ApplicationInsightsComponentProperties_Request_Source_STATUS_Rest = ApplicationInsightsComponentProperties_Request_Source_STATUS("rest")

// Mapping from string to ApplicationInsightsComponentProperties_Request_Source_STATUS
var applicationInsightsComponentProperties_Request_Source_STATUS_Values = map[string]ApplicationInsightsComponentProperties_Request_Source_STATUS{
	"rest": ApplicationInsightsComponentProperties_Request_Source_STATUS_Rest,
}

// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure
type ComponentOperatorSpec struct {
	// ConfigMapExpressions: configures where to place operator written dynamic ConfigMaps (created with CEL expressions).
	ConfigMapExpressions []*core.DestinationExpression `json:"configMapExpressions,omitempty"`

	// ConfigMaps: configures where to place operator written ConfigMaps.
	ConfigMaps *ComponentOperatorConfigMaps `json:"configMaps,omitempty"`

	// SecretExpressions: configures where to place operator written dynamic secrets (created with CEL expressions).
	SecretExpressions []*core.DestinationExpression `json:"secretExpressions,omitempty"`
}

// AssignProperties_From_ComponentOperatorSpec populates our ComponentOperatorSpec from the provided source ComponentOperatorSpec
func (operator *ComponentOperatorSpec) AssignProperties_From_ComponentOperatorSpec(source *storage.ComponentOperatorSpec) 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
	}

	// ConfigMaps
	if source.ConfigMaps != nil {
		var configMap ComponentOperatorConfigMaps
		err := configMap.AssignProperties_From_ComponentOperatorConfigMaps(source.ConfigMaps)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ComponentOperatorConfigMaps() to populate field ConfigMaps")
		}
		operator.ConfigMaps = &configMap
	} else {
		operator.ConfigMaps = 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_ComponentOperatorSpec populates the provided destination ComponentOperatorSpec from our ComponentOperatorSpec
func (operator *ComponentOperatorSpec) AssignProperties_To_ComponentOperatorSpec(destination *storage.ComponentOperatorSpec) 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
	}

	// ConfigMaps
	if operator.ConfigMaps != nil {
		var configMap storage.ComponentOperatorConfigMaps
		err := operator.ConfigMaps.AssignProperties_To_ComponentOperatorConfigMaps(&configMap)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ComponentOperatorConfigMaps() to populate field ConfigMaps")
		}
		destination.ConfigMaps = &configMap
	} else {
		destination.ConfigMaps = 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
}

// The private link scope resource reference.
type PrivateLinkScopedResource_STATUS struct {
	// ResourceId: The full resource Id of the private link scope resource.
	ResourceId *string `json:"ResourceId,omitempty"`

	// ScopeId: The private link scope unique Identifier.
	ScopeId *string `json:"ScopeId,omitempty"`
}

var _ genruntime.FromARMConverter = &PrivateLinkScopedResource_STATUS{}

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

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

	// Set property "ResourceId":
	if typedInput.ResourceId != nil {
		resourceId := *typedInput.ResourceId
		resource.ResourceId = &resourceId
	}

	// Set property "ScopeId":
	if typedInput.ScopeId != nil {
		scopeId := *typedInput.ScopeId
		resource.ScopeId = &scopeId
	}

	// No error
	return nil
}

// AssignProperties_From_PrivateLinkScopedResource_STATUS populates our PrivateLinkScopedResource_STATUS from the provided source PrivateLinkScopedResource_STATUS
func (resource *PrivateLinkScopedResource_STATUS) AssignProperties_From_PrivateLinkScopedResource_STATUS(source *storage.PrivateLinkScopedResource_STATUS) error {

	// ResourceId
	resource.ResourceId = genruntime.ClonePointerToString(source.ResourceId)

	// ScopeId
	resource.ScopeId = genruntime.ClonePointerToString(source.ScopeId)

	// No error
	return nil
}

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

	// ResourceId
	destination.ResourceId = genruntime.ClonePointerToString(resource.ResourceId)

	// ScopeId
	destination.ScopeId = genruntime.ClonePointerToString(resource.ScopeId)

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

	// No error
	return nil
}

// The network access type for operating on the Application Insights Component. By default it is Enabled
// +kubebuilder:validation:Enum={"Disabled","Enabled"}
type PublicNetworkAccessType string

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

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

// The network access type for operating on the Application Insights Component. By default it is Enabled
type PublicNetworkAccessType_STATUS string

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

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

type ComponentOperatorConfigMaps struct {
	// ConnectionString: indicates where the ConnectionString config map should be placed. If omitted, no config map will be
	// created.
	ConnectionString *genruntime.ConfigMapDestination `json:"connectionString,omitempty"`

	// InstrumentationKey: indicates where the InstrumentationKey config map should be placed. If omitted, no config map will
	// be created.
	InstrumentationKey *genruntime.ConfigMapDestination `json:"instrumentationKey,omitempty"`
}

// AssignProperties_From_ComponentOperatorConfigMaps populates our ComponentOperatorConfigMaps from the provided source ComponentOperatorConfigMaps
func (maps *ComponentOperatorConfigMaps) AssignProperties_From_ComponentOperatorConfigMaps(source *storage.ComponentOperatorConfigMaps) error {

	// ConnectionString
	if source.ConnectionString != nil {
		connectionString := source.ConnectionString.Copy()
		maps.ConnectionString = &connectionString
	} else {
		maps.ConnectionString = nil
	}

	// InstrumentationKey
	if source.InstrumentationKey != nil {
		instrumentationKey := source.InstrumentationKey.Copy()
		maps.InstrumentationKey = &instrumentationKey
	} else {
		maps.InstrumentationKey = nil
	}

	// No error
	return nil
}

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

	// ConnectionString
	if maps.ConnectionString != nil {
		connectionString := maps.ConnectionString.Copy()
		destination.ConnectionString = &connectionString
	} else {
		destination.ConnectionString = nil
	}

	// InstrumentationKey
	if maps.InstrumentationKey != nil {
		instrumentationKey := maps.InstrumentationKey.Copy()
		destination.InstrumentationKey = &instrumentationKey
	} else {
		destination.InstrumentationKey = nil
	}

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

	// No error
	return nil
}

func init() {
	SchemeBuilder.Register(&Component{}, &ComponentList{})
}
