package com.hzs.common.core.enums;

import com.hzs.common.core.constant.EnumsPrefixConstants;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * Description: 审批状态
 *
 * @author: sui q
 * Time: 2022/9/1 9:06
 * Classname: EApproveStatus
 * PackageName: com.hzs.common.core.enums
 */
@AllArgsConstructor
@Getter
public enum EApproveStatus {

    /**
     * 草稿
     */
    DRAFT(0, "草稿", EnumsPrefixConstants.APPROVE_STATUS + "0"),

    /**
     * 待提交
     */
    WAIT_SUBMIT(1, "待提交", EnumsPrefixConstants.APPROVE_STATUS + "1"),

    /**
     * 已提交 待审核
     */
    ALREADY_SUBMIT(2, "待审核", EnumsPrefixConstants.APPROVE_STATUS + "2"),

    /**
     * 审核中
     */
    APPROVE(3, "审核中", EnumsPrefixConstants.APPROVE_STATUS + "3"),

    /**
     * 已驳回
     */
    REJECTED(4, "已驳回", EnumsPrefixConstants.APPROVE_STATUS + "4"),

    /**
     * 已审核
     */
    FINISH(5, "已审核", EnumsPrefixConstants.APPROVE_STATUS + "5"),

    /**
     * 已作废
     */
    CANCEL(9, "已作废", EnumsPrefixConstants.APPROVE_STATUS + "9"),

    ;

    /**
     * 实际值
     */
    private final int value;
    /**
     * 显示标签
     */
    private final String label;
    /**
     * 国际化翻译key值
     */
    private final String key;


    /**
     * 根据枚举值获取枚举
     *
     * @param value 枚举值
     * @return
     */
    public static EApproveStatus getEnumByValue(int value) {
        for (EApproveStatus eApproveStatus : EApproveStatus.values()) {
            if (eApproveStatus.getValue() == value) {
                return eApproveStatus;
            }
        }
        return null;
    }

}
