package cn.sikey.hmd.enums;

import cn.hutool.core.util.ArrayUtil;
import cn.sikey.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 支付渠道
 */
@AllArgsConstructor
@Getter
public enum PayChannelEnum implements IntArrayValuable {

    ALI_PAY(1, "支付宝"),
    WE_CHAT(2, "微信"),
    RAZOR_PAY(3,"razorPay")
    ;

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(PayChannelEnum::getValue).toArray();

    /**
     * value
     */
    private final Integer value;
    /**
     * name
     */
    private final String name;

    public static PayChannelEnum valueOf(Integer value) {
        return ArrayUtil.firstMatch(payChannel -> payChannel.getValue().equals(value), PayChannelEnum.values());
    }

    @Override
    public int[] array() {
        return ARRAYS;
    }
}
