package com.czg.account.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;
import java.util.List;

/**
 * 积分兑换订单支付类型枚举
 *
 * @author tankaikai
 * @since 2025-02-26 10:29
 */
@Getter
@RequiredArgsConstructor
public enum PointsOrderPayTypeEnum {
    /**
     * 积分
     */
    POINTS("POINTS", "积分支付"),

    /**
     * 积分+微信
     */
    WECHAT("WECHAT", "积分+微信"),
    /**
     * 积分+支付宝
     */
    ALIPAY("ALIPAY", "积分+支付宝"),

    ;

    private final String value;
    private final String text;


    public static List<String> getValues() {
        return Arrays.stream(values()).map(PointsOrderPayTypeEnum::getValue).toList();
    }

    public static String getText(String value) {
        PointsOrderPayTypeEnum item = Arrays.stream(values()).filter(obj -> value.equals(obj.getValue())).findFirst().orElse(null);
        if (item != null) {
            return item.getText();
        }
        return null;
    }

}
