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 InvoiceTitleTypeEnum implements IntArrayValuable {
    PERSONAL(0, "个人"),
    ENTERPRISE_UNIT(1, "企业单位");




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

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

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

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

}
