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

package v1

// PerspectiveApplyConfiguration represents a declarative configuration of the Perspective type for use
// with apply.
//
// Perspective defines a perspective that cluster admins want to show/hide in the perspective switcher dropdown
type PerspectiveApplyConfiguration struct {
	// id defines the id of the perspective.
	// Example: "dev", "admin".
	// The available perspective ids can be found in the code snippet section next to the yaml editor.
	// Incorrect or unknown ids will be ignored.
	ID *string `json:"id,omitempty"`
	// visibility defines the state of perspective along with access review checks if needed for that perspective.
	Visibility *PerspectiveVisibilityApplyConfiguration `json:"visibility,omitempty"`
	// pinnedResources defines the list of default pinned resources that users will see on the perspective navigation if they have not customized these pinned resources themselves.
	// The list of available Kubernetes resources could be read via `kubectl api-resources`.
	// The console will also provide a configuration UI and a YAML snippet that will list the available resources that can be pinned to the navigation.
	// Incorrect or unknown resources will be ignored.
	PinnedResources *[]PinnedResourceReferenceApplyConfiguration `json:"pinnedResources,omitempty"`
}

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

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

// WithVisibility sets the Visibility 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 Visibility field is set to the value of the last call.
func (b *PerspectiveApplyConfiguration) WithVisibility(value *PerspectiveVisibilityApplyConfiguration) *PerspectiveApplyConfiguration {
	b.Visibility = value
	return b
}

func (b *PerspectiveApplyConfiguration) ensurePinnedResourceReferenceApplyConfigurationExists() {
	if b.PinnedResources == nil {
		b.PinnedResources = &[]PinnedResourceReferenceApplyConfiguration{}
	}
}

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