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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/containerservice/v1api20240901/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/containerservice/v1api20240901/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,containerservice}
// +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: /containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/managedClusters.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}
type MaintenanceConfiguration struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              MaintenanceConfiguration_Spec   `json:"spec,omitempty"`
	Status            MaintenanceConfiguration_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &MaintenanceConfiguration{}

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

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

var _ conversion.Convertible = &MaintenanceConfiguration{}

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

	return configuration.AssignProperties_From_MaintenanceConfiguration(source)
}

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

	return configuration.AssignProperties_To_MaintenanceConfiguration(destination)
}

var _ configmaps.Exporter = &MaintenanceConfiguration{}

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

var _ secrets.Exporter = &MaintenanceConfiguration{}

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

var _ genruntime.ImportableResource = &MaintenanceConfiguration{}

// InitializeSpec initializes the spec for this resource from the given status
func (configuration *MaintenanceConfiguration) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*MaintenanceConfiguration_STATUS); ok {
		return configuration.Spec.Initialize_From_MaintenanceConfiguration_STATUS(s)
	}

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

var _ genruntime.KubernetesResource = &MaintenanceConfiguration{}

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

// GetAPIVersion returns the ARM API version of the resource. This is always "2024-09-01"
func (configuration MaintenanceConfiguration) GetAPIVersion() string {
	return "2024-09-01"
}

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.ContainerService/managedClusters/maintenanceConfigurations"
func (configuration *MaintenanceConfiguration) GetType() string {
	return "Microsoft.ContainerService/managedClusters/maintenanceConfigurations"
}

// NewEmptyStatus returns a new empty (blank) status
func (configuration *MaintenanceConfiguration) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &MaintenanceConfiguration_STATUS{}
}

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

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

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

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

	configuration.Status = st
	return nil
}

// AssignProperties_From_MaintenanceConfiguration populates our MaintenanceConfiguration from the provided source MaintenanceConfiguration
func (configuration *MaintenanceConfiguration) AssignProperties_From_MaintenanceConfiguration(source *storage.MaintenanceConfiguration) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_MaintenanceConfiguration populates the provided destination MaintenanceConfiguration from our MaintenanceConfiguration
func (configuration *MaintenanceConfiguration) AssignProperties_To_MaintenanceConfiguration(destination *storage.MaintenanceConfiguration) error {

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/managedClusters.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}
type MaintenanceConfigurationList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []MaintenanceConfiguration `json:"items"`
}

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

const APIVersion_Value = APIVersion("2024-09-01")

