package com.hzs.common.core.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Description: 需要审批业务类型大类
 * @Author: sui q
 * @Time: 2022/10/21 15:09
 * @Classname: EApprovalType
 * @PackageName: com.hzs.common.core.enums
 */
@AllArgsConstructor
@Getter
public enum EApprovalType {

    /**
     * 自定义签呈分类
     */
    CUSTOM_BUSINESS(0, "自定义大类"),

    /**
     * 会员（等级、奖衔、账户等）
     */
    MEMBER_BUSINESS(1, "会员大类"),

    /**
     * 订单（退单、撤单等）
     */
    ORDER_BUSINESS(2, "订单大类"),

    /**
     * 财务（充值、提现等）
     */
    FINANCE_BUSINESS(3, "财务大类"),

    /**
     * 商品（新增、修改等）
     */
    PRODUCT_BUSINESS(4, "商品大类"),

    /**
     * 公告站内信
     */
    NOTICE_BUSINESS(5, "公告站内信"),

    /**
     * 活动相关处理
     */
    ACTIVITY_BUSINESS(7, "活动相关处理"),

    ;

    /**
     * 实际值
     */
    private final int value;
    /**
     * 显示标签
     */
    private final String label;

    /**
     * 根据审批业务类型获取审批业务大类
     *
     * @param approvalBusinessValue 审批业务类型
     * @return
     */
    public static EApprovalType getEnumByApprovalBusinessValue(int approvalBusinessValue) {
        int value = approvalBusinessValue / 100;
        for (EApprovalType eApprovalType : EApprovalType.values()) {
            if (eApprovalType.getValue() == value) {
                return eApprovalType;
            }
        }
        return MEMBER_BUSINESS;
    }

}
