package com.ningdatech.kqapi.user.util;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * LoginUserContext
 * </p>
 *
 * @author WendyYang
 * @since 17:10 2023/2/24
 */
public class LoginUserContext {

    private LoginUserContext() {
    }

    private static final String PROJECT_ID = "PROJECT_ID";

    private static final ThreadLocal<Map<String, Object>> MAP = ThreadLocal.withInitial(() -> new HashMap<>(16));

    public static List<Long> getProjectIds() {
        return (List<Long>) MAP.get().get(PROJECT_ID);
    }

    public static void setProjectIds(List<Long> projectIds) {
        MAP.get().put(PROJECT_ID, projectIds);
    }

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

}