type MaintenanceConfiguration_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"`

	// MaintenanceWindow: Maintenance window for the maintenance configuration.
	MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`

	// NotAllowedTime: Time slots on which upgrade is not allowed.
	NotAllowedTime []TimeSpan `json:"notAllowedTime,omitempty"`

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

	// TimeInWeek: If two array entries specify the same day of the week, the applied configuration is the union of times in
	// both entries.
	TimeInWeek []TimeInWeek `json:"timeInWeek,omitempty"`
}

var _ genruntime.ARMTransformer = &MaintenanceConfiguration_Spec{}

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

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

	// Set property "Properties":
	if configuration.MaintenanceWindow != nil ||
		configuration.NotAllowedTime != nil ||
		configuration.TimeInWeek != nil {
		result.Properties = &arm.MaintenanceConfigurationProperties{}
	}
	if configuration.MaintenanceWindow != nil {
		maintenanceWindow_ARM, err := configuration.MaintenanceWindow.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		maintenanceWindow := *maintenanceWindow_ARM.(*arm.MaintenanceWindow)
		result.Properties.MaintenanceWindow = &maintenanceWindow
	}
	for _, item := range configuration.NotAllowedTime {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.NotAllowedTime = append(result.Properties.NotAllowedTime, *item_ARM.(*arm.TimeSpan))
	}
	for _, item := range configuration.TimeInWeek {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.TimeInWeek = append(result.Properties.TimeInWeek, *item_ARM.(*arm.TimeInWeek))
	}
	return result, nil
}

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

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

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

	// Set property "MaintenanceWindow":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MaintenanceWindow != nil {
			var maintenanceWindow1 MaintenanceWindow
			err := maintenanceWindow1.PopulateFromARM(owner, *typedInput.Properties.MaintenanceWindow)
			if err != nil {
				return err
			}
			maintenanceWindow := maintenanceWindow1
			configuration.MaintenanceWindow = &maintenanceWindow
		}
	}

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

	// no assignment for property "OperatorSpec"

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

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

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &MaintenanceConfiguration_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.MaintenanceConfiguration_Spec{}
	err := configuration.AssignProperties_To_MaintenanceConfiguration_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_MaintenanceConfiguration_Spec populates our MaintenanceConfiguration_Spec from the provided source MaintenanceConfiguration_Spec
func (configuration *MaintenanceConfiguration_Spec) AssignProperties_From_MaintenanceConfiguration_Spec(source *storage.MaintenanceConfiguration_Spec) error {

	// AzureName
	configuration.AzureName = source.AzureName

	// MaintenanceWindow
	if source.MaintenanceWindow != nil {
		var maintenanceWindow MaintenanceWindow
		err := maintenanceWindow.AssignProperties_From_MaintenanceWindow(source.MaintenanceWindow)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_MaintenanceWindow() to populate field MaintenanceWindow")
		}
		configuration.MaintenanceWindow = &maintenanceWindow
	} else {
		configuration.MaintenanceWindow = nil
	}

	// NotAllowedTime
	if source.NotAllowedTime != nil {
		notAllowedTimeList := make([]TimeSpan, len(source.NotAllowedTime))
		for notAllowedTimeIndex, notAllowedTimeItem := range source.NotAllowedTime {
			var notAllowedTime TimeSpan
			err := notAllowedTime.AssignProperties_From_TimeSpan(&notAllowedTimeItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_TimeSpan() to populate field NotAllowedTime")
			}
			notAllowedTimeList[notAllowedTimeIndex] = notAllowedTime
		}
		configuration.NotAllowedTime = notAllowedTimeList
	} else {
		configuration.NotAllowedTime = nil
	}

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

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

	// TimeInWeek
	if source.TimeInWeek != nil {
		timeInWeekList := make([]TimeInWeek, len(source.TimeInWeek))
		for timeInWeekIndex, timeInWeekItem := range source.TimeInWeek {
			var timeInWeek TimeInWeek
			err := timeInWeek.AssignProperties_From_TimeInWeek(&timeInWeekItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_TimeInWeek() to populate field TimeInWeek")
			}
			timeInWeekList[timeInWeekIndex] = timeInWeek
		}
		configuration.TimeInWeek = timeInWeekList
	} else {
		configuration.TimeInWeek = nil
	}

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = configuration.AzureName

	// MaintenanceWindow
	if configuration.MaintenanceWindow != nil {
		var maintenanceWindow storage.MaintenanceWindow
		err := configuration.MaintenanceWindow.AssignProperties_To_MaintenanceWindow(&maintenanceWindow)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_MaintenanceWindow() to populate field MaintenanceWindow")
		}
		destination.MaintenanceWindow = &maintenanceWindow
	} else {
		destination.MaintenanceWindow = nil
	}

	// NotAllowedTime
	if configuration.NotAllowedTime != nil {
		notAllowedTimeList := make([]storage.TimeSpan, len(configuration.NotAllowedTime))
		for notAllowedTimeIndex, notAllowedTimeItem := range configuration.NotAllowedTime {
			var notAllowedTime storage.TimeSpan
			err := notAllowedTimeItem.AssignProperties_To_TimeSpan(&notAllowedTime)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_TimeSpan() to populate field NotAllowedTime")
			}
			notAllowedTimeList[notAllowedTimeIndex] = notAllowedTime
		}
		destination.NotAllowedTime = notAllowedTimeList
	} else {
		destination.NotAllowedTime = nil
	}

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

	// OriginalVersion
	destination.OriginalVersion = configuration.OriginalVersion()

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

	// TimeInWeek
	if configuration.TimeInWeek != nil {
		timeInWeekList := make([]storage.TimeInWeek, len(configuration.TimeInWeek))
		for timeInWeekIndex, timeInWeekItem := range configuration.TimeInWeek {
			var timeInWeek storage.TimeInWeek
			err := timeInWeekItem.AssignProperties_To_TimeInWeek(&timeInWeek)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_TimeInWeek() to populate field TimeInWeek")
			}
			timeInWeekList[timeInWeekIndex] = timeInWeek
		}
		destination.TimeInWeek = timeInWeekList
	} else {
		destination.TimeInWeek = nil
	}

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

	// No error
	return nil
}

// Initialize_From_MaintenanceConfiguration_STATUS populates our MaintenanceConfiguration_Spec from the provided source MaintenanceConfiguration_STATUS
func (configuration *MaintenanceConfiguration_Spec) Initialize_From_MaintenanceConfiguration_STATUS(source *MaintenanceConfiguration_STATUS) error {

	// MaintenanceWindow
	if source.MaintenanceWindow != nil {
		var maintenanceWindow MaintenanceWindow
		err := maintenanceWindow.Initialize_From_MaintenanceWindow_STATUS(source.MaintenanceWindow)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_MaintenanceWindow_STATUS() to populate field MaintenanceWindow")
		}
		configuration.MaintenanceWindow = &maintenanceWindow
	} else {
		configuration.MaintenanceWindow = nil
	}

	// NotAllowedTime
	if source.NotAllowedTime != nil {
		notAllowedTimeList := make([]TimeSpan, len(source.NotAllowedTime))
		for notAllowedTimeIndex, notAllowedTimeItem := range source.NotAllowedTime {
			var notAllowedTime TimeSpan
			err := notAllowedTime.Initialize_From_TimeSpan_STATUS(&notAllowedTimeItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_TimeSpan_STATUS() to populate field NotAllowedTime")
			}
			notAllowedTimeList[notAllowedTimeIndex] = notAllowedTime
		}
		configuration.NotAllowedTime = notAllowedTimeList
	} else {
		configuration.NotAllowedTime = nil
	}

	// TimeInWeek
	if source.TimeInWeek != nil {
		timeInWeekList := make([]TimeInWeek, len(source.TimeInWeek))
		for timeInWeekIndex, timeInWeekItem := range source.TimeInWeek {
			var timeInWeek TimeInWeek
			err := timeInWeek.Initialize_From_TimeInWeek_STATUS(&timeInWeekItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_TimeInWeek_STATUS() to populate field TimeInWeek")
			}
			timeInWeekList[timeInWeekIndex] = timeInWeek
		}
		configuration.TimeInWeek = timeInWeekList
	} else {
		configuration.TimeInWeek = nil
	}

	// No error
	return nil
}

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

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

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

	// Id: Resource ID.
	Id *string `json:"id,omitempty"`

	// MaintenanceWindow: Maintenance window for the maintenance configuration.
	MaintenanceWindow *MaintenanceWindow_STATUS `json:"maintenanceWindow,omitempty"`

	// Name: The name of the resource that is unique within a resource group. This name can be used to access the resource.
	Name *string `json:"name,omitempty"`

	// NotAllowedTime: Time slots on which upgrade is not allowed.
	NotAllowedTime []TimeSpan_STATUS `json:"notAllowedTime,omitempty"`

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

	// TimeInWeek: If two array entries specify the same day of the week, the applied configuration is the union of times in
	// both entries.
	TimeInWeek []TimeInWeek_STATUS `json:"timeInWeek,omitempty"`

	// Type: Resource type
	Type *string `json:"type,omitempty"`
}

var _ genruntime.ConvertibleStatus = &MaintenanceConfiguration_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.MaintenanceConfiguration_STATUS{}
	err := configuration.AssignProperties_To_MaintenanceConfiguration_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 = &MaintenanceConfiguration_STATUS{}

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

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

	// no assignment for property "Conditions"

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

	// Set property "MaintenanceWindow":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MaintenanceWindow != nil {
			var maintenanceWindow1 MaintenanceWindow_STATUS
			err := maintenanceWindow1.PopulateFromARM(owner, *typedInput.Properties.MaintenanceWindow)
			if err != nil {
				return err
			}
			maintenanceWindow := maintenanceWindow1
			configuration.MaintenanceWindow = &maintenanceWindow
		}
	}

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

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

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

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

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

	// No error
	return nil
}

// AssignProperties_From_MaintenanceConfiguration_STATUS populates our MaintenanceConfiguration_STATUS from the provided source MaintenanceConfiguration_STATUS
func (configuration *MaintenanceConfiguration_STATUS) AssignProperties_From_MaintenanceConfiguration_STATUS(source *storage.MaintenanceConfiguration_STATUS) error {

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

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

	// MaintenanceWindow
	if source.MaintenanceWindow != nil {
		var maintenanceWindow MaintenanceWindow_STATUS
		err := maintenanceWindow.AssignProperties_From_MaintenanceWindow_STATUS(source.MaintenanceWindow)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_MaintenanceWindow_STATUS() to populate field MaintenanceWindow")
		}
		configuration.MaintenanceWindow = &maintenanceWindow
	} else {
		configuration.MaintenanceWindow = nil
	}

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

	// NotAllowedTime
	if source.NotAllowedTime != nil {
		notAllowedTimeList := make([]TimeSpan_STATUS, len(source.NotAllowedTime))
		for notAllowedTimeIndex, notAllowedTimeItem := range source.NotAllowedTime {
			var notAllowedTime TimeSpan_STATUS
			err := notAllowedTime.AssignProperties_From_TimeSpan_STATUS(&notAllowedTimeItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_TimeSpan_STATUS() to populate field NotAllowedTime")
			}
			notAllowedTimeList[notAllowedTimeIndex] = notAllowedTime
		}
		configuration.NotAllowedTime = notAllowedTimeList
	} else {
		configuration.NotAllowedTime = 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")
		}
		configuration.SystemData = &systemDatum
	} else {
		configuration.SystemData = nil
	}

	// TimeInWeek
	if source.TimeInWeek != nil {
		timeInWeekList := make([]TimeInWeek_STATUS, len(source.TimeInWeek))
		for timeInWeekIndex, timeInWeekItem := range source.TimeInWeek {
			var timeInWeek TimeInWeek_STATUS
			err := timeInWeek.AssignProperties_From_TimeInWeek_STATUS(&timeInWeekItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_TimeInWeek_STATUS() to populate field TimeInWeek")
			}
			timeInWeekList[timeInWeekIndex] = timeInWeek
		}
		configuration.TimeInWeek = timeInWeekList
	} else {
		configuration.TimeInWeek = nil
	}

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

	// No error
	return nil
}

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

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

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

	// MaintenanceWindow
	if configuration.MaintenanceWindow != nil {
		var maintenanceWindow storage.MaintenanceWindow_STATUS
		err := configuration.MaintenanceWindow.AssignProperties_To_MaintenanceWindow_STATUS(&maintenanceWindow)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_MaintenanceWindow_STATUS() to populate field MaintenanceWindow")
		}
		destination.MaintenanceWindow = &maintenanceWindow
	} else {
		destination.MaintenanceWindow = nil
	}

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

	// NotAllowedTime
	if configuration.NotAllowedTime != nil {
		notAllowedTimeList := make([]storage.TimeSpan_STATUS, len(configuration.NotAllowedTime))
		for notAllowedTimeIndex, notAllowedTimeItem := range configuration.NotAllowedTime {
			var notAllowedTime storage.TimeSpan_STATUS
			err := notAllowedTimeItem.AssignProperties_To_TimeSpan_STATUS(&notAllowedTime)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_TimeSpan_STATUS() to populate field NotAllowedTime")
			}
			notAllowedTimeList[notAllowedTimeIndex] = notAllowedTime
		}
		destination.NotAllowedTime = notAllowedTimeList
	} else {
		destination.NotAllowedTime = nil
	}

	// SystemData
	if configuration.SystemData != nil {
		var systemDatum storage.SystemData_STATUS
		err := configuration.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
	}

	// TimeInWeek
	if configuration.TimeInWeek != nil {
		timeInWeekList := make([]storage.TimeInWeek_STATUS, len(configuration.TimeInWeek))
		for timeInWeekIndex, timeInWeekItem := range configuration.TimeInWeek {
			var timeInWeek storage.TimeInWeek_STATUS
			err := timeInWeekItem.AssignProperties_To_TimeInWeek_STATUS(&timeInWeek)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_TimeInWeek_STATUS() to populate field TimeInWeek")
			}
			timeInWeekList[timeInWeekIndex] = timeInWeek
		}
		destination.TimeInWeek = timeInWeekList
	} else {
		destination.TimeInWeek = nil
	}

	// Type
	destination.Type = genruntime.ClonePointerToString(configuration.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 MaintenanceConfigurationOperatorSpec 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_MaintenanceConfigurationOperatorSpec populates our MaintenanceConfigurationOperatorSpec from the provided source MaintenanceConfigurationOperatorSpec
func (operator *MaintenanceConfigurationOperatorSpec) AssignProperties_From_MaintenanceConfigurationOperatorSpec(source *storage.MaintenanceConfigurationOperatorSpec) 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_MaintenanceConfigurationOperatorSpec populates the provided destination MaintenanceConfigurationOperatorSpec from our MaintenanceConfigurationOperatorSpec
func (operator *MaintenanceConfigurationOperatorSpec) AssignProperties_To_MaintenanceConfigurationOperatorSpec(destination *storage.MaintenanceConfigurationOperatorSpec) 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
}

// Maintenance window used to configure scheduled auto-upgrade for a Managed Cluster.
type MaintenanceWindow struct {
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Maximum=24
	// +kubebuilder:validation:Minimum=4
	// DurationHours: Length of maintenance window range from 4 to 24 hours.
	DurationHours *int `json:"durationHours,omitempty"`

	// NotAllowedDates: Date ranges on which upgrade is not allowed. 'utcOffset' applies to this field. For example, with
	// 'utcOffset: +02:00' and 'dateSpan' being '2022-12-23' to '2023-01-03', maintenance will be blocked from '2022-12-22
	// 22:00' to '2023-01-03 22:00' in UTC time.
	NotAllowedDates []DateSpan `json:"notAllowedDates,omitempty"`

	// +kubebuilder:validation:Required
	// Schedule: Recurrence schedule for the maintenance window.
	Schedule *Schedule `json:"schedule,omitempty"`

	// StartDate: The date the maintenance window activates. If the current date is before this date, the maintenance window is
	// inactive and will not be used for upgrades. If not specified, the maintenance window will be active right away.
	StartDate *string `json:"startDate,omitempty"`

	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Pattern="^\\d{2}:\\d{2}$"
	// StartTime: The start time of the maintenance window. Accepted values are from '00:00' to '23:59'. 'utcOffset' applies to
	// this field. For example: '02:00' with 'utcOffset: +02:00' means UTC time '00:00'.
	StartTime *string `json:"startTime,omitempty"`

	// +kubebuilder:validation:Pattern="^(-|\\+)[0-9]{2}:[0-9]{2}$"
	// UtcOffset: The UTC offset in format +/-HH:mm. For example, '+05:30' for IST and '-07:00' for PST. If not specified, the
	// default is '+00:00'.
	UtcOffset *string `json:"utcOffset,omitempty"`
}

var _ genruntime.ARMTransformer = &MaintenanceWindow{}

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

	// Set property "DurationHours":
	if window.DurationHours != nil {
		durationHours := *window.DurationHours
		result.DurationHours = &durationHours
	}

	// Set property "NotAllowedDates":
	for _, item := range window.NotAllowedDates {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.NotAllowedDates = append(result.NotAllowedDates, *item_ARM.(*arm.DateSpan))
	}

	// Set property "Schedule":
	if window.Schedule != nil {
		schedule_ARM, err := window.Schedule.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		schedule := *schedule_ARM.(*arm.Schedule)
		result.Schedule = &schedule
	}

	// Set property "StartDate":
	if window.StartDate != nil {
		startDate := *window.StartDate
		result.StartDate = &startDate
	}

	// Set property "StartTime":
	if window.StartTime != nil {
		startTime := *window.StartTime
		result.StartTime = &startTime
	}

	// Set property "UtcOffset":
	if window.UtcOffset != nil {
		utcOffset := *window.UtcOffset
		result.UtcOffset = &utcOffset
	}
	return result, nil
}

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

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

	// Set property "DurationHours":
	if typedInput.DurationHours != nil {
		durationHours := *typedInput.DurationHours
		window.DurationHours = &durationHours
	}

	// Set property "NotAllowedDates":
	for _, item := range typedInput.NotAllowedDates {
		var item1 DateSpan
		err := item1.PopulateFromARM(owner, item)
		if err != nil {
			return err
		}
		window.NotAllowedDates = append(window.NotAllowedDates, item1)
	}

	// Set property "Schedule":
	if typedInput.Schedule != nil {
		var schedule1 Schedule
		err := schedule1.PopulateFromARM(owner, *typedInput.Schedule)
		if err != nil {
			return err
		}
		schedule := schedule1
		window.Schedule = &schedule
	}

	// Set property "StartDate":
	if typedInput.StartDate != nil {
		startDate := *typedInput.StartDate
		window.StartDate = &startDate
	}

	// Set property "StartTime":
	if typedInput.StartTime != nil {
		startTime := *typedInput.StartTime
		window.StartTime = &startTime
	}

	// Set property "UtcOffset":
	if typedInput.UtcOffset != nil {
		utcOffset := *typedInput.UtcOffset
		window.UtcOffset = &utcOffset
	}

	// No error
	return nil
}

// AssignProperties_From_MaintenanceWindow populates our MaintenanceWindow from the provided source MaintenanceWindow
func (window *MaintenanceWindow) AssignProperties_From_MaintenanceWindow(source *storage.MaintenanceWindow) error {

	// DurationHours
	window.DurationHours = genruntime.ClonePointerToInt(source.DurationHours)

	// NotAllowedDates
	if source.NotAllowedDates != nil {
		notAllowedDateList := make([]DateSpan, len(source.NotAllowedDates))
		for notAllowedDateIndex, notAllowedDateItem := range source.NotAllowedDates {
			var notAllowedDate DateSpan
			err := notAllowedDate.AssignProperties_From_DateSpan(&notAllowedDateItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_DateSpan() to populate field NotAllowedDates")
			}
			notAllowedDateList[notAllowedDateIndex] = notAllowedDate
		}
		window.NotAllowedDates = notAllowedDateList
	} else {
		window.NotAllowedDates = nil
	}

	// Schedule
	if source.Schedule != nil {
		var schedule Schedule
		err := schedule.AssignProperties_From_Schedule(source.Schedule)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Schedule() to populate field Schedule")
		}
		window.Schedule = &schedule
	} else {
		window.Schedule = nil
	}

	// StartDate
	window.StartDate = genruntime.ClonePointerToString(source.StartDate)

	// StartTime
	window.StartTime = genruntime.ClonePointerToString(source.StartTime)

	// UtcOffset
	window.UtcOffset = genruntime.ClonePointerToString(source.UtcOffset)

	// No error
	return nil
}

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

	// DurationHours
	destination.DurationHours = genruntime.ClonePointerToInt(window.DurationHours)

	// NotAllowedDates
	if window.NotAllowedDates != nil {
		notAllowedDateList := make([]storage.DateSpan, len(window.NotAllowedDates))
		for notAllowedDateIndex, notAllowedDateItem := range window.NotAllowedDates {
			var notAllowedDate storage.DateSpan
			err := notAllowedDateItem.AssignProperties_To_DateSpan(&notAllowedDate)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_DateSpan() to populate field NotAllowedDates")
			}
			notAllowedDateList[notAllowedDateIndex] = notAllowedDate
		}
		destination.NotAllowedDates = notAllowedDateList
	} else {
		destination.NotAllowedDates = nil
	}

	// Schedule
	if window.Schedule != nil {
		var schedule storage.Schedule
		err := window.Schedule.AssignProperties_To_Schedule(&schedule)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Schedule() to populate field Schedule")
		}
		destination.Schedule = &schedule
	} else {
		destination.Schedule = nil
	}

	// StartDate
	destination.StartDate = genruntime.ClonePointerToString(window.StartDate)

	// StartTime
	destination.StartTime = genruntime.ClonePointerToString(window.StartTime)

	// UtcOffset
	destination.UtcOffset = genruntime.ClonePointerToString(window.UtcOffset)

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

	// No error
	return nil
}

// Initialize_From_MaintenanceWindow_STATUS populates our MaintenanceWindow from the provided source MaintenanceWindow_STATUS
func (window *MaintenanceWindow) Initialize_From_MaintenanceWindow_STATUS(source *MaintenanceWindow_STATUS) error {

	// DurationHours
	window.DurationHours = genruntime.ClonePointerToInt(source.DurationHours)

	// NotAllowedDates
	if source.NotAllowedDates != nil {
		notAllowedDateList := make([]DateSpan, len(source.NotAllowedDates))
		for notAllowedDateIndex, notAllowedDateItem := range source.NotAllowedDates {
			var notAllowedDate DateSpan
			err := notAllowedDate.Initialize_From_DateSpan_STATUS(&notAllowedDateItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_DateSpan_STATUS() to populate field NotAllowedDates")
			}
			notAllowedDateList[notAllowedDateIndex] = notAllowedDate
		}
		window.NotAllowedDates = notAllowedDateList
	} else {
		window.NotAllowedDates = nil
	}

	// Schedule
	if source.Schedule != nil {
		var schedule Schedule
		err := schedule.Initialize_From_Schedule_STATUS(source.Schedule)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_Schedule_STATUS() to populate field Schedule")
		}
		window.Schedule = &schedule
	} else {
		window.Schedule = nil
	}

	// StartDate
	window.StartDate = genruntime.ClonePointerToString(source.StartDate)

	// StartTime
	window.StartTime = genruntime.ClonePointerToString(source.StartTime)

	// UtcOffset
	window.UtcOffset = genruntime.ClonePointerToString(source.UtcOffset)

	// No error
	return nil
}

// Maintenance window used to configure scheduled auto-upgrade for a Managed Cluster.
type MaintenanceWindow_STATUS struct {
	// DurationHours: Length of maintenance window range from 4 to 24 hours.
	DurationHours *int `json:"durationHours,omitempty"`

	// NotAllowedDates: Date ranges on which upgrade is not allowed. 'utcOffset' applies to this field. For example, with
	// 'utcOffset: +02:00' and 'dateSpan' being '2022-12-23' to '2023-01-03', maintenance will be blocked from '2022-12-22
	// 22:00' to '2023-01-03 22:00' in UTC time.
	NotAllowedDates []DateSpan_STATUS `json:"notAllowedDates,omitempty"`

	// Schedule: Recurrence schedule for the maintenance window.
	Schedule *Schedule_STATUS `json:"schedule,omitempty"`

	// StartDate: The date the maintenance window activates. If the current date is before this date, the maintenance window is
	// inactive and will not be used for upgrades. If not specified, the maintenance window will be active right away.
	StartDate *string `json:"startDate,omitempty"`

	// StartTime: The start time of the maintenance window. Accepted values are from '00:00' to '23:59'. 'utcOffset' applies to
	// this field. For example: '02:00' with 'utcOffset: +02:00' means UTC time '00:00'.
	StartTime *string `json:"startTime,omitempty"`

	// UtcOffset: The UTC offset in format +/-HH:mm. For example, '+05:30' for IST and '-07:00' for PST. If not specified, the
	// default is '+00:00'.
	UtcOffset *string `json:"utcOffset,omitempty"`
}

var _ genruntime.FromARMConverter = &MaintenanceWindow_STATUS{}

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

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

	// Set property "DurationHours":
	if typedInput.DurationHours != nil {
		durationHours := *typedInput.DurationHours
		window.DurationHours = &durationHours
	}

	// Set property "NotAllowedDates":
	for _, item := range typedInput.NotAllowedDates {
		var item1 DateSpan_STATUS
		err := item1.PopulateFromARM(owner, item)
		if err != nil {
			return err
		}
		window.NotAllowedDates = append(window.NotAllowedDates, item1)
	}

	// Set property "Schedule":
	if typedInput.Schedule != nil {
		var schedule1 Schedule_STATUS
		err := schedule1.PopulateFromARM(owner, *typedInput.Schedule)
		if err != nil {
			return err
		}
		schedule := schedule1
		window.Schedule = &schedule
	}

	// Set property "StartDate":
	if typedInput.StartDate != nil {
		startDate := *typedInput.StartDate
		window.StartDate = &startDate
	}

	// Set property "StartTime":
	if typedInput.StartTime != nil {
		startTime := *typedInput.StartTime
		window.StartTime = &startTime
	}

	// Set property "UtcOffset":
	if typedInput.UtcOffset != nil {
		utcOffset := *typedInput.UtcOffset
		window.UtcOffset = &utcOffset
	}

	// No error
	return nil
}

// AssignProperties_From_MaintenanceWindow_STATUS populates our MaintenanceWindow_STATUS from the provided source MaintenanceWindow_STATUS
func (window *MaintenanceWindow_STATUS) AssignProperties_From_MaintenanceWindow_STATUS(source *storage.MaintenanceWindow_STATUS) error {

	// DurationHours
	window.DurationHours = genruntime.ClonePointerToInt(source.DurationHours)

	// NotAllowedDates
	if source.NotAllowedDates != nil {
		notAllowedDateList := make([]DateSpan_STATUS, len(source.NotAllowedDates))
		for notAllowedDateIndex, notAllowedDateItem := range source.NotAllowedDates {
			var notAllowedDate DateSpan_STATUS
			err := notAllowedDate.AssignProperties_From_DateSpan_STATUS(&notAllowedDateItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_DateSpan_STATUS() to populate field NotAllowedDates")
			}
			notAllowedDateList[notAllowedDateIndex] = notAllowedDate
		}
		window.NotAllowedDates = notAllowedDateList
	} else {
		window.NotAllowedDates = nil
	}

	// Schedule
	if source.Schedule != nil {
		var schedule Schedule_STATUS
		err := schedule.AssignProperties_From_Schedule_STATUS(source.Schedule)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Schedule_STATUS() to populate field Schedule")
		}
		window.Schedule = &schedule
	} else {
		window.Schedule = nil
	}

	// StartDate
	window.StartDate = genruntime.ClonePointerToString(source.StartDate)

	// StartTime
	window.StartTime = genruntime.ClonePointerToString(source.StartTime)

	// UtcOffset
	window.UtcOffset = genruntime.ClonePointerToString(source.UtcOffset)

	// No error
	return nil
}

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

	// DurationHours
	destination.DurationHours = genruntime.ClonePointerToInt(window.DurationHours)

	// NotAllowedDates
	if window.NotAllowedDates != nil {
		notAllowedDateList := make([]storage.DateSpan_STATUS, len(window.NotAllowedDates))
		for notAllowedDateIndex, notAllowedDateItem := range window.NotAllowedDates {
			var notAllowedDate storage.DateSpan_STATUS
			err := notAllowedDateItem.AssignProperties_To_DateSpan_STATUS(&notAllowedDate)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_DateSpan_STATUS() to populate field NotAllowedDates")
			}
			notAllowedDateList[notAllowedDateIndex] = notAllowedDate
		}
		destination.NotAllowedDates = notAllowedDateList
	} else {
		destination.NotAllowedDates = nil
	}

	// Schedule
	if window.Schedule != nil {
		var schedule storage.Schedule_STATUS
		err := window.Schedule.AssignProperties_To_Schedule_STATUS(&schedule)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Schedule_STATUS() to populate field Schedule")
		}
		destination.Schedule = &schedule
	} else {
		destination.Schedule = nil
	}

	// StartDate
	destination.StartDate = genruntime.ClonePointerToString(window.StartDate)

	// StartTime
	destination.StartTime = genruntime.ClonePointerToString(window.StartTime)

	// UtcOffset
	destination.UtcOffset = genruntime.ClonePointerToString(window.UtcOffset)

	// 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
}

// Time in a week.
type TimeInWeek struct {
	// Day: The day of the week.
	Day *WeekDay `json:"day,omitempty"`

	// HourSlots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour
	// (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC
	// time range.
	HourSlots []HourInDay `json:"hourSlots,omitempty"`
}

var _ genruntime.ARMTransformer = &TimeInWeek{}

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

	// Set property "Day":
	if week.Day != nil {
		var temp string
		temp = string(*week.Day)
		day := arm.WeekDay(temp)
		result.Day = &day
	}

	// Set property "HourSlots":
	for _, item := range week.HourSlots {
		result.HourSlots = append(result.HourSlots, int(item))
	}
	return result, nil
}

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

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

	// Set property "Day":
	if typedInput.Day != nil {
		var temp string
		temp = string(*typedInput.Day)
		day := WeekDay(temp)
		week.Day = &day
	}

	// Set property "HourSlots":
	for _, item := range typedInput.HourSlots {
		week.HourSlots = append(week.HourSlots, HourInDay(item))
	}

	// No error
	return nil
}

// AssignProperties_From_TimeInWeek populates our TimeInWeek from the provided source TimeInWeek
func (week *TimeInWeek) AssignProperties_From_TimeInWeek(source *storage.TimeInWeek) error {

	// Day
	if source.Day != nil {
		day := *source.Day
		dayTemp := genruntime.ToEnum(day, weekDay_Values)
		week.Day = &dayTemp
	} else {
		week.Day = nil
	}

	// HourSlots
	if source.HourSlots != nil {
		hourSlotList := make([]HourInDay, len(source.HourSlots))
		for hourSlotIndex, hourSlotItem := range source.HourSlots {
			hourSlotList[hourSlotIndex] = HourInDay(hourSlotItem)
		}
		week.HourSlots = hourSlotList
	} else {
		week.HourSlots = nil
	}

	// No error
	return nil
}

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

	// Day
	if week.Day != nil {
		day := string(*week.Day)
		destination.Day = &day
	} else {
		destination.Day = nil
	}

	// HourSlots
	if week.HourSlots != nil {
		hourSlotList := make([]int, len(week.HourSlots))
		for hourSlotIndex, hourSlotItem := range week.HourSlots {
			hourSlotList[hourSlotIndex] = int(hourSlotItem)
		}
		destination.HourSlots = hourSlotList
	} else {
		destination.HourSlots = nil
	}

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

	// No error
	return nil
}

// Initialize_From_TimeInWeek_STATUS populates our TimeInWeek from the provided source TimeInWeek_STATUS
func (week *TimeInWeek) Initialize_From_TimeInWeek_STATUS(source *TimeInWeek_STATUS) error {

	// Day
	if source.Day != nil {
		day := genruntime.ToEnum(string(*source.Day), weekDay_Values)
		week.Day = &day
	} else {
		week.Day = nil
	}

	// HourSlots
	if source.HourSlots != nil {
		hourSlotList := make([]HourInDay, len(source.HourSlots))
		for hourSlotIndex, hourSlotItem := range source.HourSlots {
			hourSlotList[hourSlotIndex] = HourInDay(hourSlotItem)
		}
		week.HourSlots = hourSlotList
	} else {
		week.HourSlots = nil
	}

	// No error
	return nil
}

// Time in a week.
type TimeInWeek_STATUS struct {
	// Day: The day of the week.
	Day *WeekDay_STATUS `json:"day,omitempty"`

	// HourSlots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour
	// (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC
	// time range.
	HourSlots []int `json:"hourSlots,omitempty"`
}

var _ genruntime.FromARMConverter = &TimeInWeek_STATUS{}

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

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

	// Set property "Day":
	if typedInput.Day != nil {
		var temp string
		temp = string(*typedInput.Day)
		day := WeekDay_STATUS(temp)
		week.Day = &day
	}

	// Set property "HourSlots":
	for _, item := range typedInput.HourSlots {
		week.HourSlots = append(week.HourSlots, item)
	}

	// No error
	return nil
}

// AssignProperties_From_TimeInWeek_STATUS populates our TimeInWeek_STATUS from the provided source TimeInWeek_STATUS
func (week *TimeInWeek_STATUS) AssignProperties_From_TimeInWeek_STATUS(source *storage.TimeInWeek_STATUS) error {

	// Day
	if source.Day != nil {
		day := *source.Day
		dayTemp := genruntime.ToEnum(day, weekDay_STATUS_Values)
		week.Day = &dayTemp
	} else {
		week.Day = nil
	}

	// HourSlots
	if source.HourSlots != nil {
		hourSlotList := make([]int, len(source.HourSlots))
		for hourSlotIndex, hourSlotItem := range source.HourSlots {
			hourSlotList[hourSlotIndex] = hourSlotItem
		}
		week.HourSlots = hourSlotList
	} else {
		week.HourSlots = nil
	}

	// No error
	return nil
}

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

	// Day
	if week.Day != nil {
		day := string(*week.Day)
		destination.Day = &day
	} else {
		destination.Day = nil
	}

	// HourSlots
	if week.HourSlots != nil {
		hourSlotList := make([]int, len(week.HourSlots))
		for hourSlotIndex, hourSlotItem := range week.HourSlots {
			hourSlotList[hourSlotIndex] = hourSlotItem
		}
		destination.HourSlots = hourSlotList
	} else {
		destination.HourSlots = nil
	}

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

	// No error
	return nil
}

// For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z.
type TimeSpan struct {
	// End: The end of a time span
	End *string `json:"end,omitempty"`

	// Start: The start of a time span
	Start *string `json:"start,omitempty"`
}

var _ genruntime.ARMTransformer = &TimeSpan{}

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

	// Set property "End":
	if span.End != nil {
		end := *span.End
		result.End = &end
	}

	// Set property "Start":
	if span.Start != nil {
		start := *span.Start
		result.Start = &start
	}
	return result, nil
}

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

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

	// Set property "End":
	if typedInput.End != nil {
		end := *typedInput.End
		span.End = &end
	}

	// Set property "Start":
	if typedInput.Start != nil {
		start := *typedInput.Start
		span.Start = &start
	}

	// No error
	return nil
}

// AssignProperties_From_TimeSpan populates our TimeSpan from the provided source TimeSpan
func (span *TimeSpan) AssignProperties_From_TimeSpan(source *storage.TimeSpan) error {

	// End
	span.End = genruntime.ClonePointerToString(source.End)

	// Start
	span.Start = genruntime.ClonePointerToString(source.Start)

	// No error
	return nil
}

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

	// End
	destination.End = genruntime.ClonePointerToString(span.End)

	// Start
	destination.Start = genruntime.ClonePointerToString(span.Start)

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

	// No error
	return nil
}

// Initialize_From_TimeSpan_STATUS populates our TimeSpan from the provided source TimeSpan_STATUS
func (span *TimeSpan) Initialize_From_TimeSpan_STATUS(source *TimeSpan_STATUS) error {

	// End
	span.End = genruntime.ClonePointerToString(source.End)

	// Start
	span.Start = genruntime.ClonePointerToString(source.Start)

	// No error
	return nil
}

// For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z.
type TimeSpan_STATUS struct {
	// End: The end of a time span
	End *string `json:"end,omitempty"`

	// Start: The start of a time span
	Start *string `json:"start,omitempty"`
}

var _ genruntime.FromARMConverter = &TimeSpan_STATUS{}

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

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

	// Set property "End":
	if typedInput.End != nil {
		end := *typedInput.End
		span.End = &end
	}

	// Set property "Start":
	if typedInput.Start != nil {
		start := *typedInput.Start
		span.Start = &start
	}

	// No error
	return nil
}

// AssignProperties_From_TimeSpan_STATUS populates our TimeSpan_STATUS from the provided source TimeSpan_STATUS
func (span *TimeSpan_STATUS) AssignProperties_From_TimeSpan_STATUS(source *storage.TimeSpan_STATUS) error {

	// End
	span.End = genruntime.ClonePointerToString(source.End)

	// Start
	span.Start = genruntime.ClonePointerToString(source.Start)

	// No error
	return nil
}

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

	// End
	destination.End = genruntime.ClonePointerToString(span.End)

	// Start
	destination.Start = genruntime.ClonePointerToString(span.Start)

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

	// No error
	return nil
}

// For example, between '2022-12-23' and '2023-01-05'.
type DateSpan struct {
	// +kubebuilder:validation:Required
	// End: The end date of the date span.
	End *string `json:"end,omitempty"`

	// +kubebuilder:validation:Required
	// Start: The start date of the date span.
	Start *string `json:"start,omitempty"`
}

var _ genruntime.ARMTransformer = &DateSpan{}

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

	// Set property "End":
	if span.End != nil {
		end := *span.End
		result.End = &end
	}

	// Set property "Start":
	if span.Start != nil {
		start := *span.Start
		result.Start = &start
	}
	return result, nil
}

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

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

	// Set property "End":
	if typedInput.End != nil {
		end := *typedInput.End
		span.End = &end
	}

	// Set property "Start":
	if typedInput.Start != nil {
		start := *typedInput.Start
		span.Start = &start
	}

	// No error
	return nil
}

// AssignProperties_From_DateSpan populates our DateSpan from the provided source DateSpan
func (span *DateSpan) AssignProperties_From_DateSpan(source *storage.DateSpan) error {

	// End
	span.End = genruntime.ClonePointerToString(source.End)

	// Start
	span.Start = genruntime.ClonePointerToString(source.Start)

	// No error
	return nil
}

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

	// End
	destination.End = genruntime.ClonePointerToString(span.End)

	// Start
	destination.Start = genruntime.ClonePointerToString(span.Start)

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

	// No error
	return nil
}

// Initialize_From_DateSpan_STATUS populates our DateSpan from the provided source DateSpan_STATUS
func (span *DateSpan) Initialize_From_DateSpan_STATUS(source *DateSpan_STATUS) error {

	// End
	span.End = genruntime.ClonePointerToString(source.End)

	// Start
	span.Start = genruntime.ClonePointerToString(source.Start)

	// No error
	return nil
}

// For example, between '2022-12-23' and '2023-01-05'.
type DateSpan_STATUS struct {
	// End: The end date of the date span.
	End *string `json:"end,omitempty"`

	// Start: The start date of the date span.
	Start *string `json:"start,omitempty"`
}

var _ genruntime.FromARMConverter = &DateSpan_STATUS{}

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

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

	// Set property "End":
	if typedInput.End != nil {
		end := *typedInput.End
		span.End = &end
	}

	// Set property "Start":
	if typedInput.Start != nil {
		start := *typedInput.Start
		span.Start = &start
	}

	// No error
	return nil
}

// AssignProperties_From_DateSpan_STATUS populates our DateSpan_STATUS from the provided source DateSpan_STATUS
func (span *DateSpan_STATUS) AssignProperties_From_DateSpan_STATUS(source *storage.DateSpan_STATUS) error {

	// End
	span.End = genruntime.ClonePointerToString(source.End)

	// Start
	span.Start = genruntime.ClonePointerToString(source.Start)

	// No error
	return nil
}

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

	// End
	destination.End = genruntime.ClonePointerToString(span.End)

	// Start
	destination.Start = genruntime.ClonePointerToString(span.Start)

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

	// No error
	return nil
}

// +kubebuilder:validation:Maximum=23
// +kubebuilder:validation:Minimum=0
type HourInDay int

// One and only one of the schedule types should be specified. Choose either 'daily', 'weekly', 'absoluteMonthly' or
// 'relativeMonthly' for your maintenance schedule.
type Schedule struct {
	// AbsoluteMonthly: For schedules like: 'recur every month on the 15th' or 'recur every 3 months on the 20th'.
	AbsoluteMonthly *AbsoluteMonthlySchedule `json:"absoluteMonthly,omitempty"`

	// Daily: For schedules like: 'recur every day' or 'recur every 3 days'.
	Daily *DailySchedule `json:"daily,omitempty"`

	// RelativeMonthly: For schedules like: 'recur every month on the first Monday' or 'recur every 3 months on last Friday'.
	RelativeMonthly *RelativeMonthlySchedule `json:"relativeMonthly,omitempty"`

	// Weekly: For schedules like: 'recur every Monday' or 'recur every 3 weeks on Wednesday'.
	Weekly *WeeklySchedule `json:"weekly,omitempty"`
}

var _ genruntime.ARMTransformer = &Schedule{}

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

	// Set property "AbsoluteMonthly":
	if schedule.AbsoluteMonthly != nil {
		absoluteMonthly_ARM, err := schedule.AbsoluteMonthly.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		absoluteMonthly := *absoluteMonthly_ARM.(*arm.AbsoluteMonthlySchedule)
		result.AbsoluteMonthly = &absoluteMonthly
	}

	// Set property "Daily":
	if schedule.Daily != nil {
		daily_ARM, err := schedule.Daily.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		daily := *daily_ARM.(*arm.DailySchedule)
		result.Daily = &daily
	}

	// Set property "RelativeMonthly":
	if schedule.RelativeMonthly != nil {
		relativeMonthly_ARM, err := schedule.RelativeMonthly.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		relativeMonthly := *relativeMonthly_ARM.(*arm.RelativeMonthlySchedule)
		result.RelativeMonthly = &relativeMonthly
	}

	// Set property "Weekly":
	if schedule.Weekly != nil {
		weekly_ARM, err := schedule.Weekly.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		weekly := *weekly_ARM.(*arm.WeeklySchedule)
		result.Weekly = &weekly
	}
	return result, nil
}

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

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

	// Set property "AbsoluteMonthly":
	if typedInput.AbsoluteMonthly != nil {
		var absoluteMonthly1 AbsoluteMonthlySchedule
		err := absoluteMonthly1.PopulateFromARM(owner, *typedInput.AbsoluteMonthly)
		if err != nil {
			return err
		}
		absoluteMonthly := absoluteMonthly1
		schedule.AbsoluteMonthly = &absoluteMonthly
	}

	// Set property "Daily":
	if typedInput.Daily != nil {
		var daily1 DailySchedule
		err := daily1.PopulateFromARM(owner, *typedInput.Daily)
		if err != nil {
			return err
		}
		daily := daily1
		schedule.Daily = &daily
	}

	// Set property "RelativeMonthly":
	if typedInput.RelativeMonthly != nil {
		var relativeMonthly1 RelativeMonthlySchedule
		err := relativeMonthly1.PopulateFromARM(owner, *typedInput.RelativeMonthly)
		if err != nil {
			return err
		}
		relativeMonthly := relativeMonthly1
		schedule.RelativeMonthly = &relativeMonthly
	}

	// Set property "Weekly":
	if typedInput.Weekly != nil {
		var weekly1 WeeklySchedule
		err := weekly1.PopulateFromARM(owner, *typedInput.Weekly)
		if err != nil {
			return err
		}
		weekly := weekly1
		schedule.Weekly = &weekly
	}

	// No error
	return nil
}

// AssignProperties_From_Schedule populates our Schedule from the provided source Schedule
func (schedule *Schedule) AssignProperties_From_Schedule(source *storage.Schedule) error {

	// AbsoluteMonthly
	if source.AbsoluteMonthly != nil {
		var absoluteMonthly AbsoluteMonthlySchedule
		err := absoluteMonthly.AssignProperties_From_AbsoluteMonthlySchedule(source.AbsoluteMonthly)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_AbsoluteMonthlySchedule() to populate field AbsoluteMonthly")
		}
		schedule.AbsoluteMonthly = &absoluteMonthly
	} else {
		schedule.AbsoluteMonthly = nil
	}

	// Daily
	if source.Daily != nil {
		var daily DailySchedule
		err := daily.AssignProperties_From_DailySchedule(source.Daily)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_DailySchedule() to populate field Daily")
		}
		schedule.Daily = &daily
	} else {
		schedule.Daily = nil
	}

	// RelativeMonthly
	if source.RelativeMonthly != nil {
		var relativeMonthly RelativeMonthlySchedule
		err := relativeMonthly.AssignProperties_From_RelativeMonthlySchedule(source.RelativeMonthly)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_RelativeMonthlySchedule() to populate field RelativeMonthly")
		}
		schedule.RelativeMonthly = &relativeMonthly
	} else {
		schedule.RelativeMonthly = nil
	}

	// Weekly
	if source.Weekly != nil {
		var weekly WeeklySchedule
		err := weekly.AssignProperties_From_WeeklySchedule(source.Weekly)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_WeeklySchedule() to populate field Weekly")
		}
		schedule.Weekly = &weekly
	} else {
		schedule.Weekly = nil
	}

	// No error
	return nil
}

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

	// AbsoluteMonthly
	if schedule.AbsoluteMonthly != nil {
		var absoluteMonthly storage.AbsoluteMonthlySchedule
		err := schedule.AbsoluteMonthly.AssignProperties_To_AbsoluteMonthlySchedule(&absoluteMonthly)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_AbsoluteMonthlySchedule() to populate field AbsoluteMonthly")
		}
		destination.AbsoluteMonthly = &absoluteMonthly
	} else {
		destination.AbsoluteMonthly = nil
	}

	// Daily
	if schedule.Daily != nil {
		var daily storage.DailySchedule
		err := schedule.Daily.AssignProperties_To_DailySchedule(&daily)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_DailySchedule() to populate field Daily")
		}
		destination.Daily = &daily
	} else {
		destination.Daily = nil
	}

	// RelativeMonthly
	if schedule.RelativeMonthly != nil {
		var relativeMonthly storage.RelativeMonthlySchedule
		err := schedule.RelativeMonthly.AssignProperties_To_RelativeMonthlySchedule(&relativeMonthly)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_RelativeMonthlySchedule() to populate field RelativeMonthly")
		}
		destination.RelativeMonthly = &relativeMonthly
	} else {
		destination.RelativeMonthly = nil
	}

	// Weekly
	if schedule.Weekly != nil {
		var weekly storage.WeeklySchedule
		err := schedule.Weekly.AssignProperties_To_WeeklySchedule(&weekly)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_WeeklySchedule() to populate field Weekly")
		}
		destination.Weekly = &weekly
	} else {
		destination.Weekly = nil
	}

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

	// No error
	return nil
}

// Initialize_From_Schedule_STATUS populates our Schedule from the provided source Schedule_STATUS
func (schedule *Schedule) Initialize_From_Schedule_STATUS(source *Schedule_STATUS) error {

	// AbsoluteMonthly
	if source.AbsoluteMonthly != nil {
		var absoluteMonthly AbsoluteMonthlySchedule
		err := absoluteMonthly.Initialize_From_AbsoluteMonthlySchedule_STATUS(source.AbsoluteMonthly)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_AbsoluteMonthlySchedule_STATUS() to populate field AbsoluteMonthly")
		}
		schedule.AbsoluteMonthly = &absoluteMonthly
	} else {
		schedule.AbsoluteMonthly = nil
	}

	// Daily
	if source.Daily != nil {
		var daily DailySchedule
		err := daily.Initialize_From_DailySchedule_STATUS(source.Daily)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_DailySchedule_STATUS() to populate field Daily")
		}
		schedule.Daily = &daily
	} else {
		schedule.Daily = nil
	}

	// RelativeMonthly
	if source.RelativeMonthly != nil {
		var relativeMonthly RelativeMonthlySchedule
		err := relativeMonthly.Initialize_From_RelativeMonthlySchedule_STATUS(source.RelativeMonthly)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_RelativeMonthlySchedule_STATUS() to populate field RelativeMonthly")
		}
		schedule.RelativeMonthly = &relativeMonthly
	} else {
		schedule.RelativeMonthly = nil
	}

	// Weekly
	if source.Weekly != nil {
		var weekly WeeklySchedule
		err := weekly.Initialize_From_WeeklySchedule_STATUS(source.Weekly)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_WeeklySchedule_STATUS() to populate field Weekly")
		}
		schedule.Weekly = &weekly
	} else {
		schedule.Weekly = nil
	}

	// No error
	return nil
}

// One and only one of the schedule types should be specified. Choose either 'daily', 'weekly', 'absoluteMonthly' or
// 'relativeMonthly' for your maintenance schedule.
type Schedule_STATUS struct {
	// AbsoluteMonthly: For schedules like: 'recur every month on the 15th' or 'recur every 3 months on the 20th'.
	AbsoluteMonthly *AbsoluteMonthlySchedule_STATUS `json:"absoluteMonthly,omitempty"`

	// Daily: For schedules like: 'recur every day' or 'recur every 3 days'.
	Daily *DailySchedule_STATUS `json:"daily,omitempty"`

	// RelativeMonthly: For schedules like: 'recur every month on the first Monday' or 'recur every 3 months on last Friday'.
	RelativeMonthly *RelativeMonthlySchedule_STATUS `json:"relativeMonthly,omitempty"`

	// Weekly: For schedules like: 'recur every Monday' or 'recur every 3 weeks on Wednesday'.
	Weekly *WeeklySchedule_STATUS `json:"weekly,omitempty"`
}

var _ genruntime.FromARMConverter = &Schedule_STATUS{}

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

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

	// Set property "AbsoluteMonthly":
	if typedInput.AbsoluteMonthly != nil {
		var absoluteMonthly1 AbsoluteMonthlySchedule_STATUS
		err := absoluteMonthly1.PopulateFromARM(owner, *typedInput.AbsoluteMonthly)
		if err != nil {
			return err
		}
		absoluteMonthly := absoluteMonthly1
		schedule.AbsoluteMonthly = &absoluteMonthly
	}

	// Set property "Daily":
	if typedInput.Daily != nil {
		var daily1 DailySchedule_STATUS
		err := daily1.PopulateFromARM(owner, *typedInput.Daily)
		if err != nil {
			return err
		}
		daily := daily1
		schedule.Daily = &daily
	}

	// Set property "RelativeMonthly":
	if typedInput.RelativeMonthly != nil {
		var relativeMonthly1 RelativeMonthlySchedule_STATUS
		err := relativeMonthly1.PopulateFromARM(owner, *typedInput.RelativeMonthly)
		if err != nil {
			return err
		}
		relativeMonthly := relativeMonthly1
		schedule.RelativeMonthly = &relativeMonthly
	}

	// Set property "Weekly":
	if typedInput.Weekly != nil {
		var weekly1 WeeklySchedule_STATUS
		err := weekly1.PopulateFromARM(owner, *typedInput.Weekly)
		if err != nil {
			return err
		}
		weekly := weekly1
		schedule.Weekly = &weekly
	}

	// No error
	return nil
}

// AssignProperties_From_Schedule_STATUS populates our Schedule_STATUS from the provided source Schedule_STATUS
func (schedule *Schedule_STATUS) AssignProperties_From_Schedule_STATUS(source *storage.Schedule_STATUS) error {

	// AbsoluteMonthly
	if source.AbsoluteMonthly != nil {
		var absoluteMonthly AbsoluteMonthlySchedule_STATUS
		err := absoluteMonthly.AssignProperties_From_AbsoluteMonthlySchedule_STATUS(source.AbsoluteMonthly)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_AbsoluteMonthlySchedule_STATUS() to populate field AbsoluteMonthly")
		}
		schedule.AbsoluteMonthly = &absoluteMonthly
	} else {
		schedule.AbsoluteMonthly = nil
	}

	// Daily
	if source.Daily != nil {
		var daily DailySchedule_STATUS
		err := daily.AssignProperties_From_DailySchedule_STATUS(source.Daily)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_DailySchedule_STATUS() to populate field Daily")
		}
		schedule.Daily = &daily
	} else {
		schedule.Daily = nil
	}

	// RelativeMonthly
	if source.RelativeMonthly != nil {
		var relativeMonthly RelativeMonthlySchedule_STATUS
		err := relativeMonthly.AssignProperties_From_RelativeMonthlySchedule_STATUS(source.RelativeMonthly)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_RelativeMonthlySchedule_STATUS() to populate field RelativeMonthly")
		}
		schedule.RelativeMonthly = &relativeMonthly
	} else {
		schedule.RelativeMonthly = nil
	}

	// Weekly
	if source.Weekly != nil {
		var weekly WeeklySchedule_STATUS
		err := weekly.AssignProperties_From_WeeklySchedule_STATUS(source.Weekly)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_WeeklySchedule_STATUS() to populate field Weekly")
		}
		schedule.Weekly = &weekly
	} else {
		schedule.Weekly = nil
	}

	// No error
	return nil
}

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

	// AbsoluteMonthly
	if schedule.AbsoluteMonthly != nil {
		var absoluteMonthly storage.AbsoluteMonthlySchedule_STATUS
		err := schedule.AbsoluteMonthly.AssignProperties_To_AbsoluteMonthlySchedule_STATUS(&absoluteMonthly)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_AbsoluteMonthlySchedule_STATUS() to populate field AbsoluteMonthly")
		}
		destination.AbsoluteMonthly = &absoluteMonthly
	} else {
		destination.AbsoluteMonthly = nil
	}

	// Daily
	if schedule.Daily != nil {
		var daily storage.DailySchedule_STATUS
		err := schedule.Daily.AssignProperties_To_DailySchedule_STATUS(&daily)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_DailySchedule_STATUS() to populate field Daily")
		}
		destination.Daily = &daily
	} else {
		destination.Daily = nil
	}

	// RelativeMonthly
	if schedule.RelativeMonthly != nil {
		var relativeMonthly storage.RelativeMonthlySchedule_STATUS
		err := schedule.RelativeMonthly.AssignProperties_To_RelativeMonthlySchedule_STATUS(&relativeMonthly)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_RelativeMonthlySchedule_STATUS() to populate field RelativeMonthly")
		}
		destination.RelativeMonthly = &relativeMonthly
	} else {
		destination.RelativeMonthly = nil
	}

	// Weekly
	if schedule.Weekly != nil {
		var weekly storage.WeeklySchedule_STATUS
		err := schedule.Weekly.AssignProperties_To_WeeklySchedule_STATUS(&weekly)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_WeeklySchedule_STATUS() to populate field Weekly")
		}
		destination.Weekly = &weekly
	} else {
		destination.Weekly = 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,
}

// The weekday enum.
// +kubebuilder:validation:Enum={"Friday","Monday","Saturday","Sunday","Thursday","Tuesday","Wednesday"}
type WeekDay string

const (
	WeekDay_Friday    = WeekDay("Friday")
	WeekDay_Monday    = WeekDay("Monday")
	WeekDay_Saturday  = WeekDay("Saturday")
	WeekDay_Sunday    = WeekDay("Sunday")
	WeekDay_Thursday  = WeekDay("Thursday")
	WeekDay_Tuesday   = WeekDay("Tuesday")
	WeekDay_Wednesday = WeekDay("Wednesday")
)

// Mapping from string to WeekDay
var weekDay_Values = map[string]WeekDay{
	"friday":    WeekDay_Friday,
	"monday":    WeekDay_Monday,
	"saturday":  WeekDay_Saturday,
	"sunday":    WeekDay_Sunday,
	"thursday":  WeekDay_Thursday,
	"tuesday":   WeekDay_Tuesday,
	"wednesday": WeekDay_Wednesday,
}

// The weekday enum.
type WeekDay_STATUS string

const (
	WeekDay_STATUS_Friday    = WeekDay_STATUS("Friday")
	WeekDay_STATUS_Monday    = WeekDay_STATUS("Monday")
	WeekDay_STATUS_Saturday  = WeekDay_STATUS("Saturday")
	WeekDay_STATUS_Sunday    = WeekDay_STATUS("Sunday")
	WeekDay_STATUS_Thursday  = WeekDay_STATUS("Thursday")
	WeekDay_STATUS_Tuesday   = WeekDay_STATUS("Tuesday")
	WeekDay_STATUS_Wednesday = WeekDay_STATUS("Wednesday")
)

// Mapping from string to WeekDay_STATUS
var weekDay_STATUS_Values = map[string]WeekDay_STATUS{
	"friday":    WeekDay_STATUS_Friday,
	"monday":    WeekDay_STATUS_Monday,
	"saturday":  WeekDay_STATUS_Saturday,
	"sunday":    WeekDay_STATUS_Sunday,
	"thursday":  WeekDay_STATUS_Thursday,
	"tuesday":   WeekDay_STATUS_Tuesday,
	"wednesday": WeekDay_STATUS_Wednesday,
}

// For schedules like: 'recur every month on the 15th' or 'recur every 3 months on the 20th'.
type AbsoluteMonthlySchedule struct {
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Maximum=31
	// +kubebuilder:validation:Minimum=1
	// DayOfMonth: The date of the month.
	DayOfMonth *int `json:"dayOfMonth,omitempty"`

	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Maximum=6
	// +kubebuilder:validation:Minimum=1
	// IntervalMonths: Specifies the number of months between each set of occurrences.
	IntervalMonths *int `json:"intervalMonths,omitempty"`
}

var _ genruntime.ARMTransformer = &AbsoluteMonthlySchedule{}

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

	// Set property "DayOfMonth":
	if schedule.DayOfMonth != nil {
		dayOfMonth := *schedule.DayOfMonth
		result.DayOfMonth = &dayOfMonth
	}

	// Set property "IntervalMonths":
	if schedule.IntervalMonths != nil {
		intervalMonths := *schedule.IntervalMonths
		result.IntervalMonths = &intervalMonths
	}
	return result, nil
}

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

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

	// Set property "DayOfMonth":
	if typedInput.DayOfMonth != nil {
		dayOfMonth := *typedInput.DayOfMonth
		schedule.DayOfMonth = &dayOfMonth
	}

	// Set property "IntervalMonths":
	if typedInput.IntervalMonths != nil {
		intervalMonths := *typedInput.IntervalMonths
		schedule.IntervalMonths = &intervalMonths
	}

	// No error
	return nil
}

// AssignProperties_From_AbsoluteMonthlySchedule populates our AbsoluteMonthlySchedule from the provided source AbsoluteMonthlySchedule
func (schedule *AbsoluteMonthlySchedule) AssignProperties_From_AbsoluteMonthlySchedule(source *storage.AbsoluteMonthlySchedule) error {

	// DayOfMonth
	schedule.DayOfMonth = genruntime.ClonePointerToInt(source.DayOfMonth)

	// IntervalMonths
	schedule.IntervalMonths = genruntime.ClonePointerToInt(source.IntervalMonths)

	// No error
	return nil
}

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

	// DayOfMonth
	destination.DayOfMonth = genruntime.ClonePointerToInt(schedule.DayOfMonth)

	// IntervalMonths
	destination.IntervalMonths = genruntime.ClonePointerToInt(schedule.IntervalMonths)

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

	// No error
	return nil
}

// Initialize_From_AbsoluteMonthlySchedule_STATUS populates our AbsoluteMonthlySchedule from the provided source AbsoluteMonthlySchedule_STATUS
func (schedule *AbsoluteMonthlySchedule) Initialize_From_AbsoluteMonthlySchedule_STATUS(source *AbsoluteMonthlySchedule_STATUS) error {

	// DayOfMonth
	schedule.DayOfMonth = genruntime.ClonePointerToInt(source.DayOfMonth)

	// IntervalMonths
	schedule.IntervalMonths = genruntime.ClonePointerToInt(source.IntervalMonths)

	// No error
	return nil
}

// For schedules like: 'recur every month on the 15th' or 'recur every 3 months on the 20th'.
type AbsoluteMonthlySchedule_STATUS struct {
	// DayOfMonth: The date of the month.
	DayOfMonth *int `json:"dayOfMonth,omitempty"`

	// IntervalMonths: Specifies the number of months between each set of occurrences.
	IntervalMonths *int `json:"intervalMonths,omitempty"`
}

var _ genruntime.FromARMConverter = &AbsoluteMonthlySchedule_STATUS{}

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

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

	// Set property "DayOfMonth":
	if typedInput.DayOfMonth != nil {
		dayOfMonth := *typedInput.DayOfMonth
		schedule.DayOfMonth = &dayOfMonth
	}

	// Set property "IntervalMonths":
	if typedInput.IntervalMonths != nil {
		intervalMonths := *typedInput.IntervalMonths
		schedule.IntervalMonths = &intervalMonths
	}

	// No error
	return nil
}

// AssignProperties_From_AbsoluteMonthlySchedule_STATUS populates our AbsoluteMonthlySchedule_STATUS from the provided source AbsoluteMonthlySchedule_STATUS
func (schedule *AbsoluteMonthlySchedule_STATUS) AssignProperties_From_AbsoluteMonthlySchedule_STATUS(source *storage.AbsoluteMonthlySchedule_STATUS) error {

	// DayOfMonth
	schedule.DayOfMonth = genruntime.ClonePointerToInt(source.DayOfMonth)

	// IntervalMonths
	schedule.IntervalMonths = genruntime.ClonePointerToInt(source.IntervalMonths)

	// No error
	return nil
}

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

	// DayOfMonth
	destination.DayOfMonth = genruntime.ClonePointerToInt(schedule.DayOfMonth)

	// IntervalMonths
	destination.IntervalMonths = genruntime.ClonePointerToInt(schedule.IntervalMonths)

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

	// No error
	return nil
}

// For schedules like: 'recur every day' or 'recur every 3 days'.
type DailySchedule struct {
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Maximum=7
	// +kubebuilder:validation:Minimum=1
	// IntervalDays: Specifies the number of days between each set of occurrences.
	IntervalDays *int `json:"intervalDays,omitempty"`
}

var _ genruntime.ARMTransformer = &DailySchedule{}

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

	// Set property "IntervalDays":
	if schedule.IntervalDays != nil {
		intervalDays := *schedule.IntervalDays
		result.IntervalDays = &intervalDays
	}
	return result, nil
}

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

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

	// Set property "IntervalDays":
	if typedInput.IntervalDays != nil {
		intervalDays := *typedInput.IntervalDays
		schedule.IntervalDays = &intervalDays
	}

	// No error
	return nil
}

// AssignProperties_From_DailySchedule populates our DailySchedule from the provided source DailySchedule
func (schedule *DailySchedule) AssignProperties_From_DailySchedule(source *storage.DailySchedule) error {

	// IntervalDays
	schedule.IntervalDays = genruntime.ClonePointerToInt(source.IntervalDays)

	// No error
	return nil
}

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

	// IntervalDays
	destination.IntervalDays = genruntime.ClonePointerToInt(schedule.IntervalDays)

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

	// No error
	return nil
}

// Initialize_From_DailySchedule_STATUS populates our DailySchedule from the provided source DailySchedule_STATUS
func (schedule *DailySchedule) Initialize_From_DailySchedule_STATUS(source *DailySchedule_STATUS) error {

	// IntervalDays
	schedule.IntervalDays = genruntime.ClonePointerToInt(source.IntervalDays)

	// No error
	return nil
}

// For schedules like: 'recur every day' or 'recur every 3 days'.
type DailySchedule_STATUS struct {
	// IntervalDays: Specifies the number of days between each set of occurrences.
	IntervalDays *int `json:"intervalDays,omitempty"`
}

var _ genruntime.FromARMConverter = &DailySchedule_STATUS{}

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

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

	// Set property "IntervalDays":
	if typedInput.IntervalDays != nil {
		intervalDays := *typedInput.IntervalDays
		schedule.IntervalDays = &intervalDays
	}

	// No error
	return nil
}

// AssignProperties_From_DailySchedule_STATUS populates our DailySchedule_STATUS from the provided source DailySchedule_STATUS
func (schedule *DailySchedule_STATUS) AssignProperties_From_DailySchedule_STATUS(source *storage.DailySchedule_STATUS) error {

	// IntervalDays
	schedule.IntervalDays = genruntime.ClonePointerToInt(source.IntervalDays)

	// No error
	return nil
}

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

	// IntervalDays
	destination.IntervalDays = genruntime.ClonePointerToInt(schedule.IntervalDays)

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

	// No error
	return nil
}

// For schedules like: 'recur every month on the first Monday' or 'recur every 3 months on last Friday'.
type RelativeMonthlySchedule struct {
	// +kubebuilder:validation:Required
	// DayOfWeek: Specifies on which day of the week the maintenance occurs.
	DayOfWeek *WeekDay `json:"dayOfWeek,omitempty"`

	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Maximum=6
	// +kubebuilder:validation:Minimum=1
	// IntervalMonths: Specifies the number of months between each set of occurrences.
	IntervalMonths *int `json:"intervalMonths,omitempty"`

	// +kubebuilder:validation:Required
	// WeekIndex: Specifies on which week of the month the dayOfWeek applies.
	WeekIndex *RelativeMonthlySchedule_WeekIndex `json:"weekIndex,omitempty"`
}

var _ genruntime.ARMTransformer = &RelativeMonthlySchedule{}

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

	// Set property "DayOfWeek":
	if schedule.DayOfWeek != nil {
		var temp string
		temp = string(*schedule.DayOfWeek)
		dayOfWeek := arm.WeekDay(temp)
		result.DayOfWeek = &dayOfWeek
	}

	// Set property "IntervalMonths":
	if schedule.IntervalMonths != nil {
		intervalMonths := *schedule.IntervalMonths
		result.IntervalMonths = &intervalMonths
	}

	// Set property "WeekIndex":
	if schedule.WeekIndex != nil {
		var temp string
		temp = string(*schedule.WeekIndex)
		weekIndex := arm.RelativeMonthlySchedule_WeekIndex(temp)
		result.WeekIndex = &weekIndex
	}
	return result, nil
}

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

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

	// Set property "DayOfWeek":
	if typedInput.DayOfWeek != nil {
		var temp string
		temp = string(*typedInput.DayOfWeek)
		dayOfWeek := WeekDay(temp)
		schedule.DayOfWeek = &dayOfWeek
	}

	// Set property "IntervalMonths":
	if typedInput.IntervalMonths != nil {
		intervalMonths := *typedInput.IntervalMonths
		schedule.IntervalMonths = &intervalMonths
	}

	// Set property "WeekIndex":
	if typedInput.WeekIndex != nil {
		var temp string
		temp = string(*typedInput.WeekIndex)
		weekIndex := RelativeMonthlySchedule_WeekIndex(temp)
		schedule.WeekIndex = &weekIndex
	}

	// No error
	return nil
}

// AssignProperties_From_RelativeMonthlySchedule populates our RelativeMonthlySchedule from the provided source RelativeMonthlySchedule
func (schedule *RelativeMonthlySchedule) AssignProperties_From_RelativeMonthlySchedule(source *storage.RelativeMonthlySchedule) error {

	// DayOfWeek
	if source.DayOfWeek != nil {
		dayOfWeek := *source.DayOfWeek
		dayOfWeekTemp := genruntime.ToEnum(dayOfWeek, weekDay_Values)
		schedule.DayOfWeek = &dayOfWeekTemp
	} else {
		schedule.DayOfWeek = nil
	}

	// IntervalMonths
	schedule.IntervalMonths = genruntime.ClonePointerToInt(source.IntervalMonths)

	// WeekIndex
	if source.WeekIndex != nil {
		weekIndex := *source.WeekIndex
		weekIndexTemp := genruntime.ToEnum(weekIndex, relativeMonthlySchedule_WeekIndex_Values)
		schedule.WeekIndex = &weekIndexTemp
	} else {
		schedule.WeekIndex = nil
	}

	// No error
	return nil
}

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

	// DayOfWeek
	if schedule.DayOfWeek != nil {
		dayOfWeek := string(*schedule.DayOfWeek)
		destination.DayOfWeek = &dayOfWeek
	} else {
		destination.DayOfWeek = nil
	}

	// IntervalMonths
	destination.IntervalMonths = genruntime.ClonePointerToInt(schedule.IntervalMonths)

	// WeekIndex
	if schedule.WeekIndex != nil {
		weekIndex := string(*schedule.WeekIndex)
		destination.WeekIndex = &weekIndex
	} else {
		destination.WeekIndex = nil
	}

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

	// No error
	return nil
}

// Initialize_From_RelativeMonthlySchedule_STATUS populates our RelativeMonthlySchedule from the provided source RelativeMonthlySchedule_STATUS
func (schedule *RelativeMonthlySchedule) Initialize_From_RelativeMonthlySchedule_STATUS(source *RelativeMonthlySchedule_STATUS) error {

	// DayOfWeek
	if source.DayOfWeek != nil {
		dayOfWeek := genruntime.ToEnum(string(*source.DayOfWeek), weekDay_Values)
		schedule.DayOfWeek = &dayOfWeek
	} else {
		schedule.DayOfWeek = nil
	}

	// IntervalMonths
	schedule.IntervalMonths = genruntime.ClonePointerToInt(source.IntervalMonths)

	// WeekIndex
	if source.WeekIndex != nil {
		weekIndex := genruntime.ToEnum(string(*source.WeekIndex), relativeMonthlySchedule_WeekIndex_Values)
		schedule.WeekIndex = &weekIndex
	} else {
		schedule.WeekIndex = nil
	}

	// No error
	return nil
}

// For schedules like: 'recur every month on the first Monday' or 'recur every 3 months on last Friday'.
type RelativeMonthlySchedule_STATUS struct {
	// DayOfWeek: Specifies on which day of the week the maintenance occurs.
	DayOfWeek *WeekDay_STATUS `json:"dayOfWeek,omitempty"`

	// IntervalMonths: Specifies the number of months between each set of occurrences.
	IntervalMonths *int `json:"intervalMonths,omitempty"`

	// WeekIndex: Specifies on which week of the month the dayOfWeek applies.
	WeekIndex *RelativeMonthlySchedule_WeekIndex_STATUS `json:"weekIndex,omitempty"`
}

var _ genruntime.FromARMConverter = &RelativeMonthlySchedule_STATUS{}

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

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

	// Set property "DayOfWeek":
	if typedInput.DayOfWeek != nil {
		var temp string
		temp = string(*typedInput.DayOfWeek)
		dayOfWeek := WeekDay_STATUS(temp)
		schedule.DayOfWeek = &dayOfWeek
	}

	// Set property "IntervalMonths":
	if typedInput.IntervalMonths != nil {
		intervalMonths := *typedInput.IntervalMonths
		schedule.IntervalMonths = &intervalMonths
	}

	// Set property "WeekIndex":
	if typedInput.WeekIndex != nil {
		var temp string
		temp = string(*typedInput.WeekIndex)
		weekIndex := RelativeMonthlySchedule_WeekIndex_STATUS(temp)
		schedule.WeekIndex = &weekIndex
	}

	// No error
	return nil
}

// AssignProperties_From_RelativeMonthlySchedule_STATUS populates our RelativeMonthlySchedule_STATUS from the provided source RelativeMonthlySchedule_STATUS
func (schedule *RelativeMonthlySchedule_STATUS) AssignProperties_From_RelativeMonthlySchedule_STATUS(source *storage.RelativeMonthlySchedule_STATUS) error {

	// DayOfWeek
	if source.DayOfWeek != nil {
		dayOfWeek := *source.DayOfWeek
		dayOfWeekTemp := genruntime.ToEnum(dayOfWeek, weekDay_STATUS_Values)
		schedule.DayOfWeek = &dayOfWeekTemp
	} else {
		schedule.DayOfWeek = nil
	}

	// IntervalMonths
	schedule.IntervalMonths = genruntime.ClonePointerToInt(source.IntervalMonths)

	// WeekIndex
	if source.WeekIndex != nil {
		weekIndex := *source.WeekIndex
		weekIndexTemp := genruntime.ToEnum(weekIndex, relativeMonthlySchedule_WeekIndex_STATUS_Values)
		schedule.WeekIndex = &weekIndexTemp
	} else {
		schedule.WeekIndex = nil
	}

	// No error
	return nil
}

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

	// DayOfWeek
	if schedule.DayOfWeek != nil {
		dayOfWeek := string(*schedule.DayOfWeek)
		destination.DayOfWeek = &dayOfWeek
	} else {
		destination.DayOfWeek = nil
	}

	// IntervalMonths
	destination.IntervalMonths = genruntime.ClonePointerToInt(schedule.IntervalMonths)

	// WeekIndex
	if schedule.WeekIndex != nil {
		weekIndex := string(*schedule.WeekIndex)
		destination.WeekIndex = &weekIndex
	} else {
		destination.WeekIndex = nil
	}

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

	// No error
	return nil
}

// For schedules like: 'recur every Monday' or 'recur every 3 weeks on Wednesday'.
type WeeklySchedule struct {
	// +kubebuilder:validation:Required
	// DayOfWeek: Specifies on which day of the week the maintenance occurs.
	DayOfWeek *WeekDay `json:"dayOfWeek,omitempty"`

	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Maximum=4
	// +kubebuilder:validation:Minimum=1
	// IntervalWeeks: Specifies the number of weeks between each set of occurrences.
	IntervalWeeks *int `json:"intervalWeeks,omitempty"`
}

var _ genruntime.ARMTransformer = &WeeklySchedule{}

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

	// Set property "DayOfWeek":
	if schedule.DayOfWeek != nil {
		var temp string
		temp = string(*schedule.DayOfWeek)
		dayOfWeek := arm.WeekDay(temp)
		result.DayOfWeek = &dayOfWeek
	}

	// Set property "IntervalWeeks":
	if schedule.IntervalWeeks != nil {
		intervalWeeks := *schedule.IntervalWeeks
		result.IntervalWeeks = &intervalWeeks
	}
	return result, nil
}

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

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

	// Set property "DayOfWeek":
	if typedInput.DayOfWeek != nil {
		var temp string
		temp = string(*typedInput.DayOfWeek)
		dayOfWeek := WeekDay(temp)
		schedule.DayOfWeek = &dayOfWeek
	}

	// Set property "IntervalWeeks":
	if typedInput.IntervalWeeks != nil {
		intervalWeeks := *typedInput.IntervalWeeks
		schedule.IntervalWeeks = &intervalWeeks
	}

	// No error
	return nil
}

// AssignProperties_From_WeeklySchedule populates our WeeklySchedule from the provided source WeeklySchedule
func (schedule *WeeklySchedule) AssignProperties_From_WeeklySchedule(source *storage.WeeklySchedule) error {

	// DayOfWeek
	if source.DayOfWeek != nil {
		dayOfWeek := *source.DayOfWeek
		dayOfWeekTemp := genruntime.ToEnum(dayOfWeek, weekDay_Values)
		schedule.DayOfWeek = &dayOfWeekTemp
	} else {
		schedule.DayOfWeek = nil
	}

	// IntervalWeeks
	schedule.IntervalWeeks = genruntime.ClonePointerToInt(source.IntervalWeeks)

	// No error
	return nil
}

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

	// DayOfWeek
	if schedule.DayOfWeek != nil {
		dayOfWeek := string(*schedule.DayOfWeek)
		destination.DayOfWeek = &dayOfWeek
	} else {
		destination.DayOfWeek = nil
	}

	// IntervalWeeks
	destination.IntervalWeeks = genruntime.ClonePointerToInt(schedule.IntervalWeeks)

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

	// No error
	return nil
}

// Initialize_From_WeeklySchedule_STATUS populates our WeeklySchedule from the provided source WeeklySchedule_STATUS
func (schedule *WeeklySchedule) Initialize_From_WeeklySchedule_STATUS(source *WeeklySchedule_STATUS) error {

	// DayOfWeek
	if source.DayOfWeek != nil {
		dayOfWeek := genruntime.ToEnum(string(*source.DayOfWeek), weekDay_Values)
		schedule.DayOfWeek = &dayOfWeek
	} else {
		schedule.DayOfWeek = nil
	}

	// IntervalWeeks
	schedule.IntervalWeeks = genruntime.ClonePointerToInt(source.IntervalWeeks)

	// No error
	return nil
}

// For schedules like: 'recur every Monday' or 'recur every 3 weeks on Wednesday'.
type WeeklySchedule_STATUS struct {
	// DayOfWeek: Specifies on which day of the week the maintenance occurs.
	DayOfWeek *WeekDay_STATUS `json:"dayOfWeek,omitempty"`

	// IntervalWeeks: Specifies the number of weeks between each set of occurrences.
	IntervalWeeks *int `json:"intervalWeeks,omitempty"`
}

var _ genruntime.FromARMConverter = &WeeklySchedule_STATUS{}

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

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

	// Set property "DayOfWeek":
	if typedInput.DayOfWeek != nil {
		var temp string
		temp = string(*typedInput.DayOfWeek)
		dayOfWeek := WeekDay_STATUS(temp)
		schedule.DayOfWeek = &dayOfWeek
	}

	// Set property "IntervalWeeks":
	if typedInput.IntervalWeeks != nil {
		intervalWeeks := *typedInput.IntervalWeeks
		schedule.IntervalWeeks = &intervalWeeks
	}

	// No error
	return nil
}

// AssignProperties_From_WeeklySchedule_STATUS populates our WeeklySchedule_STATUS from the provided source WeeklySchedule_STATUS
func (schedule *WeeklySchedule_STATUS) AssignProperties_From_WeeklySchedule_STATUS(source *storage.WeeklySchedule_STATUS) error {

	// DayOfWeek
	if source.DayOfWeek != nil {
		dayOfWeek := *source.DayOfWeek
		dayOfWeekTemp := genruntime.ToEnum(dayOfWeek, weekDay_STATUS_Values)
		schedule.DayOfWeek = &dayOfWeekTemp
	} else {
		schedule.DayOfWeek = nil
	}

	// IntervalWeeks
	schedule.IntervalWeeks = genruntime.ClonePointerToInt(source.IntervalWeeks)

	// No error
	return nil
}

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

	// DayOfWeek
	if schedule.DayOfWeek != nil {
		dayOfWeek := string(*schedule.DayOfWeek)
		destination.DayOfWeek = &dayOfWeek
	} else {
		destination.DayOfWeek = nil
	}

	// IntervalWeeks
	destination.IntervalWeeks = genruntime.ClonePointerToInt(schedule.IntervalWeeks)

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"First","Fourth","Last","Second","Third"}
type RelativeMonthlySchedule_WeekIndex string

const (
	RelativeMonthlySchedule_WeekIndex_First  = RelativeMonthlySchedule_WeekIndex("First")
	RelativeMonthlySchedule_WeekIndex_Fourth = RelativeMonthlySchedule_WeekIndex("Fourth")
	RelativeMonthlySchedule_WeekIndex_Last   = RelativeMonthlySchedule_WeekIndex("Last")
	RelativeMonthlySchedule_WeekIndex_Second = RelativeMonthlySchedule_WeekIndex("Second")
	RelativeMonthlySchedule_WeekIndex_Third  = RelativeMonthlySchedule_WeekIndex("Third")
)

// Mapping from string to RelativeMonthlySchedule_WeekIndex
var relativeMonthlySchedule_WeekIndex_Values = map[string]RelativeMonthlySchedule_WeekIndex{
	"first":  RelativeMonthlySchedule_WeekIndex_First,
	"fourth": RelativeMonthlySchedule_WeekIndex_Fourth,
	"last":   RelativeMonthlySchedule_WeekIndex_Last,
	"second": RelativeMonthlySchedule_WeekIndex_Second,
	"third":  RelativeMonthlySchedule_WeekIndex_Third,
}

type RelativeMonthlySchedule_WeekIndex_STATUS string

const (
	RelativeMonthlySchedule_WeekIndex_STATUS_First  = RelativeMonthlySchedule_WeekIndex_STATUS("First")
	RelativeMonthlySchedule_WeekIndex_STATUS_Fourth = RelativeMonthlySchedule_WeekIndex_STATUS("Fourth")
	RelativeMonthlySchedule_WeekIndex_STATUS_Last   = RelativeMonthlySchedule_WeekIndex_STATUS("Last")
	RelativeMonthlySchedule_WeekIndex_STATUS_Second = RelativeMonthlySchedule_WeekIndex_STATUS("Second")
	RelativeMonthlySchedule_WeekIndex_STATUS_Third  = RelativeMonthlySchedule_WeekIndex_STATUS("Third")
)

// Mapping from string to RelativeMonthlySchedule_WeekIndex_STATUS
var relativeMonthlySchedule_WeekIndex_STATUS_Values = map[string]RelativeMonthlySchedule_WeekIndex_STATUS{
	"first":  RelativeMonthlySchedule_WeekIndex_STATUS_First,
	"fourth": RelativeMonthlySchedule_WeekIndex_STATUS_Fourth,
	"last":   RelativeMonthlySchedule_WeekIndex_STATUS_Last,
	"second": RelativeMonthlySchedule_WeekIndex_STATUS_Second,
	"third":  RelativeMonthlySchedule_WeekIndex_STATUS_Third,
}

func init() {
	SchemeBuilder.Register(&MaintenanceConfiguration{}, &MaintenanceConfigurationList{})
}
