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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/eventgrid/v1api20200601/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/eventgrid/v1api20200601/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,eventgrid}
// +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: /eventgrid/resource-manager/Microsoft.EventGrid/stable/2020-06-01/EventGrid.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}
type Domain struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              Domain_Spec   `json:"spec,omitempty"`
	Status            Domain_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &Domain{}

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

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

var _ conversion.Convertible = &Domain{}

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

	return domain.AssignProperties_From_Domain(source)
}

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

	return domain.AssignProperties_To_Domain(destination)
}

var _ configmaps.Exporter = &Domain{}

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

var _ secrets.Exporter = &Domain{}

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

var _ genruntime.ImportableResource = &Domain{}

// InitializeSpec initializes the spec for this resource from the given status
func (domain *Domain) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*Domain_STATUS); ok {
		return domain.Spec.Initialize_From_Domain_STATUS(s)
	}

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

var _ genruntime.KubernetesResource = &Domain{}

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

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

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.EventGrid/domains"
func (domain *Domain) GetType() string {
	return "Microsoft.EventGrid/domains"
}

// NewEmptyStatus returns a new empty (blank) status
func (domain *Domain) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &Domain_STATUS{}
}

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

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

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

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

	domain.Status = st
	return nil
}

// AssignProperties_From_Domain populates our Domain from the provided source Domain
func (domain *Domain) AssignProperties_From_Domain(source *storage.Domain) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_Domain populates the provided destination Domain from our Domain
func (domain *Domain) AssignProperties_To_Domain(destination *storage.Domain) error {

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /eventgrid/resource-manager/Microsoft.EventGrid/stable/2020-06-01/EventGrid.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}
type DomainList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Domain `json:"items"`
}

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

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

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

	// InboundIpRules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered
	// only if PublicNetworkAccess is enabled.
	InboundIpRules []InboundIpRule `json:"inboundIpRules,omitempty"`

	// InputSchema: This determines the format that Event Grid should expect for incoming events published to the domain.
	InputSchema *DomainProperties_InputSchema `json:"inputSchema,omitempty"`

	// InputSchemaMapping: Information about the InputSchemaMapping which specified the info about mapping event payload.
	InputSchemaMapping *InputSchemaMapping `json:"inputSchemaMapping,omitempty"`

	// +kubebuilder:validation:Required
	// Location: Location of the resource.
	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 *DomainOperatorSpec `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"`

	// PublicNetworkAccess: This determines if traffic is allowed over public network. By default it is enabled.
	// You can further restrict to specific IPs by configuring <seealso
	// cref="P:Microsoft.Azure.Events.ResourceProvider.Common.Contracts.DomainProperties.InboundIpRules" />
	PublicNetworkAccess *DomainProperties_PublicNetworkAccess `json:"publicNetworkAccess,omitempty"`

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

var _ genruntime.ARMTransformer = &Domain_Spec{}

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

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

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

	// Set property "Properties":
	if domain.InboundIpRules != nil ||
		domain.InputSchema != nil ||
		domain.InputSchemaMapping != nil ||
		domain.PublicNetworkAccess != nil {
		result.Properties = &arm.DomainProperties{}
	}
	for _, item := range domain.InboundIpRules {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.InboundIpRules = append(result.Properties.InboundIpRules, *item_ARM.(*arm.InboundIpRule))
	}
	if domain.InputSchema != nil {
		var temp string
		temp = string(*domain.InputSchema)
		inputSchema := arm.DomainProperties_InputSchema(temp)
		result.Properties.InputSchema = &inputSchema
	}
	if domain.InputSchemaMapping != nil {
		inputSchemaMapping_ARM, err := domain.InputSchemaMapping.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		inputSchemaMapping := *inputSchemaMapping_ARM.(*arm.InputSchemaMapping)
		result.Properties.InputSchemaMapping = &inputSchemaMapping
	}
	if domain.PublicNetworkAccess != nil {
		var temp string
		temp = string(*domain.PublicNetworkAccess)
		publicNetworkAccess := arm.DomainProperties_PublicNetworkAccess(temp)
		result.Properties.PublicNetworkAccess = &publicNetworkAccess
	}

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

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

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

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

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

	// Set property "InputSchema":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.InputSchema != nil {
			var temp string
			temp = string(*typedInput.Properties.InputSchema)
			inputSchema := DomainProperties_InputSchema(temp)
			domain.InputSchema = &inputSchema
		}
	}

	// Set property "InputSchemaMapping":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.InputSchemaMapping != nil {
			var inputSchemaMapping1 InputSchemaMapping
			err := inputSchemaMapping1.PopulateFromARM(owner, *typedInput.Properties.InputSchemaMapping)
			if err != nil {
				return err
			}
			inputSchemaMapping := inputSchemaMapping1
			domain.InputSchemaMapping = &inputSchemaMapping
		}
	}

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

	// no assignment for property "OperatorSpec"

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

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

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

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &Domain_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.Domain_Spec{}
	err := domain.AssignProperties_To_Domain_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_Domain_Spec populates our Domain_Spec from the provided source Domain_Spec
func (domain *Domain_Spec) AssignProperties_From_Domain_Spec(source *storage.Domain_Spec) error {

	// AzureName
	domain.AzureName = source.AzureName

	// InboundIpRules
	if source.InboundIpRules != nil {
		inboundIpRuleList := make([]InboundIpRule, len(source.InboundIpRules))
		for inboundIpRuleIndex, inboundIpRuleItem := range source.InboundIpRules {
			var inboundIpRule InboundIpRule
			err := inboundIpRule.AssignProperties_From_InboundIpRule(&inboundIpRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_InboundIpRule() to populate field InboundIpRules")
			}
			inboundIpRuleList[inboundIpRuleIndex] = inboundIpRule
		}
		domain.InboundIpRules = inboundIpRuleList
	} else {
		domain.InboundIpRules = nil
	}

	// InputSchema
	if source.InputSchema != nil {
		inputSchema := *source.InputSchema
		inputSchemaTemp := genruntime.ToEnum(inputSchema, domainProperties_InputSchema_Values)
		domain.InputSchema = &inputSchemaTemp
	} else {
		domain.InputSchema = nil
	}

	// InputSchemaMapping
	if source.InputSchemaMapping != nil {
		var inputSchemaMapping InputSchemaMapping
		err := inputSchemaMapping.AssignProperties_From_InputSchemaMapping(source.InputSchemaMapping)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_InputSchemaMapping() to populate field InputSchemaMapping")
		}
		domain.InputSchemaMapping = &inputSchemaMapping
	} else {
		domain.InputSchemaMapping = nil
	}

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

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

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

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

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

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = domain.AzureName

	// InboundIpRules
	if domain.InboundIpRules != nil {
		inboundIpRuleList := make([]storage.InboundIpRule, len(domain.InboundIpRules))
		for inboundIpRuleIndex, inboundIpRuleItem := range domain.InboundIpRules {
			var inboundIpRule storage.InboundIpRule
			err := inboundIpRuleItem.AssignProperties_To_InboundIpRule(&inboundIpRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_InboundIpRule() to populate field InboundIpRules")
			}
			inboundIpRuleList[inboundIpRuleIndex] = inboundIpRule
		}
		destination.InboundIpRules = inboundIpRuleList
	} else {
		destination.InboundIpRules = nil
	}

	// InputSchema
	if domain.InputSchema != nil {
		inputSchema := string(*domain.InputSchema)
		destination.InputSchema = &inputSchema
	} else {
		destination.InputSchema = nil
	}

	// InputSchemaMapping
	if domain.InputSchemaMapping != nil {
		var inputSchemaMapping storage.InputSchemaMapping
		err := domain.InputSchemaMapping.AssignProperties_To_InputSchemaMapping(&inputSchemaMapping)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_InputSchemaMapping() to populate field InputSchemaMapping")
		}
		destination.InputSchemaMapping = &inputSchemaMapping
	} else {
		destination.InputSchemaMapping = nil
	}

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

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

	// OriginalVersion
	destination.OriginalVersion = domain.OriginalVersion()

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

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

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

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

	// No error
	return nil
}

