package com.seer.teach.pay.enums;

import lombok.Getter;

/**
 * 商家收益使用记录状态枚举
 */
@Getter
public enum MerchantRevenueUsageStatusEnum {

    /**
     * 成功
     */
    SUCCESS("SUCCESS", "成功"),

    /**
     * 取消
     */
    CANCELLED("CANCELLED", "取消");

    private final String code;
    private final String description;

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

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