// Copyright 2025 Microsoft Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by applyconfiguration-gen. DO NOT EDIT.

package v1alpha1

import (
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	v1 "k8s.io/client-go/applyconfigurations/meta/v1"
)

// SessionStatusApplyConfiguration represents a declarative configuration of the SessionStatus type for use
// with apply.
//
// SessionStatus reports the observed state of the Session, including the provisioned resources,
// the session endpoint URL for accessing the HCP, and the session's expiration time. The status
// is updated by the controller as it provisions and manages session resources.
type SessionStatusApplyConfiguration struct {
	// conditions represent the current state of the session. Known condition types are:
	// - "Ready": True when the session is fully provisioned and accessible
	// - "CredentialsAvailable": True when session credentials have been created
	// - "NetworkPathAvailable": True when the network path to the HCP is established
	// The status of each condition is one of True, False, or Unknown.
	Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"`
	// expiresAt is the timestamp when the session will expire and become invalid.
	// This is calculated as the session's creation timestamp plus the TTL specified in spec.ttl.
	// After this time, the controller will clean up session resources and the session
	// endpoint will no longer accept connections. This field is immutable once set.
	ExpiresAt *metav1.Time `json:"expiresAt,omitempty"`
	// endpoint is the URL that the session owner uses to access the HCP's Kubernetes
	// API server. This endpoint acts as an authenticated proxy, forwarding requests to the
	// target HCP's KAS after validating the session owner's identity. The endpoint is
	// provisioned by the controller and becomes available when the session is ready.
	Endpoint *string `json:"endpoint,omitempty"`
	// credentialsSecretRef is a reference to the Kubernetes Secret containing the session's
	// authentication credentials. These credentials are used by the session proxy to
	// authenticate requests and by clients to establish secure connections.
	CredentialsSecretRef *string `json:"credentialsSecretRef,omitempty"`
	// backendKASURL is the internal URL used by the session proxy to communicate with the
	// target HCP's Kubernetes API server. For public HCPs, this is the HCP's public KAS
	// endpoint. For private HCPs that are not directly accessible, this may be a local
	// port-forward endpoint or internal service URL. This field is set by the controller
	// based on the HCP's network configuration.
	BackendKASURL *string `json:"backendKASURL,omitempty"`
}

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

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

// WithExpiresAt sets the ExpiresAt 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 ExpiresAt field is set to the value of the last call.
func (b *SessionStatusApplyConfiguration) WithExpiresAt(value metav1.Time) *SessionStatusApplyConfiguration {
	b.ExpiresAt = &value
	return b
}

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

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

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