// Initialize_From_Domain_STATUS populates our Domain_Spec from the provided source Domain_STATUS
func (domain *Domain_Spec) Initialize_From_Domain_STATUS(source *Domain_STATUS) error {

	// InboundIpRules
	if source.InboundIpRules != nil {
		inboundIpRuleList := make([]InboundIpRule, len(source.InboundIpRules))
		for inboundIpRuleIndex, inboundIpRuleItem := range source.InboundIpRules {
			var inboundIpRule InboundIpRule
			err := inboundIpRule.Initialize_From_InboundIpRule_STATUS(&inboundIpRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_InboundIpRule_STATUS() to populate field InboundIpRules")
			}
			inboundIpRuleList[inboundIpRuleIndex] = inboundIpRule
		}
		domain.InboundIpRules = inboundIpRuleList
	} else {
		domain.InboundIpRules = nil
	}

	// InputSchema
	if source.InputSchema != nil {
		inputSchema := genruntime.ToEnum(string(*source.InputSchema), domainProperties_InputSchema_Values)
		domain.InputSchema = &inputSchema
	} else {
		domain.InputSchema = nil
	}

	// InputSchemaMapping
	if source.InputSchemaMapping != nil {
		var inputSchemaMapping InputSchemaMapping
		err := inputSchemaMapping.Initialize_From_InputSchemaMapping_STATUS(source.InputSchemaMapping)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_InputSchemaMapping_STATUS() to populate field InputSchemaMapping")
		}
		domain.InputSchemaMapping = &inputSchemaMapping
	} else {
		domain.InputSchemaMapping = nil
	}

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

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

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

	// No error
	return nil
}

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

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

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

	// Endpoint: Endpoint for the domain.
	Endpoint *string `json:"endpoint,omitempty"`

	// Id: Fully qualified identifier of the resource.
	Id *string `json:"id,omitempty"`

	// InboundIpRules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered
	// only if PublicNetworkAccess is enabled.
	InboundIpRules []InboundIpRule_STATUS `json:"inboundIpRules,omitempty"`

	// InputSchema: This determines the format that Event Grid should expect for incoming events published to the domain.
	InputSchema *DomainProperties_InputSchema_STATUS `json:"inputSchema,omitempty"`

	// InputSchemaMapping: Information about the InputSchemaMapping which specified the info about mapping event payload.
	InputSchemaMapping *InputSchemaMapping_STATUS `json:"inputSchemaMapping,omitempty"`

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

	// MetricResourceId: Metric resource id for the domain.
	MetricResourceId *string `json:"metricResourceId,omitempty"`

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

	// PrivateEndpointConnections: List of private endpoint connections.
	PrivateEndpointConnections []PrivateEndpointConnection_STATUS_Domain_SubResourceEmbedded `json:"privateEndpointConnections,omitempty"`

	// ProvisioningState: Provisioning state of the domain.
	ProvisioningState *DomainProperties_ProvisioningState_STATUS `json:"provisioningState,omitempty"`

	// PublicNetworkAccess: This determines if traffic is allowed over public network. By default it is enabled.
	// You can further restrict to specific IPs by configuring <seealso
	// cref="P:Microsoft.Azure.Events.ResourceProvider.Common.Contracts.DomainProperties.InboundIpRules" />
	PublicNetworkAccess *DomainProperties_PublicNetworkAccess_STATUS `json:"publicNetworkAccess,omitempty"`

	// SystemData: The system metadata relating to Domain resource.
	SystemData *SystemData_STATUS `json:"systemData,omitempty"`

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

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

var _ genruntime.ConvertibleStatus = &Domain_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.Domain_STATUS{}
	err := domain.AssignProperties_To_Domain_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 = &Domain_STATUS{}

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

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

	// no assignment for property "Conditions"

	// Set property "Endpoint":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Endpoint != nil {
			endpoint := *typedInput.Properties.Endpoint
			domain.Endpoint = &endpoint
		}
	}

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

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

	// Set property "InputSchema":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.InputSchema != nil {
			var temp string
			temp = string(*typedInput.Properties.InputSchema)
			inputSchema := DomainProperties_InputSchema_STATUS(temp)
			domain.InputSchema = &inputSchema
		}
	}

	// Set property "InputSchemaMapping":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.InputSchemaMapping != nil {
			var inputSchemaMapping1 InputSchemaMapping_STATUS
			err := inputSchemaMapping1.PopulateFromARM(owner, *typedInput.Properties.InputSchemaMapping)
			if err != nil {
				return err
			}
			inputSchemaMapping := inputSchemaMapping1
			domain.InputSchemaMapping = &inputSchemaMapping
		}
	}

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

	// Set property "MetricResourceId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MetricResourceId != nil {
			metricResourceId := *typedInput.Properties.MetricResourceId
			domain.MetricResourceId = &metricResourceId
		}
	}

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

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

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

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

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

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

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

	// No error
	return nil
}

// AssignProperties_From_Domain_STATUS populates our Domain_STATUS from the provided source Domain_STATUS
func (domain *Domain_STATUS) AssignProperties_From_Domain_STATUS(source *storage.Domain_STATUS) error {

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

	// Endpoint
	domain.Endpoint = genruntime.ClonePointerToString(source.Endpoint)

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

	// InboundIpRules
	if source.InboundIpRules != nil {
		inboundIpRuleList := make([]InboundIpRule_STATUS, len(source.InboundIpRules))
		for inboundIpRuleIndex, inboundIpRuleItem := range source.InboundIpRules {
			var inboundIpRule InboundIpRule_STATUS
			err := inboundIpRule.AssignProperties_From_InboundIpRule_STATUS(&inboundIpRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_InboundIpRule_STATUS() to populate field InboundIpRules")
			}
			inboundIpRuleList[inboundIpRuleIndex] = inboundIpRule
		}
		domain.InboundIpRules = inboundIpRuleList
	} else {
		domain.InboundIpRules = nil
	}

	// InputSchema
	if source.InputSchema != nil {
		inputSchema := *source.InputSchema
		inputSchemaTemp := genruntime.ToEnum(inputSchema, domainProperties_InputSchema_STATUS_Values)
		domain.InputSchema = &inputSchemaTemp
	} else {
		domain.InputSchema = nil
	}

	// InputSchemaMapping
	if source.InputSchemaMapping != nil {
		var inputSchemaMapping InputSchemaMapping_STATUS
		err := inputSchemaMapping.AssignProperties_From_InputSchemaMapping_STATUS(source.InputSchemaMapping)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_InputSchemaMapping_STATUS() to populate field InputSchemaMapping")
		}
		domain.InputSchemaMapping = &inputSchemaMapping
	} else {
		domain.InputSchemaMapping = nil
	}

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

	// MetricResourceId
	domain.MetricResourceId = genruntime.ClonePointerToString(source.MetricResourceId)

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

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

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

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

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

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

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

	// No error
	return nil
}

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

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

	// Endpoint
	destination.Endpoint = genruntime.ClonePointerToString(domain.Endpoint)

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

	// InboundIpRules
	if domain.InboundIpRules != nil {
		inboundIpRuleList := make([]storage.InboundIpRule_STATUS, len(domain.InboundIpRules))
		for inboundIpRuleIndex, inboundIpRuleItem := range domain.InboundIpRules {
			var inboundIpRule storage.InboundIpRule_STATUS
			err := inboundIpRuleItem.AssignProperties_To_InboundIpRule_STATUS(&inboundIpRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_InboundIpRule_STATUS() to populate field InboundIpRules")
			}
			inboundIpRuleList[inboundIpRuleIndex] = inboundIpRule
		}
		destination.InboundIpRules = inboundIpRuleList
	} else {
		destination.InboundIpRules = nil
	}

	// InputSchema
	if domain.InputSchema != nil {
		inputSchema := string(*domain.InputSchema)
		destination.InputSchema = &inputSchema
	} else {
		destination.InputSchema = nil
	}

	// InputSchemaMapping
	if domain.InputSchemaMapping != nil {
		var inputSchemaMapping storage.InputSchemaMapping_STATUS
		err := domain.InputSchemaMapping.AssignProperties_To_InputSchemaMapping_STATUS(&inputSchemaMapping)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_InputSchemaMapping_STATUS() to populate field InputSchemaMapping")
		}
		destination.InputSchemaMapping = &inputSchemaMapping
	} else {
		destination.InputSchemaMapping = nil
	}

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

	// MetricResourceId
	destination.MetricResourceId = genruntime.ClonePointerToString(domain.MetricResourceId)

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

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

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

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

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

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

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

	// 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 DomainOperatorSpec 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_DomainOperatorSpec populates our DomainOperatorSpec from the provided source DomainOperatorSpec
