package com.codvision.workflow.constant.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 流程操作类型
 * @author hxl
 */
@Getter
@AllArgsConstructor
public enum WorkFlowOperationTypeEnum {

    // 开始
    INITIATED(-2, ""),

    // 结束
    ENDED(-1,""),

    // 已签收
    CLAIM(0,"flow_claim"),

    // 已处置
    AGREED(1,"flow_agree"),

    // 已转办
    TRANSFERRED(2,"flow_transfer"),

    // 已委派
    DELEGATED(3,"flow_delegate"),

    // 已拒绝
    REJECTED(4,"flow_reject"),

    // 撤回重办
    REVOKE_REDO(5,""),

    // 已退回
    RETURN(6,"");

    private final int type;
    private final String code;

    public static WorkFlowOperationTypeEnum getType(int type) {
        for (WorkFlowOperationTypeEnum value : values()) {
            if (value.getType() == type) {
                return value;
            }
        }
        return null;
    }
}
