package com.ruoyi.ss.payBill.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

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

    WAIT_PAY("1", "待支付"),
    PAYING("2", "支付中"),
    PAY_SUCCESS("3", "支付成功"),
    CANCEL("4", "已取消"),
    REFUNDING("5", "退款中"),
    REFUNDED("6", "已退款")
    ;

    private final String status;
    private final String msg;

    public static List<String> asList(PayBillStatus ...statuses) {
        return Arrays.stream(statuses).map(PayBillStatus::getStatus).collect(Collectors.toList());
    }

    public static List<String> getCanCancelList() {
        return asList(WAIT_PAY, PAYING);
    }

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