package cn.iocoder.yudao.module.order.enums;

import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.common.util.json.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@AllArgsConstructor
@Getter
public enum TransportTypeShortEnum implements IntArrayValuable {

    SEA_CONTAINER(1, "海运拼柜", "G"),
    MARINE_CONTAINER(2, "海运整柜", "F"),
    AIR_FREIGHT_LINE(3, "专线空运", "A"),
    AIR_SEA_COMBINED_TRANSPORT(4, "海空联运", "SA"),

    ;

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

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

    /**
     * 类型名
     */
    private final String shortName;

    public static TransportTypeShortEnum valueOf(Integer value) {
        return ArrayUtil.firstMatch(transportType -> transportType.getValue().equals(value), TransportTypeShortEnum.values());
    }

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