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

package v1beta1

import (
	corev1 "k8s.io/api/core/v1"
	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	intstr "k8s.io/apimachinery/pkg/util/intstr"
)

// MachineHealthCheckSpecApplyConfiguration represents an declarative configuration of the MachineHealthCheckSpec type for use
// with apply.
type MachineHealthCheckSpecApplyConfiguration struct {
	Selector            *v1.LabelSelector                      `json:"selector,omitempty"`
	UnhealthyConditions []UnhealthyConditionApplyConfiguration `json:"unhealthyConditions,omitempty"`
	MaxUnhealthy        *intstr.IntOrString                    `json:"maxUnhealthy,omitempty"`
	NodeStartupTimeout  *v1.Duration                           `json:"nodeStartupTimeout,omitempty"`
	RemediationTemplate *corev1.ObjectReference                `json:"remediationTemplate,omitempty"`
}

// MachineHealthCheckSpecApplyConfiguration constructs an declarative configuration of the MachineHealthCheckSpec type for use with
// apply.
func MachineHealthCheckSpec() *MachineHealthCheckSpecApplyConfiguration {
	return &MachineHealthCheckSpecApplyConfiguration{}
}

// WithSelector sets the Selector 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 Selector field is set to the value of the last call.
func (b *MachineHealthCheckSpecApplyConfiguration) WithSelector(value v1.LabelSelector) *MachineHealthCheckSpecApplyConfiguration {
	b.Selector = &value
	return b
}

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

// WithMaxUnhealthy sets the MaxUnhealthy 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 MaxUnhealthy field is set to the value of the last call.
func (b *MachineHealthCheckSpecApplyConfiguration) WithMaxUnhealthy(value intstr.IntOrString) *MachineHealthCheckSpecApplyConfiguration {
	b.MaxUnhealthy = &value
	return b
}

// WithNodeStartupTimeout sets the NodeStartupTimeout 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 NodeStartupTimeout field is set to the value of the last call.
func (b *MachineHealthCheckSpecApplyConfiguration) WithNodeStartupTimeout(value v1.Duration) *MachineHealthCheckSpecApplyConfiguration {
	b.NodeStartupTimeout = &value
	return b
}

// WithRemediationTemplate sets the RemediationTemplate 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 RemediationTemplate field is set to the value of the last call.
func (b *MachineHealthCheckSpecApplyConfiguration) WithRemediationTemplate(value corev1.ObjectReference) *MachineHealthCheckSpecApplyConfiguration {
	b.RemediationTemplate = &value
	return b
}
