/*
Copyright The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

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

package v1alpha1

import (
	metav1 "k8s.io/client-go/applyconfigurations/meta/v1"
	v1 "sigs.k8s.io/gateway-api/apis/v1"
	apisv1 "sigs.k8s.io/gateway-api/applyconfiguration/apis/v1"
)

// BackendAncestorStatusApplyConfiguration represents a declarative configuration of the BackendAncestorStatus type for use
// with apply.
//
// BackendAncestorStatus describes the status of a Backend with respect to a
// specific parent resource (typically a Gateway).
type BackendAncestorStatusApplyConfiguration struct {
	// ControllerName is a domain/path string that indicates the name of the
	// controller that manages the Backend.
	//
	// Example: "example.net/gateway-controller".
	//
	// The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are
	// valid Kubernetes names
	// (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
	//
	// <gateway:util:excludeFromCRD>
	// Notes for implementers:
	//
	// A controller MUST populate this field when writing status and ensure that
	// entries to status populated with their controller name are removed when
	// they are no longer necessary.
	// </gateway:util:excludeFromCRD>
	ControllerName *v1.GatewayController `json:"controllerName,omitempty"`
	// AncestorRef identifies the parent resource that this status is associated with.
	AncestorRef *apisv1.ParentReferenceApplyConfiguration `json:"parentRef,omitempty"`
	// For Kubernetes API conventions, see:
	// https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
	// conditions represent the current state of the Backend resource.
	// Each condition has a unique type and reflects the status of a specific aspect of the resource.
	//
	// Defined condition types include:
	// - "Accepted": the resource has been acknowledged and accepteed by the controller
	//
	// The status of each condition is one of True, False, or Unknown.
	Conditions []metav1.ConditionApplyConfiguration `json:"conditions,omitempty"`
}

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

// WithControllerName sets the ControllerName 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 ControllerName field is set to the value of the last call.
func (b *BackendAncestorStatusApplyConfiguration) WithControllerName(value v1.GatewayController) *BackendAncestorStatusApplyConfiguration {
	b.ControllerName = &value
	return b
}

// WithAncestorRef sets the AncestorRef 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 AncestorRef field is set to the value of the last call.
func (b *BackendAncestorStatusApplyConfiguration) WithAncestorRef(value *apisv1.ParentReferenceApplyConfiguration) *BackendAncestorStatusApplyConfiguration {
	b.AncestorRef = value
	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 *BackendAncestorStatusApplyConfiguration) WithConditions(values ...*metav1.ConditionApplyConfiguration) *BackendAncestorStatusApplyConfiguration {
	for i := range values {
		if values[i] == nil {
			panic("nil value passed to WithConditions")
		}
		b.Conditions = append(b.Conditions, *values[i])
	}
	return b
}
