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

import (
	"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"
)

// +kubebuilder:rbac:groups=eventhub.azure.com,resources=namespaceseventhubs,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=eventhub.azure.com,resources={namespaceseventhubs/status,namespaceseventhubs/finalizers},verbs=get;update;patch

// +kubebuilder:object:root=true
// +kubebuilder:resource:categories={azure,eventhub}
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +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"
// Storage version of v1api20240101.NamespacesEventhub
// Generator information:
// - Generated from: /eventhub/resource-manager/Microsoft.EventHub/stable/2024-01-01/eventhubs.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}
type NamespacesEventhub struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              NamespacesEventhub_Spec   `json:"spec,omitempty"`
	Status            NamespacesEventhub_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &NamespacesEventhub{}

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

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

var _ configmaps.Exporter = &NamespacesEventhub{}

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

var _ secrets.Exporter = &NamespacesEventhub{}

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

var _ genruntime.KubernetesResource = &NamespacesEventhub{}

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

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

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.EventHub/namespaces/eventhubs"
func (eventhub *NamespacesEventhub) GetType() string {
	return "Microsoft.EventHub/namespaces/eventhubs"
}

// NewEmptyStatus returns a new empty (blank) status
func (eventhub *NamespacesEventhub) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &NamespacesEventhub_STATUS{}
}

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

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

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

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

	eventhub.Status = st
	return nil
}

// Hub marks that this NamespacesEventhub is the hub type for conversion
func (eventhub *NamespacesEventhub) Hub() {}

// OriginalGVK returns a GroupValueKind for the original API version used to create the resource
func (eventhub *NamespacesEventhub) OriginalGVK() *schema.GroupVersionKind {
	return &schema.GroupVersionKind{
		Group:   GroupVersion.Group,
		Version: eventhub.Spec.OriginalVersion,
		Kind:    "NamespacesEventhub",
	}
}

// +kubebuilder:object:root=true
// Storage version of v1api20240101.NamespacesEventhub
// Generator information:
// - Generated from: /eventhub/resource-manager/Microsoft.EventHub/stable/2024-01-01/eventhubs.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}
type NamespacesEventhubList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []NamespacesEventhub `json:"items"`
}

