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

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

import java.util.Arrays;

/**
 * 发票来源
 *
 * @author le'yang
 */
@RequiredArgsConstructor
@Getter
public enum InvoiceSourceEnum implements IntArrayValuable {
    FIT(1, "散客"),
    OTC(2, "团队");




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

    /**
     * 类型值
     */
    private final Integer type;
    /**
     * 名称
     */
    private final String name;

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

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

}
