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

import (
	batchv1alpha1 "volcano.sh/apis/pkg/client/applyconfiguration/batch/v1alpha1"
)

// ReplicatedJobApplyConfiguration represents a declarative configuration of the ReplicatedJob type for use
// with apply.
type ReplicatedJobApplyConfiguration struct {
	Name *string `json:"name,omitempty"`
	// TemplateSpec is the spec of the volcano job that will be replicated.
	TemplateSpec *batchv1alpha1.JobSpecApplyConfiguration `json:"templateSpec,omitempty"`
	// SplitPolicy is used in multi-cluster splitting to specify the splitting strategy,
	// including the number and types of accelerators that need to be split
	SplitPolicy *SplitPolicyApplyConfiguration `json:"splitPolicy,omitempty"`
	// Replicas is the number of replicated volcano jobs.
	Replicas *int32 `json:"replicas,omitempty"`
	// ClusterNames is the list of cluster names to which the replicated jobs prefer to be scheduled.
	ClusterNames []string `json:"clusterNames,omitempty"`
}

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

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

// WithTemplateSpec sets the TemplateSpec 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 TemplateSpec field is set to the value of the last call.
func (b *ReplicatedJobApplyConfiguration) WithTemplateSpec(value *batchv1alpha1.JobSpecApplyConfiguration) *ReplicatedJobApplyConfiguration {
	b.TemplateSpec = value
	return b
}

// WithSplitPolicy sets the SplitPolicy 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 SplitPolicy field is set to the value of the last call.
func (b *ReplicatedJobApplyConfiguration) WithSplitPolicy(value *SplitPolicyApplyConfiguration) *ReplicatedJobApplyConfiguration {
	b.SplitPolicy = value
	return b
}

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

// WithClusterNames adds the given value to the ClusterNames 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 ClusterNames field.
func (b *ReplicatedJobApplyConfiguration) WithClusterNames(values ...string) *ReplicatedJobApplyConfiguration {
	for i := range values {
		b.ClusterNames = append(b.ClusterNames, values[i])
	}
	return b
}
