package com.haha.common.constant;

/**
 * 订单相关常量
 */
public final class OrderConstants {
    
    private OrderConstants() {}
    
    // ==================== 订单状态 ====================
    
    /**
     * 订单状态：待支付
     */
    public static final int STATUS_PENDING_PAYMENT = 0;

    /**
     * 订单状态：已完成
     */
    public static final int STATUS_COMPLETED = 1;

    /**
     * 订单状态：已取消
     */
    public static final int STATUS_CANCELLED = 2;
    
    /**
     * 订单状态：已关闭
     */
    public static final int STATUS_CLOSED = 3;
    
    // ==================== 支付状态 ====================
    
    /**
     * 支付状态：未支付
     */
    public static final String PAY_STATUS_UNPAID = "UNPAID";
    
    /**
     * 支付状态：已支付
     */
    public static final String PAY_STATUS_PAID = "PAID";

    /**
     * 支付状态：部分退款（累计退款金额 > 0 且 < 实付金额）
     */
    public static final String PAY_STATUS_PARTIAL_REFUND = "PARTIAL_REFUND";

    /**
     * 支付状态：全额退款（累计退款金额 >= 实付金额）
     */
    public static final String PAY_STATUS_REFUND = "REFUND";
    
    // ==================== 订单类型 ====================
    
    /**
     * 订单类型：正常购物
     */
    public static final String ORDER_TYPE_NORMAL = "NORMAL";
    
    /**
     * 订单类型：异物放入（不在用户端展示）
     */
    public static final String ORDER_TYPE_IN = "IN";
    
    // ==================== 状态描述 ====================
    
    /**
     * 获取订单状态描述
     */
    public static String getStatusDesc(int status) {
        return switch (status) {
            case STATUS_CANCELLED -> "已取消";
            case STATUS_PENDING_PAYMENT -> "待支付";
            case STATUS_COMPLETED -> "已完成";
            case STATUS_CLOSED -> "已关闭";
            default -> "未知";
        };
    }
    
    /**
     * 获取支付状态描述
     */
    public static String getPayStatusDesc(String payStatus) {
        if (payStatus == null) {
            return "未知";
        }
        return switch (payStatus) {
            case PAY_STATUS_UNPAID -> "未支付";
            case PAY_STATUS_PAID -> "已支付";
            case PAY_STATUS_PARTIAL_REFUND -> "部分退款";
            case PAY_STATUS_REFUND -> "全额退款";
            default -> "未知";
        };
    }
}
