package com.cf.imes.module.system.enums.recharge;

import com.cf.imes.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * 充值类型枚举
 *
 * @author 晨丰科技
 */
@Getter
@AllArgsConstructor
public enum RechargeTypeEnum implements IntArrayValuable {

    WECHAT_AND_ALIPAY(0, "微信、支付宝"),
    WECHAT(1, "微信"),
    ALIPAY(2, "支付宝");

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

    /**
     * 状态值
     */
    private final Integer status;
    /**
     * 状态名
     */
    private final String name;

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

    public static boolean isWechatAndAlipay(String name) {
        return Objects.equals(WECHAT_AND_ALIPAY.name, name);
    }

    public static boolean isWechat(String name) {
        return Objects.equals(WECHAT.name, name);
    }

    public static boolean isAlipay(String name) {
        return Objects.equals(ALIPAY.name, name);
    }

    public static boolean isWechatAndAlipay(Integer status) {
        return Objects.equals(WECHAT_AND_ALIPAY.status, status);
    }

    public static boolean isWechat(Integer status) {
        return Objects.equals(WECHAT.status, status);
    }

    public static boolean isAlipay(Integer status) {
        return Objects.equals(ALIPAY.status, status);
    }
}
