// Copyright (c) 2026 Tigera, Inc. All rights reserved.

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

package v3

import (
	projectcalicov3 "github.com/projectcalico/api/pkg/apis/projectcalico/v3"
)

// IPAMConfigurationSpecApplyConfiguration represents a declarative configuration of the IPAMConfigurationSpec type for use
// with apply.
//
// IPAMConfigurationSpec contains the specification for an IPAMConfiguration resource.
type IPAMConfigurationSpecApplyConfiguration struct {
	// When StrictAffinity is true, borrowing IP addresses is not allowed.
	StrictAffinity *bool `json:"strictAffinity,omitempty"`
	// MaxBlocksPerHost, if non-zero, is the max number of blocks that can be
	// affine to each host.
	MaxBlocksPerHost *int32 `json:"maxBlocksPerHost,omitempty"`
	// Whether or not to auto allocate blocks to hosts.
	AutoAllocateBlocks *bool `json:"autoAllocateBlocks,omitempty"`
	// KubeVirtVMAddressPersistence controls whether KubeVirt VirtualMachine workloads
	// maintain persistent IP addresses across VM lifecycle events (reboot, migration, pod eviction).
	// When Enabled, Calico automatically ensures that KubeVirt VMs retain their IP addresses
	// when their underlying pods are recreated during VM operations.
	// When Disabled, VMs receive new IP addresses whenever their pods are recreated,
	// and creating a live migration target pod is not supported because the migration
	// target pod requires the same IP as the source pod, which is only possible with
	// address persistence.
	// Defaults to Enabled if not specified.
	KubeVirtVMAddressPersistence *projectcalicov3.VMAddressPersistence `json:"kubeVirtVMAddressPersistence,omitempty"`
}

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

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

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

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

// WithKubeVirtVMAddressPersistence sets the KubeVirtVMAddressPersistence 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 KubeVirtVMAddressPersistence field is set to the value of the last call.
func (b *IPAMConfigurationSpecApplyConfiguration) WithKubeVirtVMAddressPersistence(value projectcalicov3.VMAddressPersistence) *IPAMConfigurationSpecApplyConfiguration {
	b.KubeVirtVMAddressPersistence = &value
	return b
}