func (operator *DomainOperatorSpec) AssignProperties_From_DomainOperatorSpec(source *storage.DomainOperatorSpec) 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_DomainOperatorSpec populates the provided destination DomainOperatorSpec from our DomainOperatorSpec
func (operator *DomainOperatorSpec) AssignProperties_To_DomainOperatorSpec(destination *storage.DomainOperatorSpec) 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
}

// +kubebuilder:validation:Enum={"CloudEventSchemaV1_0","CustomEventSchema","EventGridSchema"}
type DomainProperties_InputSchema string

const (
	DomainProperties_InputSchema_CloudEventSchemaV1_0 = DomainProperties_InputSchema("CloudEventSchemaV1_0")
	DomainProperties_InputSchema_CustomEventSchema    = DomainProperties_InputSchema("CustomEventSchema")
	DomainProperties_InputSchema_EventGridSchema      = DomainProperties_InputSchema("EventGridSchema")
)

// Mapping from string to DomainProperties_InputSchema
var domainProperties_InputSchema_Values = map[string]DomainProperties_InputSchema{
	"cloudeventschemav1_0": DomainProperties_InputSchema_CloudEventSchemaV1_0,
	"customeventschema":    DomainProperties_InputSchema_CustomEventSchema,
	"eventgridschema":      DomainProperties_InputSchema_EventGridSchema,
}

type DomainProperties_InputSchema_STATUS string

const (
	DomainProperties_InputSchema_STATUS_CloudEventSchemaV1_0 = DomainProperties_InputSchema_STATUS("CloudEventSchemaV1_0")
	DomainProperties_InputSchema_STATUS_CustomEventSchema    = DomainProperties_InputSchema_STATUS("CustomEventSchema")
	DomainProperties_InputSchema_STATUS_EventGridSchema      = DomainProperties_InputSchema_STATUS("EventGridSchema")
)

// Mapping from string to DomainProperties_InputSchema_STATUS
var domainProperties_InputSchema_STATUS_Values = map[string]DomainProperties_InputSchema_STATUS{
	"cloudeventschemav1_0": DomainProperties_InputSchema_STATUS_CloudEventSchemaV1_0,
	"customeventschema":    DomainProperties_InputSchema_STATUS_CustomEventSchema,
	"eventgridschema":      DomainProperties_InputSchema_STATUS_EventGridSchema,
}

type DomainProperties_ProvisioningState_STATUS string

const (
	DomainProperties_ProvisioningState_STATUS_Canceled  = DomainProperties_ProvisioningState_STATUS("Canceled")
	DomainProperties_ProvisioningState_STATUS_Creating  = DomainProperties_ProvisioningState_STATUS("Creating")
	DomainProperties_ProvisioningState_STATUS_Deleting  = DomainProperties_ProvisioningState_STATUS("Deleting")
	DomainProperties_ProvisioningState_STATUS_Failed    = DomainProperties_ProvisioningState_STATUS("Failed")
	DomainProperties_ProvisioningState_STATUS_Succeeded = DomainProperties_ProvisioningState_STATUS("Succeeded")
	DomainProperties_ProvisioningState_STATUS_Updating  = DomainProperties_ProvisioningState_STATUS("Updating")
)

// Mapping from string to DomainProperties_ProvisioningState_STATUS
var domainProperties_ProvisioningState_STATUS_Values = map[string]DomainProperties_ProvisioningState_STATUS{
	"canceled":  DomainProperties_ProvisioningState_STATUS_Canceled,
	"creating":  DomainProperties_ProvisioningState_STATUS_Creating,
	"deleting":  DomainProperties_ProvisioningState_STATUS_Deleting,
	"failed":    DomainProperties_ProvisioningState_STATUS_Failed,
	"succeeded": DomainProperties_ProvisioningState_STATUS_Succeeded,
	"updating":  DomainProperties_ProvisioningState_STATUS_Updating,
}

// +kubebuilder:validation:Enum={"Disabled","Enabled"}
type DomainProperties_PublicNetworkAccess string

const (
	DomainProperties_PublicNetworkAccess_Disabled = DomainProperties_PublicNetworkAccess("Disabled")
	DomainProperties_PublicNetworkAccess_Enabled  = DomainProperties_PublicNetworkAccess("Enabled")
)

// Mapping from string to DomainProperties_PublicNetworkAccess
var domainProperties_PublicNetworkAccess_Values = map[string]DomainProperties_PublicNetworkAccess{
	"disabled": DomainProperties_PublicNetworkAccess_Disabled,
	"enabled":  DomainProperties_PublicNetworkAccess_Enabled,
}

type DomainProperties_PublicNetworkAccess_STATUS string

const (
	DomainProperties_PublicNetworkAccess_STATUS_Disabled = DomainProperties_PublicNetworkAccess_STATUS("Disabled")
	DomainProperties_PublicNetworkAccess_STATUS_Enabled  = DomainProperties_PublicNetworkAccess_STATUS("Enabled")
)

// Mapping from string to DomainProperties_PublicNetworkAccess_STATUS
var domainProperties_PublicNetworkAccess_STATUS_Values = map[string]DomainProperties_PublicNetworkAccess_STATUS{
	"disabled": DomainProperties_PublicNetworkAccess_STATUS_Disabled,
	"enabled":  DomainProperties_PublicNetworkAccess_STATUS_Enabled,
}

type InboundIpRule struct {
	// Action: Action to perform based on the match or no match of the IpMask.
	Action *InboundIpRule_Action `json:"action,omitempty"`

	// IpMask: IP Address in CIDR notation e.g., 10.0.0.0/8.
	IpMask *string `json:"ipMask,omitempty"`
}

var _ genruntime.ARMTransformer = &InboundIpRule{}

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

	// Set property "Action":
	if rule.Action != nil {
		var temp string
		temp = string(*rule.Action)
		action := arm.InboundIpRule_Action(temp)
		result.Action = &action
	}

	// Set property "IpMask":
	if rule.IpMask != nil {
		ipMask := *rule.IpMask
		result.IpMask = &ipMask
	}
	return result, nil
}

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

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

	// Set property "Action":
	if typedInput.Action != nil {
		var temp string
		temp = string(*typedInput.Action)
		action := InboundIpRule_Action(temp)
		rule.Action = &action
	}

	// Set property "IpMask":
	if typedInput.IpMask != nil {
		ipMask := *typedInput.IpMask
		rule.IpMask = &ipMask
	}

	// No error
	return nil
}

