package com.jwipc.order.constant;

import lombok.Getter;

/**
 * <p> </p>
 *
 * @author ZhangJie
 * @version 1.0
 * @since JDK 1.8
 */
@Getter
public enum LabelBoxType {
    OUT(1, "外", "B"),
    MIDDLE(2, "中", "M"),
    INNER(3, "内", "P"),
    OUT1(1, "外", "Y");//这个是供应商的兼容问题，有的供应商直接传Y也表示是外箱
    private final int type;
    private final String code;
    private final String title;

    LabelBoxType(int type, String title, String code) {
        this.type = type;
        this.title = title;
        this.code = code;
    }

    public static LabelBoxType getByType(int type) {
        for (LabelBoxType labelBoxType : values()) {
            if (labelBoxType.getType() == type) {
                return labelBoxType;
            }
        }
        return null;
    }

    public static LabelBoxType getByCode(String code) {
        for (LabelBoxType labelBoxType : values()) {
            if (labelBoxType.getCode().equals(code)) {
                return labelBoxType;
            }
        }
        return null;
    }
}
