package com.seer.teach.pay.enums;

import lombok.Getter;

/**
 * 商家收益提现状态枚举
 */
@Getter
public enum MerchantRevenueWithdrawStatusEnum {

    /**
     * 未提现
     */
    NOT_WITHDRAWN(0, "未提现"),

    /**
     * 部分提现
     */
    PARTIALLY_WITHDRAWN(1, "部分提现"),

    /**
     * 已提现
     */
    FULLY_WITHDRAWN(2, "已提现");

    private final Integer code;
    private final String description;

    MerchantRevenueWithdrawStatusEnum(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    /**
     * 根据code获取枚举
     *
     * @param code 状态码
     * @return 对应的枚举值
     */
    public static MerchantRevenueWithdrawStatusEnum fromCode(Integer code) {
        for (MerchantRevenueWithdrawStatusEnum status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        return null;
    }
}