package com.yc.ship.module.trade.enums;


import com.yc.ship.framework.common.core.IntArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;

/**
 * 支付方式
 *
 */
@RequiredArgsConstructor
@Getter
public enum PayTypeEnum implements IntArrayValuable {

    CASH(0, "现金",""),
    WEIXIN_PAY(1, "微信支付",""),
    ALI_PAY(2, "支付宝支付",""),
    UNION_PAY(3, "云闪付",""),
    BANK_CARD(4, "银行卡",""),
    ADVANCE_PAYMENT(5, "预付款","advancePayTypeService"),
    CREDIT_GRANTING(6, "授信支付","creditPayTypeService"),
    // 已废弃 主要用于购买定向库存，和回收定向库存
    STOCK_DIRECT_FUND(7, "定向库存资金池","stockDirectFundPayTypeService"),
    //用于支付包含定向库存的产品
    STOCK_DIRECT_PAY(8, "定向金","stockDirectPayTypeService"),
    //账单还款-用于标记，无实际操作
    CORPORATE_TRANSFER_PAY(9, "对公转账",""),
    //账单还款-用于标记，无实际操作
    TONG_LIAN_SCAN_PAY(10, "通联扫码",""),
    OTHER(99, "其他","");


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

    /**
     * 状态值
     */
    private final Integer type;
    /**
     * 状态名
     */
    private final String name;
    /**
     * 服务名称
     */
    private final String serviceName;

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

    public static PayTypeEnum valueOf(Integer type){
        return Arrays.stream(PayTypeEnum.values()).filter(item->item.type.equals(type)).findFirst().get();
    }
}
