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

import com.ruoyi.common.utils.collection.CollectionUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.List;

@Getter
@AllArgsConstructor
public enum OrderStatus {
    
    WAIT_PAY("WAIT_PAY", "待支付"),
    FINISHED("FINISHED", "已结束"),
    CANCELED("CANCELED", "已取消"),
    REFUNDED("REFUNDED", "已退款");
    
    private final String code;
    private final String name;


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

    // 未支付的订单状态
    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> canRefund() {
        return CollectionUtils.map(OrderStatus::getCode, FINISHED, REFUNDED);
    }

    // 已支付的订单状态
    public static List<String> payed() {
        return CollectionUtils.map(OrderStatus::getCode, FINISHED, REFUNDED);
    }

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


}
