package com.ruoyi.common.enums;

/**
 * 订单状态枚举
 * 
 * @author ruoyi
 * @date 2025-01-27
 */
public enum OrderStatus {
    
    CREATED(1L, "已创建"),
    PAID(2L, "已支付"),
    COMPLETED(3L, "已完成"),
    REFUNDED(4L, "已退款"),
    CANCELLED(5L, "已取消");
    
    private final Long code;
    private final String description;
    
    OrderStatus(Long code, String description) {
        this.code = code;
        this.description = description;
    }
    
    public Long getCode() {
        return code;
    }
    
    public String getDescription() {
        return description;
    }
    
    public static OrderStatus getByCode(Long code) {
        for (OrderStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }
} 