// AssignProperties_From_InboundIpRule populates our InboundIpRule from the provided source InboundIpRule
func (rule *InboundIpRule) AssignProperties_From_InboundIpRule(source *storage.InboundIpRule) error {

	// Action
	if source.Action != nil {
		action := *source.Action
		actionTemp := genruntime.ToEnum(action, inboundIpRule_Action_Values)
		rule.Action = &actionTemp
	} else {
		rule.Action = nil
	}

	// IpMask
	rule.IpMask = genruntime.ClonePointerToString(source.IpMask)

	// No error
	return nil
}

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

	// Action
	if rule.Action != nil {
		action := string(*rule.Action)
		destination.Action = &action
	} else {
		destination.Action = nil
	}

	// IpMask
	destination.IpMask = genruntime.ClonePointerToString(rule.IpMask)

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

	// No error
	return nil
}

// Initialize_From_InboundIpRule_STATUS populates our InboundIpRule from the provided source InboundIpRule_STATUS
func (rule *InboundIpRule) Initialize_From_InboundIpRule_STATUS(source *InboundIpRule_STATUS) error {

	// Action
	if source.Action != nil {
		action := genruntime.ToEnum(string(*source.Action), inboundIpRule_Action_Values)
		rule.Action = &action
	} else {
		rule.Action = nil
	}

	// IpMask
	rule.IpMask = genruntime.ClonePointerToString(source.IpMask)

	// No error
	return nil
}

type InboundIpRule_STATUS struct {
	// Action: Action to perform based on the match or no match of the IpMask.
	Action *InboundIpRule_Action_STATUS `json:"action,omitempty"`

	// IpMask: IP Address in CIDR notation e.g., 10.0.0.0/8.
	IpMask *string `json:"ipMask,omitempty"`
}

var _ genruntime.FromARMConverter = &InboundIpRule_STATUS{}

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

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

	// Set property "Action":
	if typedInput.Action != nil {
		var temp string
		temp = string(*typedInput.Action)
		action := InboundIpRule_Action_STATUS(temp)
		rule.Action = &action
	}

	// Set property "IpMask":
	if typedInput.IpMask != nil {
		ipMask := *typedInput.IpMask
		rule.IpMask = &ipMask
	}

	// No error
	return nil
}

// AssignProperties_From_InboundIpRule_STATUS populates our InboundIpRule_STATUS from the provided source InboundIpRule_STATUS
func (rule *InboundIpRule_STATUS) AssignProperties_From_InboundIpRule_STATUS(source *storage.InboundIpRule_STATUS) error {

	// Action
	if source.Action != nil {
		action := *source.Action
		actionTemp := genruntime.ToEnum(action, inboundIpRule_Action_STATUS_Values)
		rule.Action = &actionTemp
	} else {
		rule.Action = nil
	}

	// IpMask
	rule.IpMask = genruntime.ClonePointerToString(source.IpMask)

	// No error
	return nil
}

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

	// Action
	if rule.Action != nil {
		action := string(*rule.Action)
		destination.Action = &action
	} else {
		destination.Action = nil
	}

	// IpMask
	destination.IpMask = genruntime.ClonePointerToString(rule.IpMask)

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

	// No error
	return nil
}

type InputSchemaMapping struct {
	// Json: Mutually exclusive with all other properties
	Json *JsonInputSchemaMapping `json:"json,omitempty"`
}

var _ genruntime.ARMTransformer = &InputSchemaMapping{}

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

	// Set property "Json":
	if mapping.Json != nil {
		json_ARM, err := mapping.Json.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		json := *json_ARM.(*arm.JsonInputSchemaMapping)
		result.Json = &json
	}
	return result, nil
}

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

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

	// Set property "Json":
	if typedInput.Json != nil {
		var json1 JsonInputSchemaMapping
		err := json1.PopulateFromARM(owner, *typedInput.Json)
		if err != nil {
			return err
		}
		json := json1
		mapping.Json = &json
	}

	// No error
	return nil
}

// AssignProperties_From_InputSchemaMapping populates our InputSchemaMapping from the provided source InputSchemaMapping
func (mapping *InputSchemaMapping) AssignProperties_From_InputSchemaMapping(source *storage.InputSchemaMapping) error {

	// Json
	if source.Json != nil {
		var json JsonInputSchemaMapping
		err := json.AssignProperties_From_JsonInputSchemaMapping(source.Json)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_JsonInputSchemaMapping() to populate field Json")
		}
		mapping.Json = &json
	} else {
		mapping.Json = nil
	}

	// No error
	return nil
}

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

	// Json
	if mapping.Json != nil {
		var json storage.JsonInputSchemaMapping
		err := mapping.Json.AssignProperties_To_JsonInputSchemaMapping(&json)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_JsonInputSchemaMapping() to populate field Json")
		}
		destination.Json = &json
	} else {
		destination.Json = nil
	}

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

	// No error
	return nil
}

// Initialize_From_InputSchemaMapping_STATUS populates our InputSchemaMapping from the provided source InputSchemaMapping_STATUS
func (mapping *InputSchemaMapping) Initialize_From_InputSchemaMapping_STATUS(source *InputSchemaMapping_STATUS) error {

	// Json
	if source.Json != nil {
		var json JsonInputSchemaMapping
		err := json.Initialize_From_JsonInputSchemaMapping_STATUS(source.Json)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_JsonInputSchemaMapping_STATUS() to populate field Json")
		}
		mapping.Json = &json
	} else {
		mapping.Json = nil
	}

	// No error
	return nil
}

type InputSchemaMapping_STATUS struct {
	// Json: Mutually exclusive with all other properties
	Json *JsonInputSchemaMapping_STATUS `json:"json,omitempty"`
}

var _ genruntime.FromARMConverter = &InputSchemaMapping_STATUS{}

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

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

	// Set property "Json":
	if typedInput.Json != nil {
		var json1 JsonInputSchemaMapping_STATUS
		err := json1.PopulateFromARM(owner, *typedInput.Json)
		if err != nil {
			return err
		}
		json := json1
		mapping.Json = &json
	}

	// No error
	return nil
}

// AssignProperties_From_InputSchemaMapping_STATUS populates our InputSchemaMapping_STATUS from the provided source InputSchemaMapping_STATUS
func (mapping *InputSchemaMapping_STATUS) AssignProperties_From_InputSchemaMapping_STATUS(source *storage.InputSchemaMapping_STATUS) error {

	// Json
	if source.Json != nil {
		var json JsonInputSchemaMapping_STATUS
		err := json.AssignProperties_From_JsonInputSchemaMapping_STATUS(source.Json)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_JsonInputSchemaMapping_STATUS() to populate field Json")
		}
		mapping.Json = &json
	} else {
		mapping.Json = nil
	}

	// No error
	return nil
}

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

	// Json
	if mapping.Json != nil {
		var json storage.JsonInputSchemaMapping_STATUS
		err := mapping.Json.AssignProperties_To_JsonInputSchemaMapping_STATUS(&json)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_JsonInputSchemaMapping_STATUS() to populate field Json")
		}
		destination.Json = &json
	} else {
		destination.Json = nil
	}

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

	// No error
	return nil
}

type PrivateEndpointConnection_STATUS_Domain_SubResourceEmbedded struct {
	// Id: Fully qualified identifier of the resource.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &PrivateEndpointConnection_STATUS_Domain_SubResourceEmbedded{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_PrivateEndpointConnection_STATUS_Domain_SubResourceEmbedded populates our PrivateEndpointConnection_STATUS_Domain_SubResourceEmbedded from the provided source PrivateEndpointConnection_STATUS_Domain_SubResourceEmbedded
func (embedded *PrivateEndpointConnection_STATUS_Domain_SubResourceEmbedded) AssignProperties_From_PrivateEndpointConnection_STATUS_Domain_SubResourceEmbedded(source *storage.PrivateEndpointConnection_STATUS_Domain_SubResourceEmbedded) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

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

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

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

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

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

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

var _ genruntime.FromARMConverter = &SystemData_STATUS{}

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

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

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

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

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

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

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

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

	// No error
	return nil
}

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

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

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

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

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

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

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

	// No error
	return nil
}

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

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

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

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

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

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

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

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"Allow"}
type InboundIpRule_Action string