// Storage version of v1api20240101.NamespacesEventhub_Spec
type NamespacesEventhub_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"`
	CaptureDescription     *CaptureDescription             `json:"captureDescription,omitempty"`
	MessageRetentionInDays *int                            `json:"messageRetentionInDays,omitempty"`
	OperatorSpec           *NamespacesEventhubOperatorSpec `json:"operatorSpec,omitempty"`
	OriginalVersion        string                          `json:"originalVersion,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 eventhub.azure.com/Namespace resource
	Owner                *genruntime.KnownResourceReference `group:"eventhub.azure.com" json:"owner,omitempty" kind:"Namespace"`
	PartitionCount       *int                               `json:"partitionCount,omitempty"`
	PropertyBag          genruntime.PropertyBag             `json:"$propertyBag,omitempty"`
	RetentionDescription *RetentionDescription              `json:"retentionDescription,omitempty"`
	UserMetadata         *string                            `json:"userMetadata,omitempty"`
}

var _ genruntime.ConvertibleSpec = &NamespacesEventhub_Spec{}

// ConvertSpecFrom populates our NamespacesEventhub_Spec from the provided source
func (eventhub *NamespacesEventhub_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error {
	if source == eventhub {
		return eris.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec")
	}

	return source.ConvertSpecTo(eventhub)
}

// ConvertSpecTo populates the provided destination from our NamespacesEventhub_Spec
func (eventhub *NamespacesEventhub_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error {
	if destination == eventhub {
		return eris.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec")
	}

	return destination.ConvertSpecFrom(eventhub)
}

// Storage version of v1api20240101.NamespacesEventhub_STATUS
type NamespacesEventhub_STATUS struct {
	CaptureDescription     *CaptureDescription_STATUS   `json:"captureDescription,omitempty"`
	Conditions             []conditions.Condition       `json:"conditions,omitempty"`
	CreatedAt              *string                      `json:"createdAt,omitempty"`
	Id                     *string                      `json:"id,omitempty"`
	Location               *string                      `json:"location,omitempty"`
	MessageRetentionInDays *int                         `json:"messageRetentionInDays,omitempty"`
	Name                   *string                      `json:"name,omitempty"`
	PartitionCount         *int                         `json:"partitionCount,omitempty"`
	PartitionIds           []string                     `json:"partitionIds,omitempty"`
	PropertyBag            genruntime.PropertyBag       `json:"$propertyBag,omitempty"`
	RetentionDescription   *RetentionDescription_STATUS `json:"retentionDescription,omitempty"`
	Status                 *string                      `json:"status,omitempty"`
	SystemData             *SystemData_STATUS           `json:"systemData,omitempty"`
	Type                   *string                      `json:"type,omitempty"`
	UpdatedAt              *string                      `json:"updatedAt,omitempty"`
	UserMetadata           *string                      `json:"userMetadata,omitempty"`
}

var _ genruntime.ConvertibleStatus = &NamespacesEventhub_STATUS{}

// ConvertStatusFrom populates our NamespacesEventhub_STATUS from the provided source
func (eventhub *NamespacesEventhub_STATUS) ConvertStatusFrom(source genruntime.ConvertibleStatus) error {
	if source == eventhub {
		return eris.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus")
	}

	return source.ConvertStatusTo(eventhub)
}

// ConvertStatusTo populates the provided destination from our NamespacesEventhub_STATUS
func (eventhub *NamespacesEventhub_STATUS) ConvertStatusTo(destination genruntime.ConvertibleStatus) error {
	if destination == eventhub {
		return eris.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus")
	}

	return destination.ConvertStatusFrom(eventhub)
}

// Storage version of v1api20240101.CaptureDescription
// Properties to configure capture description for eventhub
type CaptureDescription struct {
	Destination       *Destination           `json:"destination,omitempty"`
	Enabled           *bool                  `json:"enabled,omitempty"`
	Encoding          *string                `json:"encoding,omitempty"`
	IntervalInSeconds *int                   `json:"intervalInSeconds,omitempty"`
	PropertyBag       genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	SizeLimitInBytes  *int                   `json:"sizeLimitInBytes,omitempty"`
	SkipEmptyArchives *bool                  `json:"skipEmptyArchives,omitempty"`
}

// Storage version of v1api20240101.CaptureDescription_STATUS
// Properties to configure capture description for eventhub
type CaptureDescription_STATUS struct {
	Destination       *Destination_STATUS    `json:"destination,omitempty"`
	Enabled           *bool                  `json:"enabled,omitempty"`
	Encoding          *string                `json:"encoding,omitempty"`
	IntervalInSeconds *int                   `json:"intervalInSeconds,omitempty"`
	PropertyBag       genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	SizeLimitInBytes  *int                   `json:"sizeLimitInBytes,omitempty"`
	SkipEmptyArchives *bool                  `json:"skipEmptyArchives,omitempty"`
}

// Storage version of v1api20240101.NamespacesEventhubOperatorSpec
// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure
type NamespacesEventhubOperatorSpec struct {
	ConfigMapExpressions []*core.DestinationExpression `json:"configMapExpressions,omitempty"`
	PropertyBag          genruntime.PropertyBag        `json:"$propertyBag,omitempty"`
	SecretExpressions    []*core.DestinationExpression `json:"secretExpressions,omitempty"`
}

// Storage version of v1api20240101.RetentionDescription
// Properties to configure retention settings for the  eventhub
type RetentionDescription struct {
	CleanupPolicy                 *string                `json:"cleanupPolicy,omitempty"`
	PropertyBag                   genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	RetentionTimeInHours          *int                   `json:"retentionTimeInHours,omitempty"`
	TombstoneRetentionTimeInHours *int                   `json:"tombstoneRetentionTimeInHours,omitempty"`
}

// Storage version of v1api20240101.RetentionDescription_STATUS
// Properties to configure retention settings for the  eventhub
type RetentionDescription_STATUS struct {
	CleanupPolicy                 *string                `json:"cleanupPolicy,omitempty"`
	PropertyBag                   genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	RetentionTimeInHours          *int                   `json:"retentionTimeInHours,omitempty"`
	TombstoneRetentionTimeInHours *int                   `json:"tombstoneRetentionTimeInHours,omitempty"`
}

// Storage version of v1api20240101.Destination
// Capture storage details for capture description
type Destination struct {
	ArchiveNameFormat      *string                `json:"archiveNameFormat,omitempty"`
	BlobContainer          *string                `json:"blobContainer,omitempty"`
	DataLakeAccountName    *string                `json:"dataLakeAccountName,omitempty"`
	DataLakeFolderPath     *string                `json:"dataLakeFolderPath,omitempty"`
	DataLakeSubscriptionId *string                `json:"dataLakeSubscriptionId,omitempty"`
	Identity               *CaptureIdentity       `json:"identity,omitempty"`
	Name                   *string                `json:"name,omitempty"`
	PropertyBag            genruntime.PropertyBag `json:"$propertyBag,omitempty"`

	// StorageAccountResourceReference: Resource id of the storage account to be used to create the blobs
	StorageAccountResourceReference *genruntime.ResourceReference `armReference:"StorageAccountResourceId" json:"storageAccountResourceReference,omitempty"`
}

// Storage version of v1api20240101.Destination_STATUS
// Capture storage details for capture description
type Destination_STATUS struct {
	ArchiveNameFormat        *string                 `json:"archiveNameFormat,omitempty"`
	BlobContainer            *string                 `json:"blobContainer,omitempty"`
	DataLakeAccountName      *string                 `json:"dataLakeAccountName,omitempty"`
	DataLakeFolderPath       *string                 `json:"dataLakeFolderPath,omitempty"`
	DataLakeSubscriptionId   *string                 `json:"dataLakeSubscriptionId,omitempty"`
	Identity                 *CaptureIdentity_STATUS `json:"identity,omitempty"`
	Name                     *string                 `json:"name,omitempty"`
	PropertyBag              genruntime.PropertyBag  `json:"$propertyBag,omitempty"`
	StorageAccountResourceId *string                 `json:"storageAccountResourceId,omitempty"`
}

// Storage version of v1api20240101.CaptureIdentity
// A value that indicates whether capture description is enabled.
type CaptureIdentity struct {
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Type        *string                `json:"type,omitempty"`

	// UserAssignedIdentityReference: ARM ID of Managed User Identity. This property is required is the type is
	// UserAssignedIdentity. If type is SystemAssigned, then the System Assigned Identity Associated with the namespace will be
	// used.
	UserAssignedIdentityReference *genruntime.ResourceReference `armReference:"UserAssignedIdentity" json:"userAssignedIdentityReference,omitempty"`
}

// Storage version of v1api20240101.CaptureIdentity_STATUS
// A value that indicates whether capture description is enabled.
type CaptureIdentity_STATUS struct {
	PropertyBag          genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Type                 *string                `json:"type,omitempty"`
	UserAssignedIdentity *string                `json:"userAssignedIdentity,omitempty"`
}

func init() {
	SchemeBuilder.Register(&NamespacesEventhub{}, &NamespacesEventhubList{})
}
