package com.xisc.pm.app.service.strategy;

public class SecondaryDesignHelper {

    private static ThreadLocal<Boolean> SEND_CT_EVENT = new ThreadLocal<>();

    private static ThreadLocal<Boolean> END_CALL_MM_STATUS_CHANGE_EVENT = new ThreadLocal<>();

    private static ThreadLocal<Boolean> ORGIN_STATUS_CHANGE = new ThreadLocal<>();
    
    private static ThreadLocal<Boolean> TWO_ROLL_FLAG = new ThreadLocal<>();

    public static void remove() {
        SEND_CT_EVENT.remove();
        END_CALL_MM_STATUS_CHANGE_EVENT.remove();
        ORGIN_STATUS_CHANGE.remove();
        TWO_ROLL_FLAG.remove();
    }

    public static void set(boolean sendCtEvent, boolean callMmMatStatus, boolean orginStatusChange) {
        SEND_CT_EVENT.set(sendCtEvent);
        END_CALL_MM_STATUS_CHANGE_EVENT.set(callMmMatStatus);
        ORGIN_STATUS_CHANGE.set(orginStatusChange);
    }
    
    public static void setTwoRollFlag(boolean twoRollFlag) {
        TWO_ROLL_FLAG.set(twoRollFlag);
    }
    
    public static Boolean isTwoRollFlag() {
        return TWO_ROLL_FLAG.get() == null ? false : TWO_ROLL_FLAG.get();
    }

    /*
     * 是否进行状态变更
     */
    public static Boolean isOrginStatusChange() {
        return ORGIN_STATUS_CHANGE.get() == null ? true : END_CALL_MM_STATUS_CHANGE_EVENT.get();
    }

    /**
     * 是否发送材料状态
     * 
     * @return
     */
    public static Boolean isCallMmMatStatusChange() {
        return END_CALL_MM_STATUS_CHANGE_EVENT.get() == null ? true : END_CALL_MM_STATUS_CHANGE_EVENT.get();
    }

    /**
     * 是否发送合同跟踪事件
     * 
     * @return
     */
    public static Boolean isSendCtEvent() {
        return SEND_CT_EVENT.get() == null ? true : SEND_CT_EVENT.get();
    }
}