const InboundIpRule_Action_Allow = InboundIpRule_Action("Allow")

// Mapping from string to InboundIpRule_Action
var inboundIpRule_Action_Values = map[string]InboundIpRule_Action{
	"allow": InboundIpRule_Action_Allow,
}

type InboundIpRule_Action_STATUS string

const InboundIpRule_Action_STATUS_Allow = InboundIpRule_Action_STATUS("Allow")

// Mapping from string to InboundIpRule_Action_STATUS
var inboundIpRule_Action_STATUS_Values = map[string]InboundIpRule_Action_STATUS{
	"allow": InboundIpRule_Action_STATUS_Allow,
}

type JsonInputSchemaMapping struct {
	// DataVersion: The mapping information for the DataVersion property of the Event Grid Event.
	DataVersion *JsonFieldWithDefault `json:"dataVersion,omitempty"`

	// EventTime: The mapping information for the EventTime property of the Event Grid Event.
	EventTime *JsonField `json:"eventTime,omitempty"`

	// EventType: The mapping information for the EventType property of the Event Grid Event.
	EventType *JsonFieldWithDefault `json:"eventType,omitempty"`

	// Id: The mapping information for the Id property of the Event Grid Event.
	Id *JsonField `json:"id,omitempty"`

	// +kubebuilder:validation:Required
	// InputSchemaMappingType: Type of the custom mapping
	InputSchemaMappingType *JsonInputSchemaMapping_InputSchemaMappingType `json:"inputSchemaMappingType,omitempty"`

	// Subject: The mapping information for the Subject property of the Event Grid Event.
	Subject *JsonFieldWithDefault `json:"subject,omitempty"`

	// Topic: The mapping information for the Topic property of the Event Grid Event.
	Topic *JsonField `json:"topic,omitempty"`
}

var _ genruntime.ARMTransformer = &JsonInputSchemaMapping{}

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

	// Set property "InputSchemaMappingType":
	if mapping.InputSchemaMappingType != nil {
		var temp arm.JsonInputSchemaMapping_InputSchemaMappingType
		var temp1 string
		temp1 = string(*mapping.InputSchemaMappingType)
		temp = arm.JsonInputSchemaMapping_InputSchemaMappingType(temp1)
		result.InputSchemaMappingType = temp
	}

	// Set property "Properties":
	if mapping.DataVersion != nil ||
		mapping.EventTime != nil ||
		mapping.EventType != nil ||
		mapping.Id != nil ||
		mapping.Subject != nil ||
		mapping.Topic != nil {
		result.Properties = &arm.JsonInputSchemaMappingProperties{}
	}
	if mapping.DataVersion != nil {
		dataVersion_ARM, err := mapping.DataVersion.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		dataVersion := *dataVersion_ARM.(*arm.JsonFieldWithDefault)
		result.Properties.DataVersion = &dataVersion
	}
	if mapping.EventTime != nil {
		eventTime_ARM, err := mapping.EventTime.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		eventTime := *eventTime_ARM.(*arm.JsonField)
		result.Properties.EventTime = &eventTime
	}
	if mapping.EventType != nil {
		eventType_ARM, err := mapping.EventType.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		eventType := *eventType_ARM.(*arm.JsonFieldWithDefault)
		result.Properties.EventType = &eventType
	}
	if mapping.Id != nil {
		id_ARM, err := mapping.Id.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		id := *id_ARM.(*arm.JsonField)
		result.Properties.Id = &id
	}
	if mapping.Subject != nil {
		subject_ARM, err := mapping.Subject.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		subject := *subject_ARM.(*arm.JsonFieldWithDefault)
		result.Properties.Subject = &subject
	}
	if mapping.Topic != nil {
		topic_ARM, err := mapping.Topic.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		topic := *topic_ARM.(*arm.JsonField)
		result.Properties.Topic = &topic
	}
	return result, nil
}

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

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

	// Set property "DataVersion":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DataVersion != nil {
			var dataVersion1 JsonFieldWithDefault
			err := dataVersion1.PopulateFromARM(owner, *typedInput.Properties.DataVersion)
			if err != nil {
				return err
			}
			dataVersion := dataVersion1
			mapping.DataVersion = &dataVersion
		}
	}

	// Set property "EventTime":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EventTime != nil {
			var eventTime1 JsonField
			err := eventTime1.PopulateFromARM(owner, *typedInput.Properties.EventTime)
			if err != nil {
				return err
			}
			eventTime := eventTime1
			mapping.EventTime = &eventTime
		}
	}

	// Set property "EventType":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EventType != nil {
			var eventType1 JsonFieldWithDefault
			err := eventType1.PopulateFromARM(owner, *typedInput.Properties.EventType)
			if err != nil {
				return err
			}
			eventType := eventType1
			mapping.EventType = &eventType
		}
	}

	// Set property "Id":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Id != nil {
			var id1 JsonField
			err := id1.PopulateFromARM(owner, *typedInput.Properties.Id)
			if err != nil {
				return err
			}
			id := id1
			mapping.Id = &id
		}
	}

	// Set property "InputSchemaMappingType":
	var temp JsonInputSchemaMapping_InputSchemaMappingType
	var temp1 string
	temp1 = string(typedInput.InputSchemaMappingType)
	temp = JsonInputSchemaMapping_InputSchemaMappingType(temp1)
	mapping.InputSchemaMappingType = &temp

	// Set property "Subject":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Subject != nil {
			var subject1 JsonFieldWithDefault
			err := subject1.PopulateFromARM(owner, *typedInput.Properties.Subject)
			if err != nil {
				return err
			}
			subject := subject1
			mapping.Subject = &subject
		}
	}

	// Set property "Topic":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Topic != nil {
			var topic1 JsonField
			err := topic1.PopulateFromARM(owner, *typedInput.Properties.Topic)
			if err != nil {
				return err
			}
			topic := topic1
			mapping.Topic = &topic
		}
	}

	// No error
	return nil
}

