package com.ningdatech.pmapi.staging.utils;

import java.util.List;
import java.util.Map;
import java.util.function.Function;

import javax.annotation.PostConstruct;

import com.ningdatech.pmapi.common.util.SendWorkNoticeUtil;
import com.ningdatech.pmapi.staging.enums.MsgTypeEnum;
import com.ningdatech.pmapi.staging.model.entity.WorkNoticeStaging;
import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo;
import org.springframework.stereotype.Component;

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 lombok.RequiredArgsConstructor;

/**
 * 工作通知流转 事件函数MAP
 * @return
 * @author CMM
 * @since 2023/02/28 17:03
 */
@Component
@RequiredArgsConstructor
public class WorkNoticeFlowMapUtil {
    //public Map<Integer, Function<WorkNoticeInfo,Boolean>> workNoticeFlowFunctionMap = Maps.newHashMap();
    /**
     * key 重试的次数 , value 是增加是描述
     */
    public Map<Integer, Integer> intervalTimeMap = Maps.newHashMap();

    ///**
    // *  初始化工作通知分派逻辑,代替了if-else部分
    // *  key: 枚举 消息类型
    // *  value: lambda表达式,最终会获取发送工作通知的函数
    // */
    //@PostConstruct
    //public void workNoticeFlowFunctionInit(){
    //    // 待审核
    //    workNoticeFlowFunctionMap.put(MsgTypeEnum.AUDIT.getCode(),
    //            workNoticeInfos-> SendWorkNoticeUtil.sendWorkNotice(workNoticeInfos));
    //
    //    // 审核通过
    //    workNoticeFlowFunctionMap.put(MsgTypeEnum.PASS.getCode(),
    //            workNoticeInfos-> SendWorkNoticeUtil.sendWorkNotice(workNoticeInfos));
    //
    //    // 被驳回
    //    workNoticeFlowFunctionMap.put(MsgTypeEnum.REJECTED.getCode(),
    //            workNoticeInfos-> SendWorkNoticeUtil.sendWorkNotice(workNoticeInfos));
    //
    //    // 被退回
    //    workNoticeFlowFunctionMap.put(MsgTypeEnum.BACKED.getCode(),
    //            workNoticeInfos-> SendWorkNoticeUtil.sendWorkNotice(workNoticeInfos));
    //
    //    // 被驳回
    //    workNoticeFlowFunctionMap.put(MsgTypeEnum.REJECTED.getCode(),
    //            workNoticeInfos-> SendWorkNoticeUtil.sendWorkNotice(workNoticeInfos));
    //
    //}

    /**
     *  扫描的间隔越来越长 秒数
     */
    @PostConstruct
    public void intervalTimeMapInit(){
        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);
    }
}
