package cn.axzo.workflow.core.common.enums;

import java.util.Arrays;

/**
 * 流程实例中任务维度的状态枚举
 *
 * @author wangli
 * @since 2023/9/18 17:11
 */
public enum BpmnProcessTaskResultEnum {

    AUTO_SKIP("AUTO_SKIP", "任务自动跳过"),
    // 引擎默认的标识,不允许修改
    MI_END("MI_END", "多实例任务运行结束"),
    // 引擎默认的标识,不允许修改
    DELETE_MI_EXECUTION("Delete MI execution", "多实例任务被删除"),
    INITIATOR_REVOCATION("INITIATOR_REVOCATION", "发起者主动撤回"),
    REJECTION_AUTO_COMPLETED("REJECTION_AUTO_COMPLETED", "审批驳回自动结束"),
    BACKED("BACKED", "退回");

    private final String status;
    /**
     * 描述
     */
    private final String desc;

    BpmnProcessTaskResultEnum(String status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    public String getStatus() {
        return status;
    }

    public String getDesc() {
        return desc;
    }

    public static BpmnProcessTaskResultEnum valueOfStatus(String status) {
        return Arrays.stream(values()).filter(it -> it.getStatus().equals(status)).findFirst()
                .orElse(null);
    }
}
