/*
Copyright The Clusternet 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 (
	appsv1alpha1 "github.com/clusternet/clusternet/pkg/apis/apps/v1alpha1"
	v1 "k8s.io/api/core/v1"
)

// SubscriptionSpecApplyConfiguration represents a declarative configuration of the SubscriptionSpec type for use
// with apply.
type SubscriptionSpecApplyConfiguration struct {
	SchedulerName        *string                               `json:"schedulerName,omitempty"`
	SchedulingBySubGroup *bool                                 `json:"schedulingBySubGroup,omitempty"`
	SchedulingStrategy   *appsv1alpha1.SchedulingStrategyType  `json:"schedulingStrategy,omitempty"`
	DividingScheduling   *DividingSchedulingApplyConfiguration `json:"dividingScheduling,omitempty"`
	Priority             *int32                                `json:"priority,omitempty"`
	PreemptionPolicy     *appsv1alpha1.PreemptionPolicy        `json:"preemptionPolicy,omitempty"`
	Subscribers          []SubscriberApplyConfiguration        `json:"subscribers,omitempty"`
	ClusterTolerations   []v1.Toleration                       `json:"clusterTolerations,omitempty"`
	Feeds                []FeedApplyConfiguration              `json:"feeds,omitempty"`
}

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

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

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

// WithSchedulingStrategy sets the SchedulingStrategy 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 SchedulingStrategy field is set to the value of the last call.
func (b *SubscriptionSpecApplyConfiguration) WithSchedulingStrategy(value appsv1alpha1.SchedulingStrategyType) *SubscriptionSpecApplyConfiguration {
	b.SchedulingStrategy = &value
	return b
}

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

// WithPreemptionPolicy sets the PreemptionPolicy 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 PreemptionPolicy field is set to the value of the last call.
func (b *SubscriptionSpecApplyConfiguration) WithPreemptionPolicy(value appsv1alpha1.PreemptionPolicy) *SubscriptionSpecApplyConfiguration {
	b.PreemptionPolicy = &value
	return b
}

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

// WithClusterTolerations adds the given value to the ClusterTolerations 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 ClusterTolerations field.
func (b *SubscriptionSpecApplyConfiguration) WithClusterTolerations(values ...v1.Toleration) *SubscriptionSpecApplyConfiguration {
	for i := range values {
		b.ClusterTolerations = append(b.ClusterTolerations, values[i])
	}
	return b
}

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