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

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

import com.ruoyi.bst.order.service.impl.OrderPayHandlerImpl;
import com.ruoyi.bst.order.service.impl.OrderRidePayHandlerImpl;
import com.ruoyi.bst.pay.interfaces.PayHandler;
import com.ruoyi.bst.vipOrder.service.impl.VipOrderPayHandlerImpl;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author wjh
 * 2025/3/26
 */
@Getter
@AllArgsConstructor
public enum PayBstType {
    ORDER("1", "订单押金", OrderPayHandlerImpl.class),
    ORDER_RIDE("2", "订单骑行费", OrderRidePayHandlerImpl.class),
    VIP_ORDER("3", "卡券订单",  VipOrderPayHandlerImpl.class);

    private final String type;
    private final String msg;
    private final Class<? extends PayHandler> payHandler;   // 支付回调处理器

    public static PayBstType parse(String type) {
        for (PayBstType value : PayBstType.values()) {
            if (value.getType().equals(type)) {
                return value;
            }
        }
        return null;
    }

    public static List<String> asList(PayBstType ...types) {
        return Arrays.stream(types).map(PayBstType::getType).collect(Collectors.toList());
    }
}
