package constants

import (
	"context"

	contractconstants "github.com/pingcap-inc/nexuscrm-contract/pkg/constants"
)

// SecurityContext controls which security checks are bypassed.
type SecurityContext = contractconstants.SecurityContext

const (
	UserContext     = contractconstants.UserContext
	ServiceContext  = contractconstants.ServiceContext
	ElevatedContext = contractconstants.ElevatedContext
	SystemContext   = contractconstants.SystemContext
)

// WithSecurityContext sets the security context with a mandatory reason for audit.
func WithSecurityContext(ctx context.Context, level SecurityContext, reason string) context.Context {
	return contractconstants.WithSecurityContext(ctx, level, reason)
}

// GetSecurityContext returns the security context from ctx, defaulting to UserContext.
func GetSecurityContext(ctx context.Context) SecurityContext {
	return contractconstants.GetSecurityContext(ctx)
}
