package com.cool.store.enums;

/**
 * @Author suzhuhong
 * @Date 2024/3/19 16:53
 * @Version 1.0
 */
public enum WorkflowSubStageEnum{

    /**
     * 流程子阶段枚举
     */
    INTEND(1, "加盟意向申请", WorkflowSubStageStatusEnum.INTENT_0,"joinIntentionServiceImpl",0),
    PAY_DEPOSIT(15, "缴纳意向金", WorkflowSubStageStatusEnum.PAY_DEPOSIT_45, "bankServiceImpl",4),
    SIGN_INTENT_AGREEMENT(20, "签署意向协议", WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_70, "intentAgreementServiceImpl",6);

    private Integer code;

    private String message;

    private Integer  progress;

    private WorkflowSubStageStatusEnum initStatus;

    private WorkflowSubStageEnum nextStage;

    private String clazz;

    WorkflowSubStageEnum(Integer code, String message, WorkflowSubStageStatusEnum initStatus, String clazz,Integer progress) {
        this.code = code;
        this.message = message;
        this.initStatus = initStatus;
        this.clazz = clazz;
        this.progress = progress;
    }


    public Integer getCode() {
        return code;
    }

    public Integer getProgress() {
        return progress;
    }

    public String getMessage() {
        return message;
    }

    public WorkflowSubStageStatusEnum getInitStatus() {
        return initStatus;
    }

    public String getClazz() {
        return clazz;
    }

    public WorkflowSubStageEnum getNextStage() {
        switch (this) {
            case INTEND:
                this.nextStage = PAY_DEPOSIT;
                break;
            case PAY_DEPOSIT:
                this.nextStage = SIGN_INTENT_AGREEMENT;
                break;
            case SIGN_INTENT_AGREEMENT:
                this.nextStage = null;
                break;
        }
        return nextStage;
    }

    public static WorkflowSubStageEnum getWorkflowSubStageEnum(Integer workflowSubStage) {
        for (WorkflowSubStageEnum workflowSubStageEnum : WorkflowSubStageEnum.values()) {
            if (workflowSubStageEnum.getCode().equals(workflowSubStage)) {
                return workflowSubStageEnum;
            }
        }
        return null;
    }
}
