package redact

import "regexp"

var (
	bearerPattern = regexp.MustCompile(`(?i)Bearer\s+[A-Za-z0-9._\-]+`)
	tokenPattern  = regexp.MustCompile(`(?i)(api[_-]?key|token|authorization)\s*[:=]\s*["']?[^"'\s,}]+`)
)

func Message(message string) string {
	if message == "" {
		return message
	}
	message = bearerPattern.ReplaceAllString(message, "Bearer [REDACTED]")
	message = tokenPattern.ReplaceAllString(message, "$1=[REDACTED]")
	return message
}
