package com.fs.store.enums;

import lombok.Getter;

/**
 * 定时发放优惠券处理枚举类
 */
@Getter
public enum IcgProcessStatusEnum {
    PENDING(0, "待处理"),
    PROCESSING(1, "正在处理"),
    SUCCESS(2, "成功"),
    FAILED(-1, "失败"),
    REJECTED_OR_RETURNED(3, "用户拒签或者退货"),
    FINISHED(4, "已完成");

    private final Integer code;
    private final String description;

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

    public static IcgProcessStatusEnum fromCode(Integer code) {
        for (IcgProcessStatusEnum status : IcgProcessStatusEnum.values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }
}
