package middleware

import (
	"context"
	"net/http"

	"github.com/ultisuite/ulti-backend/internal/auth"
)

// WithTestClaims injects auth claims into the request context for handler tests.
// Production auth behavior is unchanged; use only in tests.
func WithTestClaims(claims *auth.Claims) func(http.Handler) http.Handler {
	return func(next http.Handler) http.Handler {
		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			ctx := context.WithValue(r.Context(), claimsKey, claims)
			next.ServeHTTP(w, r.WithContext(ctx))
		})
	}
}
