// 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"
)

// IPPoolSpecApplyConfiguration represents a declarative configuration of the IPPoolSpec type for use
// with apply.
//
// IPPoolSpec contains the specification for an IPPool resource.
type IPPoolSpecApplyConfiguration struct {
	// The pool CIDR.
	CIDR *string `json:"cidr,omitempty"`
	// Contains configuration for VXLAN tunneling for this pool.
	VXLANMode *projectcalicov3.VXLANMode `json:"vxlanMode,omitempty"`
	// Contains configuration for IPIP tunneling for this pool.
	// For IPv6 pools, IPIP tunneling must be disabled.
	IPIPMode *projectcalicov3.IPIPMode `json:"ipipMode,omitempty"`
	// When natOutgoing is true, packets sent from Calico networked containers in
	// this pool to destinations outside of this pool will be masqueraded.
	NATOutgoing *bool `json:"natOutgoing,omitempty"`
	// When disabled is true, Calico IPAM will not assign addresses from this pool.
	Disabled *bool `json:"disabled,omitempty"`
	// Disable exporting routes from this IP Pool's CIDR over BGP. [Default: false]
	DisableBGPExport *bool `json:"disableBGPExport,omitempty"`
	// The block size to use for IP address assignments from this pool. Defaults to 26 for IPv4 and 122 for IPv6.
	// The block size must be between 0 and 32 for IPv4 and between 0 and 128 for IPv6. It must also be smaller than
	// or equal to the size of the pool CIDR.
	BlockSize *int `json:"blockSize,omitempty"`
	// Allows IPPool to allocate for a specific node by label selector.
	NodeSelector *string `json:"nodeSelector,omitempty"`
	// Allows IPPool to allocate for a specific namespace by label selector.
	// If specified, both namespaceSelector and nodeSelector must match for the pool to be used.
	NamespaceSelector *string `json:"namespaceSelector,omitempty"`
	// AllowedUse controls what the IP pool will be used for.  If not specified or empty, defaults to
	// ["Tunnel", "Workload"] for back-compatibility
	AllowedUses []projectcalicov3.IPPoolAllowedUse `json:"allowedUses,omitempty"`
	// Determines the mode how IP addresses should be assigned from this pool
	AssignmentMode *projectcalicov3.AssignmentMode `json:"assignmentMode,omitempty"`
}

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

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

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

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

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

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

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

// WithBlockSize sets the BlockSize 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 BlockSize field is set to the value of the last call.
func (b *IPPoolSpecApplyConfiguration) WithBlockSize(value int) *IPPoolSpecApplyConfiguration {
	b.BlockSize = &value
	return b
}

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

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

// WithAllowedUses adds the given value to the AllowedUses 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 AllowedUses field.
func (b *IPPoolSpecApplyConfiguration) WithAllowedUses(values ...projectcalicov3.IPPoolAllowedUse) *IPPoolSpecApplyConfiguration {
	for i := range values {
		b.AllowedUses = append(b.AllowedUses, values[i])
	}
	return b
}

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