package com.seer.teach.common.enums.pay;

import lombok.Getter;

/**
 * 支付通知任务状态枚举
 */
@Getter
public enum PayNotifyTaskStatusEnum {

    /**
     * 处理中
     */
    PROCESSING(1, "处理中"),

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

    /**
     * 失败
     */
    FAILED(3, "失败");

    private final Integer code;
    private final String description;

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

    /**
     * 根据code获取枚举
     */
    public static PayNotifyTaskStatusEnum fromCode(Integer code) {
        for (PayNotifyTaskStatusEnum status : PayNotifyTaskStatusEnum.values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }
}