package easydo.technology.enums;

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

public enum ChengfaEnum {
    // 审批流类型
    BUS_APPROVE_TYPE_PURCHASE_PLAN("purchase_plan", "采购计划"),
    BUS_APPROVE_TYPE_PURCHASE("purchase", "采购申请"),
    BUS_APPROVE_TYPE_PURCHASE_MATTER("purchase_matter", "事项审批"),
    BUS_APPROVE_TYPE_PURCHASE_BID_SIGN("purchase_bid_sign", "招标会签"),
    BUS_APPROVE_TYPE_PURCHASE_ANSWER_SIGN("purchase_answer_sign", "答疑会签"),
    BUS_APPROVE_TYPE_PURCHASE_BID_NOTICE("purchase_bid_notice", "招标通知"),
    BUS_APPROVE_TYPE_SUPPLIER_EVALUATE("supplier_evaluate", "供应商评价"),
    // 审批流结束标识

    BUS_APPROVE_APPROVE_STATUS_APPROVE("approve", "发起审批流，待审批"),
    BUS_APPROVE_APPROVE_STATUS_DONE("done", "审批流结束标识"),
    // 审批结果
    BUS_APPROVE_APPROVE_RESULT_Y("y", "审批通过"),
    BUS_APPROVE_APPROVE_RESULT_N("n", "审批驳回"),
    // 招采计划的状态
    PURCHASE_PALN_STATUS_ACTIVE("active", "已保存，待发起审批"),
    PURCHASE_PALN_STATUS_APPROVE("approve", "待审批"),
    PURCHASE_PALN_STATUS_DONE("done", "已审批"),
    // 招采过程中的类型
    PURCHASE_TYOE_MATTER("matter", "事项"),
    PURCHASE_TYOE_PURCHASE("purchase", "采购"),

    // 招采过程的状态
    PURCHASE_STATUS_ACTIVE("active", "已保存，待发起审批"),
    PURCHASE_STATUS_APPROVE("approve", "待审批"),
    PURCHASE_STATUS_DONE("done", "已审批"),
    // 招采过程的操作步骤
    PURCHASE_STEP_PURCHASE_APPLY("purchase_apply", "采购申请"),
    PURCHASE_STEP_PURCHASE_MATTER("purchase_matter", "事项审批"),
    PURCHASE_STEP_PURCHASE_BID_SIGN("purchase_bid_sign", "招标会签"),
    PURCHASE_STEP_PURCHASE_ANSWER_SIGN("purchase_answer_sign", "答疑会签"),
    PURCHASE_STEP_PURCHASE_BID_NOTICE("purchase_bid_notice", "招标通知"),
    // 供应商评价主表的状态
    SUPPLIER_EVALUATE_STATUS_ACTIVE("active", "待评价"),
    SUPPLIER_EVALUATE_STATUS_EVALUATE("evaluate", "待评价"),
    SUPPLIER_EVALUATE_STATUS_DONE("done", "已评价"),
    // 供应商评价子表的状态
    SUPPLIER_EVALUATE_DETAIL_STATUS_ACTIVE("active", "待激活"),
    SUPPLIER_EVALUATE_DETAIL_STATUS_EVALUATE("evaluate", "待评价"),
    SUPPLIER_EVALUATE_DETAIL_STATUS_DONE("done", "已审批"),
    // 自动生成编号的类型
    FLOWNO_TYPE_PURCHASE("purchase", "采购编号"),
    FLOWNO_TYPE_PURCHASE_PLAN("purchase_plan", "采购计划编号"),
    FLOWNO_TYPE_PURCHASE_ANSWER_SIGN("purchase_answer_sign", "答疑会签编号"),
    FLOWNO_TYPE_PURCHASE_BID_NOTICE("purchase_bid_notice", "招标结果通知编号"),
    FLOWNO_TYPE_PURCHASE_BID_SIGN("purchase_bid_sign", "招标会签编号"),
    FLOWNO_TYPE_PURCHASE_MATTER("purchase_matter", "事项审批编号"),
    //消息所属业务
    MESSAGE_TYPE_SUPPLIER_EVALUATE("supplier_evaluate", "供应商评价消息"),
    MESSAGE_TYPE_PURCHASE("purchase", "采购消息"),
    MESSAGE_TYPE_PURCHASE_PLAN("purchase_plan", "采购计划消息"),
    MESSAGE_TYPE_PURCHASE_ANSWER_SIGN("purchase_answer_sign", "答疑会签消息"),
    MESSAGE_TYPE_PURCHASE_BID_NOTICE("purchase_bid_notice", "招标结果通知消息"),
    MESSAGE_TYPE_PURCHASE_BID_SIGN("purchase_bid_sign", "招标会签消息"),
    MESSAGE_TYPE_PURCHASE_MATTER("purchase_matter", "事项审批消息"),


    REDIS_KEY_SUPPLIER_EVALUATE_RULE("supplier_evaluate_rule", "供应商评价规则"),

    CONTRACT_PLAN_USE_STATE_NO_USE("No_Use", "未占用"),
    CONTRACT_PLAN_USE_STATE_PRE_USE("Pre_Use", "未占用"),
    CONTRACT_PLAN_USE_STATE_IN_USE("In_Use", "未占用"),

    APPROVE_STATE_UNSTARTED("UNSTARTED","未开始"),
    APPROVE_STATE_PROCESSING("PROCESSING","处理中"),
    APPROVE_STATE_REJECTED("REJECTED","驳回"),
    APPROVE_STATE_STOP("STOP","终止"),
    APPROVE_STATE_ENDED("ENDED","结束"),

    APPROVE_TOPIC_STARTED("STARTED","开始"),
    APPROVE_TOPIC_COMPLETED("COMPLETED","处理/通过"),
    APPROVE_TOPIC_STOPPED("STOPPED","终止"),
    APPROVE_TOPIC_REJECTED("REJECTED","拒绝"),
    APPROVE_TOPIC_ENDED("ENDED","完成/结束"),
    ;

    ChengfaEnum(String value, String comment) {
        this.value = value;
        this.comment = comment;
    }

    private static Map<String, ChengfaEnum> typelookup = new HashMap<>();

    static {
        for (ChengfaEnum mspEnum : ChengfaEnum.values()) {
            typelookup.put(mspEnum.value, mspEnum);
        }
    }

    public static boolean isContainsValue(String type) {
        return typelookup.containsKey(type);
    }

    public static ChengfaEnum forType(String type) {
        return typelookup.get(type);
    }

    private String value;
    private String comment;

    public String getValue() {
        return value;
    }

    public String getComment() {
        return comment;
    }

}
