package com.ningdatech.pmapi.staging.utils;

import com.google.common.collect.Maps;
import com.ningdatech.pmapi.projectdeclared.manage.ReviewByDeptJointManage;
import com.ningdatech.pmapi.projectdeclared.manage.ReviewByProvincialDeptManage;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.Map;
import java.util.function.Function;

/**
 * @Classname ProjectStatusFlowMapUtil
 * @Description 状态流转 事件函数MAP
 * @Date 2023/2/15 11:19
 * @Author PoffyZhang
 */
@Component
public class ProjectStatusFlowUtil {
    /**
     * key 重试的次数 , value 是增加是描述
     */
    public Map<Integer, Integer> intervalTimeMap = Maps.newHashMap();

    /**
     *  初始化业务分派逻辑,代替了if-else部分
     *  key: 枚举 状态值
     *  value: lambda表达式,最终会获取发起实例的函数
     */
    public ProjectStatusFlowUtil(){
        intervalTimeMap.put(0,60);
        intervalTimeMap.put(1,60 * 2);
        intervalTimeMap.put(2,60 * 6);
        intervalTimeMap.put(3,60 * 15);
        intervalTimeMap.put(4,60 * 30);
        intervalTimeMap.put(5,60 * 60);
        intervalTimeMap.put(6,60 * 60 * 2);
        intervalTimeMap.put(7,60 * 60 * 5);
        intervalTimeMap.put(8,60 * 60 * 12);
        intervalTimeMap.put(9,60 * 60 * 24);
        intervalTimeMap.put(10,60 * 60 * 72);
        intervalTimeMap.put(11,60 * 60 * 216);
    }
}
