package com.qmth.teachcloud.common.enums;

import java.util.Objects;

/**
 * @Description: 广东医科大学流程审批步骤 enum
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2021/8/2
 */
public enum FlowGdykdxApproveSetupEnum {

    SUBMIT("提交试卷", "usertask1", 1),

    PRIMARY_APPROVE("一级审核", "usertask2", 2),

    SECOND_APPROVE("二级审核", "usertask3", 3),

    END("已终止", null, -1),

    FINISH("已结束", null, 0);

    private String title;

    private String id;

    private int setup;

    private FlowGdykdxApproveSetupEnum(String title, String id, int setup) {
        this.title = title;
        this.id = id;
        this.setup = setup;
    }

    public String getTitle() {
        return title;
    }

    public String getId() {
        return id;
    }

    public int getSetup() {
        return setup;
    }

    /**
     * 状态转换 toName
     *
     * @param title
     * @return
     */
    public static String convertToName(String title) {
        for (FlowGdykdxApproveSetupEnum e : FlowGdykdxApproveSetupEnum.values()) {
            if (Objects.equals(title, e.getTitle())) {
                return e.name();
            }
        }
        return null;
    }

    /**
     * 状态转换 ToInstance
     *
     * @param id
     * @return
     */
    public static FlowGdykdxApproveSetupEnum convertToInstance(String id) {
        for (FlowGdykdxApproveSetupEnum e : FlowGdykdxApproveSetupEnum.values()) {
            if (Objects.equals(id, e.getId())) {
                return e;
            }
        }
        return null;
    }
}
