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

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

package v3

// TemplateApplyConfiguration represents a declarative configuration of the Template type for use
// with apply.
type TemplateApplyConfiguration struct {
	// GenerateName is appended to the end of the generated AutoHostEndpoint name
	GenerateName *string `json:"generateName,omitempty"`
	// InterfaceCIDRs contains a list of CIDRs used for matching nodeIPs to the AutoHostEndpoint.
	// If specified, only addresses within these CIDRs will be included in the expected IPs.
	// At least one of InterfaceCIDRs and InterfacePattern must be specified.
	InterfaceCIDRs []string `json:"interfaceCIDRs,omitempty"`
	// InterfacePattern contains a regex string to match Node interface names. If specified, a HostEndpoint will be created for each matching interface on each selected node.
	// At least one of InterfaceCIDRs and InterfacePattern must be specified.
	InterfacePattern *string `json:"interfacePattern,omitempty"`
	// Labels adds the specified labels to the generated AutoHostEndpoint, labels from node with the same name will be overwritten by values from the template label
	Labels map[string]string `json:"labels,omitempty"`
	// NodeSelector allows the AutoHostEndpoint to be created only for specific nodes
	NodeSelector *string `json:"nodeSelector,omitempty"`
}

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

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

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

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

// WithLabels puts the entries into the Labels field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Labels field,
// overwriting an existing map entries in Labels field with the same key.
func (b *TemplateApplyConfiguration) WithLabels(entries map[string]string) *TemplateApplyConfiguration {
	if b.Labels == nil && len(entries) > 0 {
		b.Labels = make(map[string]string, len(entries))
	}
	for k, v := range entries {
		b.Labels[k] = v
	}
	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 *TemplateApplyConfiguration) WithNodeSelector(value string) *TemplateApplyConfiguration {
	b.NodeSelector = &value
	return b
}
