/*
Copyright The Volcano 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 v1beta1

import (
	v1 "k8s.io/api/core/v1"
	schedulingv1beta1 "volcano.sh/apis/pkg/apis/scheduling/v1beta1"
)

// QueueSpecApplyConfiguration represents a declarative configuration of the QueueSpec type for use
// with apply.
//
// QueueSpec represents the template of Queue.
type QueueSpecApplyConfiguration struct {
	Weight     *int32           `json:"weight,omitempty"`
	Capability *v1.ResourceList `json:"capability,omitempty"`
	// Reclaimable indicate whether the queue can be reclaimed by other queue
	Reclaimable *bool `json:"reclaimable,omitempty"`
	// extendCluster indicate the jobs in this Queue will be dispatched to these clusters.
	ExtendClusters []ClusterApplyConfiguration `json:"extendClusters,omitempty"`
	// Guarantee indicate configuration about resource reservation
	Guarantee *GuaranteeApplyConfiguration `json:"guarantee,omitempty"`
	// If specified, the pod owned by the queue will be scheduled with constraint
	Affinity *AffinityApplyConfiguration `json:"affinity,omitempty"`
	// Type define the type of queue
	Type *string `json:"type,omitempty"`
	// Parent define the parent of queue
	Parent *string `json:"parent,omitempty"`
	// The amount of resources configured by the user. This part of resource can be shared with other queues and reclaimed back.
	Deserved *v1.ResourceList `json:"deserved,omitempty"`
	// Priority define the priority of queue. Higher values are prioritized for scheduling and considered later during reclamation.
	Priority *int32 `json:"priority,omitempty"`
	// DequeueStrategy defines the dequeue strategy of queue
	DequeueStrategy *schedulingv1beta1.DequeueStrategy `json:"dequeueStrategy,omitempty"`
}

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

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

// WithCapability sets the Capability 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 Capability field is set to the value of the last call.
func (b *QueueSpecApplyConfiguration) WithCapability(value v1.ResourceList) *QueueSpecApplyConfiguration {
	b.Capability = &value
	return b
}

// WithReclaimable sets the Reclaimable 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 Reclaimable field is set to the value of the last call.
func (b *QueueSpecApplyConfiguration) WithReclaimable(value bool) *QueueSpecApplyConfiguration {
	b.Reclaimable = &value
	return b
}

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

// WithGuarantee sets the Guarantee 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 Guarantee field is set to the value of the last call.
func (b *QueueSpecApplyConfiguration) WithGuarantee(value *GuaranteeApplyConfiguration) *QueueSpecApplyConfiguration {
	b.Guarantee = value
	return b
}

// WithAffinity sets the Affinity 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 Affinity field is set to the value of the last call.
func (b *QueueSpecApplyConfiguration) WithAffinity(value *AffinityApplyConfiguration) *QueueSpecApplyConfiguration {
	b.Affinity = value
	return b
}

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

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

// WithDeserved sets the Deserved 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 Deserved field is set to the value of the last call.
func (b *QueueSpecApplyConfiguration) WithDeserved(value v1.ResourceList) *QueueSpecApplyConfiguration {
	b.Deserved = &value
	return b
}

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

// WithDequeueStrategy sets the DequeueStrategy 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 DequeueStrategy field is set to the value of the last call.
func (b *QueueSpecApplyConfiguration) WithDequeueStrategy(value schedulingv1beta1.DequeueStrategy) *QueueSpecApplyConfiguration {
	b.DequeueStrategy = &value
	return b
}