// AssignProperties_From_JsonInputSchemaMapping populates our JsonInputSchemaMapping from the provided source JsonInputSchemaMapping
func (mapping *JsonInputSchemaMapping) AssignProperties_From_JsonInputSchemaMapping(source *storage.JsonInputSchemaMapping) error {

	// DataVersion
	if source.DataVersion != nil {
		var dataVersion JsonFieldWithDefault
		err := dataVersion.AssignProperties_From_JsonFieldWithDefault(source.DataVersion)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_JsonFieldWithDefault() to populate field DataVersion")
		}
		mapping.DataVersion = &dataVersion
	} else {
		mapping.DataVersion = nil
	}

	// EventTime
	if source.EventTime != nil {
		var eventTime JsonField
		err := eventTime.AssignProperties_From_JsonField(source.EventTime)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_JsonField() to populate field EventTime")
		}
		mapping.EventTime = &eventTime
	} else {
		mapping.EventTime = nil
	}

	// EventType
	if source.EventType != nil {
		var eventType JsonFieldWithDefault
		err := eventType.AssignProperties_From_JsonFieldWithDefault(source.EventType)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_JsonFieldWithDefault() to populate field EventType")
		}
		mapping.EventType = &eventType
	} else {
		mapping.EventType = nil
	}

	// Id
	if source.Id != nil {
		var id JsonField
		err := id.AssignProperties_From_JsonField(source.Id)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_JsonField() to populate field Id")
		}
		mapping.Id = &id
	} else {
		mapping.Id = nil
	}

	// InputSchemaMappingType
	if source.InputSchemaMappingType != nil {
		inputSchemaMappingType := *source.InputSchemaMappingType
		inputSchemaMappingTypeTemp := genruntime.ToEnum(inputSchemaMappingType, jsonInputSchemaMapping_InputSchemaMappingType_Values)
		mapping.InputSchemaMappingType = &inputSchemaMappingTypeTemp
	} else {
		mapping.InputSchemaMappingType = nil
	}

	// Subject
	if source.Subject != nil {
		var subject JsonFieldWithDefault
		err := subject.AssignProperties_From_JsonFieldWithDefault(source.Subject)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_JsonFieldWithDefault() to populate field Subject")
		}
		mapping.Subject = &subject
	} else {
		mapping.Subject = nil
	}

	// Topic
	if source.Topic != nil {
		var topic JsonField
		err := topic.AssignProperties_From_JsonField(source.Topic)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_JsonField() to populate field Topic")
		}
		mapping.Topic = &topic
	} else {
		mapping.Topic = nil
	}

	// No error
	return nil
}

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

	// DataVersion
	if mapping.DataVersion != nil {
		var dataVersion storage.JsonFieldWithDefault
		err := mapping.DataVersion.AssignProperties_To_JsonFieldWithDefault(&dataVersion)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_JsonFieldWithDefault() to populate field DataVersion")
		}
		destination.DataVersion = &dataVersion
	} else {
		destination.DataVersion = nil
	}

	// EventTime
	if mapping.EventTime != nil {
		var eventTime storage.JsonField
		err := mapping.EventTime.AssignProperties_To_JsonField(&eventTime)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_JsonField() to populate field EventTime")
		}
		destination.EventTime = &eventTime
	} else {
		destination.EventTime = nil
	}

	// EventType
	if mapping.EventType != nil {
		var eventType storage.JsonFieldWithDefault
		err := mapping.EventType.AssignProperties_To_JsonFieldWithDefault(&eventType)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_JsonFieldWithDefault() to populate field EventType")
		}
		destination.EventType = &eventType
	} else {
		destination.EventType = nil
	}

	// Id
	if mapping.Id != nil {
		var id storage.JsonField
		err := mapping.Id.AssignProperties_To_JsonField(&id)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_JsonField() to populate field Id")
		}
		destination.Id = &id
	} else {
		destination.Id = nil
	}

	// InputSchemaMappingType
	if mapping.InputSchemaMappingType != nil {
		inputSchemaMappingType := string(*mapping.InputSchemaMappingType)
		destination.InputSchemaMappingType = &inputSchemaMappingType
	} else {
		destination.InputSchemaMappingType = nil
	}

	// Subject
	if mapping.Subject != nil {
		var subject storage.JsonFieldWithDefault
		err := mapping.Subject.AssignProperties_To_JsonFieldWithDefault(&subject)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_JsonFieldWithDefault() to populate field Subject")
		}
		destination.Subject = &subject
	} else {
		destination.Subject = nil
	}

	// Topic
	if mapping.Topic != nil {
		var topic storage.JsonField
		err := mapping.Topic.AssignProperties_To_JsonField(&topic)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_JsonField() to populate field Topic")
		}
		destination.Topic = &topic
	} else {
		destination.Topic = nil
	}

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

	// No error
	return nil
}

// Initialize_From_JsonInputSchemaMapping_STATUS populates our JsonInputSchemaMapping from the provided source JsonInputSchemaMapping_STATUS
func (mapping *JsonInputSchemaMapping) Initialize_From_JsonInputSchemaMapping_STATUS(source *JsonInputSchemaMapping_STATUS) error {

	// DataVersion
	if source.DataVersion != nil {
		var dataVersion JsonFieldWithDefault
		err := dataVersion.Initialize_From_JsonFieldWithDefault_STATUS(source.DataVersion)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_JsonFieldWithDefault_STATUS() to populate field DataVersion")
		}
		mapping.DataVersion = &dataVersion
	} else {
		mapping.DataVersion = nil
	}

	// EventTime
	if source.EventTime != nil {
		var eventTime JsonField
		err := eventTime.Initialize_From_JsonField_STATUS(source.EventTime)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_JsonField_STATUS() to populate field EventTime")
		}
		mapping.EventTime = &eventTime
	} else {
		mapping.EventTime = nil
	}

	// EventType
	if source.EventType != nil {
		var eventType JsonFieldWithDefault
		err := eventType.Initialize_From_JsonFieldWithDefault_STATUS(source.EventType)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_JsonFieldWithDefault_STATUS() to populate field EventType")
		}
		mapping.EventType = &eventType
	} else {
		mapping.EventType = nil
	}

	// Id
	if source.Id != nil {
		var id JsonField
		err := id.Initialize_From_JsonField_STATUS(source.Id)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_JsonField_STATUS() to populate field Id")
		}
		mapping.Id = &id
	} else {
		mapping.Id = nil
	}

	// InputSchemaMappingType
	if source.InputSchemaMappingType != nil {
		inputSchemaMappingType := genruntime.ToEnum(string(*source.InputSchemaMappingType), jsonInputSchemaMapping_InputSchemaMappingType_Values)
		mapping.InputSchemaMappingType = &inputSchemaMappingType
	} else {
		mapping.InputSchemaMappingType = nil
	}

	// Subject
	if source.Subject != nil {
		var subject JsonFieldWithDefault
		err := subject.Initialize_From_JsonFieldWithDefault_STATUS(source.Subject)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_JsonFieldWithDefault_STATUS() to populate field Subject")
		}
		mapping.Subject = &subject
	} else {
		mapping.Subject = nil
	}

	// Topic
	if source.Topic != nil {
		var topic JsonField
		err := topic.Initialize_From_JsonField_STATUS(source.Topic)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_JsonField_STATUS() to populate field Topic")
		}
		mapping.Topic = &topic
	} else {
		mapping.Topic = nil
	}

	// No error
	return nil
}

type JsonInputSchemaMapping_STATUS struct {
	// DataVersion: The mapping information for the DataVersion property of the Event Grid Event.
	DataVersion *JsonFieldWithDefault_STATUS `json:"dataVersion,omitempty"`

	// EventTime: The mapping information for the EventTime property of the Event Grid Event.
	EventTime *JsonField_STATUS `json:"eventTime,omitempty"`

	// EventType: The mapping information for the EventType property of the Event Grid Event.
	EventType *JsonFieldWithDefault_STATUS `json:"eventType,omitempty"`

	// Id: The mapping information for the Id property of the Event Grid Event.
	Id *JsonField_STATUS `json:"id,omitempty"`

	// InputSchemaMappingType: Type of the custom mapping
	InputSchemaMappingType *JsonInputSchemaMapping_InputSchemaMappingType_STATUS `json:"inputSchemaMappingType,omitempty"`

	// Subject: The mapping information for the Subject property of the Event Grid Event.
	Subject *JsonFieldWithDefault_STATUS `json:"subject,omitempty"`

	// Topic: The mapping information for the Topic property of the Event Grid Event.
	Topic *JsonField_STATUS `json:"topic,omitempty"`
}

