/*
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 v1alpha3

// PoolStatusApplyConfiguration represents a declarative configuration of the PoolStatus type for use
// with apply.
//
// PoolStatus contains status information for a single resource pool.
type PoolStatusApplyConfiguration struct {
	// Driver is the DRA driver name for this pool.
	// Must be a DNS subdomain (e.g., "gpu.example.com").
	Driver *string `json:"driver,omitempty"`
	// PoolName is the name of the pool.
	// Must be a valid resource pool name (DNS subdomains separated by "/").
	PoolName *string `json:"poolName,omitempty"`
	// Generation is the pool generation observed across all ResourceSlices
	// in this pool. Only the latest generation is reported. During a generation
	// rollout, if not all slices at the latest generation have been published,
	// the pool is included with a validationError and device counts unset.
	Generation *int64 `json:"generation,omitempty"`
	// ResourceSliceCount is the number of ResourceSlices that make up this pool.
	// May be unset when validationError is set.
	ResourceSliceCount *int32 `json:"resourceSliceCount,omitempty"`
	// TotalDevices is the total number of devices in the pool across all slices.
	// A value of 0 means the pool has no devices.
	// May be unset when validationError is set.
	TotalDevices *int32 `json:"totalDevices,omitempty"`
	// AllocatedDevices is the number of devices currently allocated to claims.
	// A value of 0 means no devices are allocated.
	// May be unset when validationError is set.
	AllocatedDevices *int32 `json:"allocatedDevices,omitempty"`
	// AvailableDevices is the number of devices available for allocation.
	// This equals TotalDevices - AllocatedDevices - UnavailableDevices.
	// A value of 0 means no devices are currently available.
	// May be unset when validationError is set.
	AvailableDevices *int32 `json:"availableDevices,omitempty"`
	// UnavailableDevices is the number of devices that are not available
	// due to taints or other conditions, but are not allocated.
	// A value of 0 means all unallocated devices are available.
	// May be unset when validationError is set.
	UnavailableDevices *int32 `json:"unavailableDevices,omitempty"`
	// NodeName is the node this pool is associated with.
	// When omitted, the pool is not associated with a specific node.
	// Must be a valid DNS subdomain name (RFC1123).
	NodeName *string `json:"nodeName,omitempty"`
	// ValidationError is set when the pool's data could not be fully
	// validated (e.g., incomplete slice publication). When set, device
	// count fields and ResourceSliceCount may be unset.
	ValidationError *string `json:"validationError,omitempty"`
	// PartitionSummary reports allocatability per (attribute, partition type)
	// for a partitionable pool that publishes SharedCounters. Each entry names
	// the grouping attribute it was resolved from: the PartitionTypeAttribute
	// declared by a device's own slice, or for devices whose slice declares
	// none, the default named in the request. A pool that mixes partitions
	// declared under different attributes reports each independently. When no
	// slice declares an attribute and the request names no default, the pool
	// reports no partition summary.
	PartitionSummary []PartitionTypeStatusApplyConfiguration `json:"partitionSummary,omitempty"`
	// ShareableSummary reports aggregate capacity for a pool that contains
	// devices with AllowMultipleAllocations. It is populated only when at
	// least one device in the pool is shareable.
	ShareableSummary *ShareableSummaryStatusApplyConfiguration `json:"shareableSummary,omitempty"`
}

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

// WithDriver sets the Driver 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 Driver field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithDriver(value string) *PoolStatusApplyConfiguration {
	b.Driver = &value
	return b
}

// WithPoolName sets the PoolName 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 PoolName field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithPoolName(value string) *PoolStatusApplyConfiguration {
	b.PoolName = &value
	return b
}

// WithGeneration sets the Generation 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 Generation field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithGeneration(value int64) *PoolStatusApplyConfiguration {
	b.Generation = &value
	return b
}

// WithResourceSliceCount sets the ResourceSliceCount 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 ResourceSliceCount field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithResourceSliceCount(value int32) *PoolStatusApplyConfiguration {
	b.ResourceSliceCount = &value
	return b
}

// WithTotalDevices sets the TotalDevices 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 TotalDevices field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithTotalDevices(value int32) *PoolStatusApplyConfiguration {
	b.TotalDevices = &value
	return b
}

// WithAllocatedDevices sets the AllocatedDevices 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 AllocatedDevices field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithAllocatedDevices(value int32) *PoolStatusApplyConfiguration {
	b.AllocatedDevices = &value
	return b
}

// WithAvailableDevices sets the AvailableDevices 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 AvailableDevices field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithAvailableDevices(value int32) *PoolStatusApplyConfiguration {
	b.AvailableDevices = &value
	return b
}

// WithUnavailableDevices sets the UnavailableDevices 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 UnavailableDevices field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithUnavailableDevices(value int32) *PoolStatusApplyConfiguration {
	b.UnavailableDevices = &value
	return b
}

// WithNodeName sets the NodeName 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 NodeName field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithNodeName(value string) *PoolStatusApplyConfiguration {
	b.NodeName = &value
	return b
}

// WithValidationError sets the ValidationError 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 ValidationError field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithValidationError(value string) *PoolStatusApplyConfiguration {
	b.ValidationError = &value
	return b
}

// WithPartitionSummary adds the given value to the PartitionSummary 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 PartitionSummary field.
func (b *PoolStatusApplyConfiguration) WithPartitionSummary(values ...*PartitionTypeStatusApplyConfiguration) *PoolStatusApplyConfiguration {
	for i := range values {
		if values[i] == nil {
			panic("nil value passed to WithPartitionSummary")
		}
		b.PartitionSummary = append(b.PartitionSummary, *values[i])
	}
	return b
}

// WithShareableSummary sets the ShareableSummary 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 ShareableSummary field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithShareableSummary(value *ShareableSummaryStatusApplyConfiguration) *PoolStatusApplyConfiguration {
	b.ShareableSummary = value
	return b
}
