// SPDX-License-Identifier: AGPL-3.0-only

// Code generated by applyconfiguration-gen. DO NOT EDIT.

package v0alpha1

import (
	v1 "k8s.io/client-go/applyconfigurations/meta/v1"
)

// RepositoryStatusApplyConfiguration represents a declarative configuration of the RepositoryStatus type for use
// with apply.
//
// The status of a Repository.
// This is expected never to be created by a kubectl call or similar, and is expected to rarely (if ever) be edited manually.
// As such, it is also a little less well structured than the spec, such as conditional-but-ever-present fields.
type RepositoryStatusApplyConfiguration struct {
	// The generation of the spec last time reconciliation ran
	ObservedGeneration *int64 `json:"observedGeneration,omitempty"`
	// FieldErrors are errors that occurred during validation of the repository spec.
	// These errors are intended to help users identify and fix issues in the spec.
	FieldErrors []ErrorDetailsApplyConfiguration `json:"fieldErrors,omitempty"`
	// Conditions represent the latest available observations of the repository's state.
	Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"`
	// This will get updated with the current health status (and updated periodically)
	Health *HealthStatusApplyConfiguration `json:"health,omitempty"`
	// Sync information with the last sync information
	Sync *SyncStatusApplyConfiguration `json:"sync,omitempty"`
	// The object count when sync last ran
	Stats []ResourceCountApplyConfiguration `json:"stats,omitempty"`
	// Webhook Information (if applicable)
	Webhook *WebhookStatusApplyConfiguration `json:"webhook,omitempty"`
	// Token will get updated with current token information
	Token *TokenStatusApplyConfiguration `json:"token,omitempty"`
	// Error information during repository deletion (if any)
	DeleteError *string `json:"deleteError,omitempty"`
	// Quota contains the configured quota limits for this repository
	Quota *QuotaStatusApplyConfiguration `json:"quota,omitempty"`
}

// RepositoryStatusApplyConfiguration constructs a declarative configuration of the RepositoryStatus type for use with
// apply.
func RepositoryStatus() *RepositoryStatusApplyConfiguration {
	return &RepositoryStatusApplyConfiguration{}
}

// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ObservedGeneration field is set to the value of the last call.
func (b *RepositoryStatusApplyConfiguration) WithObservedGeneration(value int64) *RepositoryStatusApplyConfiguration {
	b.ObservedGeneration = &value
	return b
}

// WithFieldErrors adds the given value to the FieldErrors field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the FieldErrors field.
func (b *RepositoryStatusApplyConfiguration) WithFieldErrors(values ...*ErrorDetailsApplyConfiguration) *RepositoryStatusApplyConfiguration {
	for i := range values {
		if values[i] == nil {
			panic("nil value passed to WithFieldErrors")
		}
		b.FieldErrors = append(b.FieldErrors, *values[i])
	}
	return b
}

// WithConditions adds the given value to the Conditions field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Conditions field.
func (b *RepositoryStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *RepositoryStatusApplyConfiguration {
	for i := range values {
		if values[i] == nil {
			panic("nil value passed to WithConditions")
		}
		b.Conditions = append(b.Conditions, *values[i])
	}
	return b
}

// WithHealth sets the Health field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Health field is set to the value of the last call.
func (b *RepositoryStatusApplyConfiguration) WithHealth(value *HealthStatusApplyConfiguration) *RepositoryStatusApplyConfiguration {
	b.Health = value
	return b
}

// WithSync sets the Sync field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Sync field is set to the value of the last call.
func (b *RepositoryStatusApplyConfiguration) WithSync(value *SyncStatusApplyConfiguration) *RepositoryStatusApplyConfiguration {
	b.Sync = value
	return b
}

// WithStats adds the given value to the Stats field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Stats field.
func (b *RepositoryStatusApplyConfiguration) WithStats(values ...*ResourceCountApplyConfiguration) *RepositoryStatusApplyConfiguration {
	for i := range values {
		if values[i] == nil {
			panic("nil value passed to WithStats")
		}
		b.Stats = append(b.Stats, *values[i])
	}
	return b
}

// WithWebhook sets the Webhook field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Webhook field is set to the value of the last call.
func (b *RepositoryStatusApplyConfiguration) WithWebhook(value *WebhookStatusApplyConfiguration) *RepositoryStatusApplyConfiguration {
	b.Webhook = value
	return b
}

// WithToken sets the Token field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Token field is set to the value of the last call.
func (b *RepositoryStatusApplyConfiguration) WithToken(value *TokenStatusApplyConfiguration) *RepositoryStatusApplyConfiguration {
	b.Token = value
	return b
}

// WithDeleteError sets the DeleteError field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DeleteError field is set to the value of the last call.
func (b *RepositoryStatusApplyConfiguration) WithDeleteError(value string) *RepositoryStatusApplyConfiguration {
	b.DeleteError = &value
	return b
}

// WithQuota sets the Quota field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Quota field is set to the value of the last call.
func (b *RepositoryStatusApplyConfiguration) WithQuota(value *QuotaStatusApplyConfiguration) *RepositoryStatusApplyConfiguration {
	b.Quota = value
	return b
}