var _ genruntime.FromARMConverter = &JsonInputSchemaMapping_STATUS{}

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

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

	// Set property "DataVersion":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DataVersion != nil {
			var dataVersion1 JsonFieldWithDefault_STATUS
			err := dataVersion1.PopulateFromARM(owner, *typedInput.Properties.DataVersion)
			if err != nil {
				return err
			}
			dataVersion := dataVersion1
			mapping.DataVersion = &dataVersion
		}
	}

	// Set property "EventTime":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EventTime != nil {
			var eventTime1 JsonField_STATUS
			err := eventTime1.PopulateFromARM(owner, *typedInput.Properties.EventTime)
			if err != nil {
				return err
			}
			eventTime := eventTime1
			mapping.EventTime = &eventTime
		}
	}

	// Set property "EventType":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EventType != nil {
			var eventType1 JsonFieldWithDefault_STATUS
			err := eventType1.PopulateFromARM(owner, *typedInput.Properties.EventType)
			if err != nil {
				return err
			}
			eventType := eventType1
			mapping.EventType = &eventType
		}
	}

	// Set property "Id":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Id != nil {
			var id1 JsonField_STATUS
			err := id1.PopulateFromARM(owner, *typedInput.Properties.Id)
			if err != nil {
				return err
			}
			id := id1
			mapping.Id = &id
		}
	}

	// Set property "InputSchemaMappingType":
	var temp JsonInputSchemaMapping_InputSchemaMappingType_STATUS
	var temp1 string
	temp1 = string(typedInput.InputSchemaMappingType)
	temp = JsonInputSchemaMapping_InputSchemaMappingType_STATUS(temp1)
	mapping.InputSchemaMappingType = &temp

	// Set property "Subject":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Subject != nil {
			var subject1 JsonFieldWithDefault_STATUS
			err := subject1.PopulateFromARM(owner, *typedInput.Properties.Subject)
			if err != nil {
				return err
			}
			subject := subject1
			mapping.Subject = &subject
		}
	}

	// Set property "Topic":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Topic != nil {
			var topic1 JsonField_STATUS
			err := topic1.PopulateFromARM(owner, *typedInput.Properties.Topic)
			if err != nil {
				return err
			}
			topic := topic1
			mapping.Topic = &topic
		}
	}

	// No error
	return nil
}

// AssignProperties_From_JsonInputSchemaMapping_STATUS populates our JsonInputSchemaMapping_STATUS from the provided source JsonInputSchemaMapping_STATUS
func (mapping *JsonInputSchemaMapping_STATUS) AssignProperties_From_JsonInputSchemaMapping_STATUS(source *storage.JsonInputSchemaMapping_STATUS) error {

	// DataVersion
	if source.DataVersion != nil {
		var dataVersion JsonFieldWithDefault_STATUS
		err := dataVersion.AssignProperties_From_JsonFieldWithDefault_STATUS(source.DataVersion)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_JsonFieldWithDefault_STATUS() to populate field DataVersion")
		}
		mapping.DataVersion = &dataVersion
	} else {
		mapping.DataVersion = nil
	}

	// EventTime
	if source.EventTime != nil {
		var eventTime JsonField_STATUS
		err := eventTime.AssignProperties_From_JsonField_STATUS(source.EventTime)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_JsonField_STATUS() to populate field EventTime")
		}
		mapping.EventTime = &eventTime
	} else {
		mapping.EventTime = nil
	}

	// EventType
	if source.EventType != nil {
		var eventType JsonFieldWithDefault_STATUS
		err := eventType.AssignProperties_From_JsonFieldWithDefault_STATUS(source.EventType)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_JsonFieldWithDefault_STATUS() to populate field EventType")
		}
		mapping.EventType = &eventType
	} else {
		mapping.EventType = nil
	}

	// Id
	if source.Id != nil {
		var id JsonField_STATUS
		err := id.AssignProperties_From_JsonField_STATUS(source.Id)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_JsonField_STATUS() to populate field Id")
		}
		mapping.Id = &id
	} else {
		mapping.Id = nil
	}

	// InputSchemaMappingType
	if source.InputSchemaMappingType != nil {
		inputSchemaMappingType := *source.InputSchemaMappingType
		inputSchemaMappingTypeTemp := genruntime.ToEnum(inputSchemaMappingType, jsonInputSchemaMapping_InputSchemaMappingType_STATUS_Values)
		mapping.InputSchemaMappingType = &inputSchemaMappingTypeTemp
	} else {
		mapping.InputSchemaMappingType = nil
	}

	// Subject
	if source.Subject != nil {
		var subject JsonFieldWithDefault_STATUS
		err := subject.AssignProperties_From_JsonFieldWithDefault_STATUS(source.Subject)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_JsonFieldWithDefault_STATUS() to populate field Subject")
		}
		mapping.Subject = &subject
	} else {
		mapping.Subject = nil
	}

	// Topic
	if source.Topic != nil {
		var topic JsonField_STATUS
		err := topic.AssignProperties_From_JsonField_STATUS(source.Topic)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_JsonField_STATUS() to populate field Topic")
		}
		mapping.Topic = &topic
	} else {
		mapping.Topic = nil
	}

	// No error
	return nil
}

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

	// DataVersion
	if mapping.DataVersion != nil {
		var dataVersion storage.JsonFieldWithDefault_STATUS
		err := mapping.DataVersion.AssignProperties_To_JsonFieldWithDefault_STATUS(&dataVersion)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_JsonFieldWithDefault_STATUS() to populate field DataVersion")
		}
		destination.DataVersion = &dataVersion
	} else {
		destination.DataVersion = nil
	}

	// EventTime
	if mapping.EventTime != nil {
		var eventTime storage.JsonField_STATUS
		err := mapping.EventTime.AssignProperties_To_JsonField_STATUS(&eventTime)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_JsonField_STATUS() to populate field EventTime")
		}
		destination.EventTime = &eventTime
	} else {
		destination.EventTime = nil
	}

	// EventType
	if mapping.EventType != nil {
		var eventType storage.JsonFieldWithDefault_STATUS
		err := mapping.EventType.AssignProperties_To_JsonFieldWithDefault_STATUS(&eventType)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_JsonFieldWithDefault_STATUS() to populate field EventType")
		}
		destination.EventType = &eventType
	} else {
		destination.EventType = nil
	}

	// Id
	if mapping.Id != nil {
		var id storage.JsonField_STATUS
		err := mapping.Id.AssignProperties_To_JsonField_STATUS(&id)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_JsonField_STATUS() to populate field Id")
		}
		destination.Id = &id
	} else {
		destination.Id = nil
	}

	// InputSchemaMappingType
	if mapping.InputSchemaMappingType != nil {
		inputSchemaMappingType := string(*mapping.InputSchemaMappingType)
		destination.InputSchemaMappingType = &inputSchemaMappingType
	} else {
		destination.InputSchemaMappingType = nil
	}

	// Subject
	if mapping.Subject != nil {
		var subject storage.JsonFieldWithDefault_STATUS
		err := mapping.Subject.AssignProperties_To_JsonFieldWithDefault_STATUS(&subject)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_JsonFieldWithDefault_STATUS() to populate field Subject")
		}
		destination.Subject = &subject
	} else {
		destination.Subject = nil
	}

	// Topic
	if mapping.Topic != nil {
		var topic storage.JsonField_STATUS
		err := mapping.Topic.AssignProperties_To_JsonField_STATUS(&topic)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_JsonField_STATUS() to populate field Topic")
		}
		destination.Topic = &topic
	} else {
		destination.Topic = nil
	}

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

	// No error
	return nil
}

type SystemData_CreatedByType_STATUS string

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

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

type SystemData_LastModifiedByType_STATUS string

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

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

// This is used to express the source of an input schema mapping for a single target field in the Event Grid Event schema.
// This is currently used in the mappings for the 'id', 'topic' and 'eventtime' properties. This represents a field in the
// input event schema.
type JsonField struct {
	// SourceField: Name of a field in the input event schema that's to be used as the source of a mapping.
	SourceField *string `json:"sourceField,omitempty"`
}

var _ genruntime.ARMTransformer = &JsonField{}

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

	// Set property "SourceField":
	if field.SourceField != nil {
		sourceField := *field.SourceField
		result.SourceField = &sourceField
	}
	return result, nil
}

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

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

	// Set property "SourceField":
	if typedInput.SourceField != nil {
		sourceField := *typedInput.SourceField
		field.SourceField = &sourceField
	}

	// No error
	return nil
}

