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

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

import java.util.Arrays;


@RequiredArgsConstructor
@Getter
public enum StoreCreditTypeEnum implements IntArrayValuable {

    FORBIDDEN(0,  "禁用"),
    SHARE(1,  "共享"),
    FIXED(2,  "指定");

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

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


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

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