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),
    INVITING_INTERVIEWS(5, "邀约面谈", WorkflowSubStageStatusEnum.INVITING_INTERVIEWS_10, "lineInterviewServiceImpl",2),
    FIRST_INTERVIEWS(10, "一审面试", WorkflowSubStageStatusEnum.FIRST_INTERVIEWS_25, "lineInterviewServiceImpl",4),
    PAY_DEPOSIT(15, "缴纳意向金", WorkflowSubStageStatusEnum.PAY_DEPOSIT_45, "bankServiceImpl",4),
    SIGN_INTENT_AGREEMENT(20, "签署意向协议", WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_60, "intentAgreementServiceImpl",6),
    STORE_EXPERIENCE(25, "门店体验", WorkflowSubStageStatusEnum.STORE_EXPERIENCE_85, "trainingExperienceServiceImpl",9),
    SECOND_INTERVIEWS(30, "二审面试", WorkflowSubStageStatusEnum.SECOND_INTERVIEWS_100, "lineInterviewServiceImpl",10);

    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 = INVITING_INTERVIEWS;
                break;
            case INVITING_INTERVIEWS:
                this.nextStage = FIRST_INTERVIEWS;
                break;
            case FIRST_INTERVIEWS:
                this.nextStage = PAY_DEPOSIT;
                break;
            case PAY_DEPOSIT:
                this.nextStage = SIGN_INTENT_AGREEMENT;
                break;
            case SIGN_INTENT_AGREEMENT:
                this.nextStage = STORE_EXPERIENCE;
                break;
            case STORE_EXPERIENCE:
            case SECOND_INTERVIEWS:
                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;
    }

    /**
     * 是否是面试阶段
     * @param workflowSubStage
     * @return
     */
    public static boolean isInterviewStage(Integer workflowSubStage) {
        return INVITING_INTERVIEWS.getCode().equals(workflowSubStage) || FIRST_INTERVIEWS.getCode().equals(workflowSubStage) || SECOND_INTERVIEWS.getCode().equals(workflowSubStage);
    }

    /**
     * 是否是重新预约面试阶段
     * @param workflowSubStage
     * @return
     */
    public static boolean isReappointmentStage(Integer workflowSubStage) {
        return FIRST_INTERVIEWS.getCode().equals(workflowSubStage) || SECOND_INTERVIEWS.getCode().equals(workflowSubStage);
    }

    public static InterviewTypeEnum getInterviewType(Integer workflowSubStage){
        if(INVITING_INTERVIEWS.getCode().equals(workflowSubStage)){
            return InterviewTypeEnum.MEET;
        }
        if(FIRST_INTERVIEWS.getCode().equals(workflowSubStage)){
            return InterviewTypeEnum.INTERVIEW;
        }
        if(SECOND_INTERVIEWS.getCode().equals(workflowSubStage)){
            return InterviewTypeEnum.SECOND_INTERVIEW;
        }
        return null;
    }
}
