package com.ruoyi.bst.order.domain.enums;

import java.util.List;

import com.ruoyi.common.utils.collection.CollectionUtils;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum OrderStatus {
    
    WAIT_PAY("WAIT_PAY", "待支付"),
    PROCESSING("PROCESSING", "进行中"), 
    FINISHED("FINISHED", "已结束"),
    CANCELED("CANCELED", "已取消"),
    WAIT_VERIFY("WAIT_VERIFY", "待审核"),
    REJECTED("REJECTED", "已驳回"),
    REFUNDED("REFUNDED", "已退款");
    
    private final String code;
    private final String name;


    // 允许支付的订单状态
    public static List<String> canPay() {
        return CollectionUtils.map(OrderStatus::getCode, WAIT_PAY);
    }

    // 正在使用中的订单状态
    public static List<String> inUse() {
        return CollectionUtils.map(OrderStatus::getCode, PROCESSING);
    }

    // 可以支付成功的订单状态
    public static List<String> canPaySuccess() {
        return CollectionUtils.map(OrderStatus::getCode, WAIT_PAY);
    }

    // 可以结束的订单状态
    public static List<String> canEnd() {
        return CollectionUtils.map(OrderStatus::getCode, PROCESSING);
    }

    // 可以退款的订单状态
    public static List<String> canRefund() {
        return CollectionUtils.map(OrderStatus::getCode, FINISHED, REFUNDED);
    }

    // 未支付的订单状态
    public static List<String> unPayList() {
        return CollectionUtils.map(OrderStatus::getCode, WAIT_PAY);
    }

    // 可以取消支付的订单状态
    public static List<String> canCancelPay() {
        return CollectionUtils.map(OrderStatus::getCode, WAIT_PAY);
    }
    
    // 可以审核的订单状态
    public static List<String> canVerify() {
        return CollectionUtils.map(OrderStatus::getCode, WAIT_VERIFY);
    }

    // 有效的订单状态：已支付的订单
    public static List<String> valid() {
        return CollectionUtils.map(OrderStatus::getCode, PROCESSING, FINISHED, WAIT_VERIFY, REJECTED, REFUNDED);
    }
}
