package com.chinaweal.aiccs.aiccs.business.rules.init;

import com.chinaweal.aiccs.common.constant.CommonConstants;

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

/**
 * 流程常量
 * Created by xiaot on 2017/4/25.
 */
public abstract class FlowUtil {

    private static final Map<String, String> LINK_TYPE_MAP = new HashMap<>();

    //流程模板
    public static final String COMMON_WORK_FLOW = "commonWorkFlow"; //通用流程模板
    public static final String SUCCESSFUL_FLOW_ONE = "seriousWorkFlowOne"; //二级审批严重违法
    public static final String SUCCESSFUL_FLOW_TWO = "seriousWorkFlowTwo"; //一级严重违法
    public static final String SERIOUS_REM_WORK_FLOW = "seriousRemWorkFlow"; //严重违法移出流程模板
    public static final String ABNORMAL_INCLUSION_WORK_FLOW = "abnormalInclusionWorkFlow"; //经营异常列入和异议流程模板
    public static final String ABNORMAL_REM_WORK_FLOW = "abnormalRemWorkFlow"; //经营异常移出流程模板
    public static final String ABNORMAL_DISSENT_WORK_FLOW = "abnormalDissentWorkFlow"; //经营异常名录异议流程模板
    public static final String PUNISH_REM_WORK_FLOW = "punishRemWorkFlow"; // 行政处罚提前停止公示流程模板
    public static final String REVOKE_REM_WORK_FLOW = "revokeRemWorkFlow"; // 行政处罚依法变更撤销流程模板
    public static final String UNLICENSED_OPERATE_WORK_FLOW = "unlicensedOperateWorkFlow"; // 无照经营管理流程模板
    public static final String FORCE_DEREGISTER_WORK_FLOW = "forceDeregisterWorkFlow"; // 拟强制注销管理流程模板


    //统一环节节点
    private static final String LINK_START = "0"; //启动中
    private static final String LINK_ACCEPT = "1"; //受理中
    private static final String LINK_CHECK = "2";  //审查中
    private static final String LINK_APPROVE = "3"; //审批中
    private static final String LINK_END = "9"; //办结


    /**
     * 加载流程模板中的节点-名称映射
     * @author ymc
     * @since 2024年3月7日 10:29
     * @return
     */
    public static void initLinkMap() {
        InitRules.getRuleModels().forEach((ruleKey, ruleModel) -> ruleModel.getNodeModelMap().forEach((nodeKey, nodeModel) -> LINK_TYPE_MAP.put(ruleKey + CommonConstants.UNDERLINE + nodeKey, nodeModel.getDescription())));
    }

    /**
     * 获取流程模板环节中文名称
     * @author ymc
     * @since 2024年3月7日 10:46
     * @param definedName
     * @param linkType
     * @return
     */
    public static String getLinkTypeName(String definedName, String linkType) {
        return LINK_TYPE_MAP.get(definedName + CommonConstants.UNDERLINE + linkType);
    }
}
