package com.yd.csf.service.audit;

public class AuditContextHolder {

    private static final ThreadLocal<AuditContext> CONTEXT = new ThreadLocal<>();

    public static void set(AuditContext context) {
        CONTEXT.set(context);
    }

    public static AuditContext get() {
        return CONTEXT.get();
    }

    public static String getRequestId() {
        AuditContext ctx = CONTEXT.get();
        return ctx != null ? ctx.getRequestId() : null;
    }

    public static void clear() {
        CONTEXT.remove();
    }
}