// AssignProperties_From_JsonField populates our JsonField from the provided source JsonField
func (field *JsonField) AssignProperties_From_JsonField(source *storage.JsonField) error {

	// SourceField
	field.SourceField = genruntime.ClonePointerToString(source.SourceField)

	// No error
	return nil
}

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

	// SourceField
	destination.SourceField = genruntime.ClonePointerToString(field.SourceField)

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

	// No error
	return nil
}

// Initialize_From_JsonField_STATUS populates our JsonField from the provided source JsonField_STATUS
func (field *JsonField) Initialize_From_JsonField_STATUS(source *JsonField_STATUS) error {

	// SourceField
	field.SourceField = genruntime.ClonePointerToString(source.SourceField)

	// No error
	return nil
}

// This is used to express the source of an input schema mapping for a single target field in the Event Grid Event schema.
// This is currently used in the mappings for the 'id', 'topic' and 'eventtime' properties. This represents a field in the
// input event schema.
type JsonField_STATUS struct {
	// SourceField: Name of a field in the input event schema that's to be used as the source of a mapping.
	SourceField *string `json:"sourceField,omitempty"`
}

var _ genruntime.FromARMConverter = &JsonField_STATUS{}

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

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

	// Set property "SourceField":
	if typedInput.SourceField != nil {
		sourceField := *typedInput.SourceField
		field.SourceField = &sourceField
	}

	// No error
	return nil
}

// AssignProperties_From_JsonField_STATUS populates our JsonField_STATUS from the provided source JsonField_STATUS
func (field *JsonField_STATUS) AssignProperties_From_JsonField_STATUS(source *storage.JsonField_STATUS) error {

	// SourceField
	field.SourceField = genruntime.ClonePointerToString(source.SourceField)

	// No error
	return nil
}

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

	// SourceField
	destination.SourceField = genruntime.ClonePointerToString(field.SourceField)

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

	// No error
	return nil
}

// This is used to express the source of an input schema mapping for a single target field
// in the Event Grid Event schema.
// This is currently used in the mappings for the 'subject',
// 'eventtype' and 'dataversion' properties. This represents a
// field in the input event schema
// along with a default value to be used, and at least one of these two properties should
// be provided.
type JsonFieldWithDefault struct {
	// DefaultValue: The default value to be used for mapping when a SourceField is not provided or if there's no property with
	// the specified name in the published JSON event payload.
	DefaultValue *string `json:"defaultValue,omitempty"`

	// SourceField: Name of a field in the input event schema that's to be used as the source of a mapping.
	SourceField *string `json:"sourceField,omitempty"`
}

var _ genruntime.ARMTransformer = &JsonFieldWithDefault{}

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

	// Set property "DefaultValue":
	if withDefault.DefaultValue != nil {
		defaultValue := *withDefault.DefaultValue
		result.DefaultValue = &defaultValue
	}

	// Set property "SourceField":
	if withDefault.SourceField != nil {
		sourceField := *withDefault.SourceField
		result.SourceField = &sourceField
	}
	return result, nil
}

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

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

	// Set property "DefaultValue":
	if typedInput.DefaultValue != nil {
		defaultValue := *typedInput.DefaultValue
		withDefault.DefaultValue = &defaultValue
	}

	// Set property "SourceField":
	if typedInput.SourceField != nil {
		sourceField := *typedInput.SourceField
		withDefault.SourceField = &sourceField
	}

	// No error
	return nil
}

// AssignProperties_From_JsonFieldWithDefault populates our JsonFieldWithDefault from the provided source JsonFieldWithDefault
func (withDefault *JsonFieldWithDefault) AssignProperties_From_JsonFieldWithDefault(source *storage.JsonFieldWithDefault) error {

	// DefaultValue
	withDefault.DefaultValue = genruntime.ClonePointerToString(source.DefaultValue)

	// SourceField
	withDefault.SourceField = genruntime.ClonePointerToString(source.SourceField)

	// No error
	return nil
}

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

	// DefaultValue
	destination.DefaultValue = genruntime.ClonePointerToString(withDefault.DefaultValue)

	// SourceField
	destination.SourceField = genruntime.ClonePointerToString(withDefault.SourceField)

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

	// No error
	return nil
}

// Initialize_From_JsonFieldWithDefault_STATUS populates our JsonFieldWithDefault from the provided source JsonFieldWithDefault_STATUS
func (withDefault *JsonFieldWithDefault) Initialize_From_JsonFieldWithDefault_STATUS(source *JsonFieldWithDefault_STATUS) error {

	// DefaultValue
	withDefault.DefaultValue = genruntime.ClonePointerToString(source.DefaultValue)

	// SourceField
	withDefault.SourceField = genruntime.ClonePointerToString(source.SourceField)

	// No error
	return nil
}

// This is used to express the source of an input schema mapping for a single target field
// in the Event Grid Event schema.
// This is currently used in the mappings for the 'subject',
// 'eventtype' and 'dataversion' properties. This represents a
// field in the input event schema
// along with a default value to be used, and at least one of these two properties should
// be provided.
type JsonFieldWithDefault_STATUS struct {
	// DefaultValue: The default value to be used for mapping when a SourceField is not provided or if there's no property with
	// the specified name in the published JSON event payload.
	DefaultValue *string `json:"defaultValue,omitempty"`

	// SourceField: Name of a field in the input event schema that's to be used as the source of a mapping.
	SourceField *string `json:"sourceField,omitempty"`
}

var _ genruntime.FromARMConverter = &JsonFieldWithDefault_STATUS{}

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

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

	// Set property "DefaultValue":
	if typedInput.DefaultValue != nil {
		defaultValue := *typedInput.DefaultValue
		withDefault.DefaultValue = &defaultValue
	}

	// Set property "SourceField":
	if typedInput.SourceField != nil {
		sourceField := *typedInput.SourceField
		withDefault.SourceField = &sourceField
	}

	// No error
	return nil
}

// AssignProperties_From_JsonFieldWithDefault_STATUS populates our JsonFieldWithDefault_STATUS from the provided source JsonFieldWithDefault_STATUS
func (withDefault *JsonFieldWithDefault_STATUS) AssignProperties_From_JsonFieldWithDefault_STATUS(source *storage.JsonFieldWithDefault_STATUS) error {

	// DefaultValue
	withDefault.DefaultValue = genruntime.ClonePointerToString(source.DefaultValue)

	// SourceField
	withDefault.SourceField = genruntime.ClonePointerToString(source.SourceField)

	// No error
	return nil
}

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

	// DefaultValue
	destination.DefaultValue = genruntime.ClonePointerToString(withDefault.DefaultValue)

	// SourceField
	destination.SourceField = genruntime.ClonePointerToString(withDefault.SourceField)

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"Json"}
type JsonInputSchemaMapping_InputSchemaMappingType string

const JsonInputSchemaMapping_InputSchemaMappingType_Json = JsonInputSchemaMapping_InputSchemaMappingType("Json")

// Mapping from string to JsonInputSchemaMapping_InputSchemaMappingType
var jsonInputSchemaMapping_InputSchemaMappingType_Values = map[string]JsonInputSchemaMapping_InputSchemaMappingType{
	"json": JsonInputSchemaMapping_InputSchemaMappingType_Json,
}

type JsonInputSchemaMapping_InputSchemaMappingType_STATUS string

const JsonInputSchemaMapping_InputSchemaMappingType_STATUS_Json = JsonInputSchemaMapping_InputSchemaMappingType_STATUS("Json")

// Mapping from string to JsonInputSchemaMapping_InputSchemaMappingType_STATUS
var jsonInputSchemaMapping_InputSchemaMappingType_STATUS_Values = map[string]JsonInputSchemaMapping_InputSchemaMappingType_STATUS{
	"json": JsonInputSchemaMapping_InputSchemaMappingType_STATUS_Json,
}

func init() {
	SchemeBuilder.Register(&Domain{}, &DomainList{})
}
