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 TradeOrderConfirmTypeEnum implements IntArrayValuable {
    NO_NEED(0, "不需确认"),
    NEED(1, "未确认"),
    CONFIRMED(2, "已确认"),
    CANCEL(3, "取消"),
    ;



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

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

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

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