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

import java.util.List;

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

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author wjh
 * 2024/7/24
 */
@Getter
@AllArgsConstructor
public enum PayStatus {

    WAIT_PAY("WAIT_PAY", "待支付"),
    PAYING("PAYING", "支付中"),
    PAYED("PAYED", "已支付"),
    CANCELED("CANCELED", "已取消"),
    REFUNDED("REFUNDED", "转入退款")
    ;

    private final String status;
    private final String msg;

    public static List<String> asList(PayStatus...statuses) {
        return CollectionUtils.map(PayStatus::getStatus, statuses);
    }

    // 允许关闭的订单状态
    public static List<String> canClose() {
        return asList(WAIT_PAY, PAYING);
    }

    // 已经支付过的状态
    public static List<String> payedList() {
        return asList(PAYED, REFUNDED);
    }

    // 未支付的状态
    public static List<String> unPayList() {
        return asList(WAIT_PAY, PAYING);
    }

    // 允许退款的状态
    public static List<String> canRefund() {
        return payedList();
    }
}
