package cn.estsh.i3plus.pojo.base.enumutil;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @Description : sweb枚举类
 * @Reference :
 * @Author : jack.lv
 * @CreateDate : 2019-04-02 20:21
 * @Modify:
 **/
public class SwebEnumUtil {

    /**
     * 单据主表状态(ASN,PO,MOVE,QC)
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ORDER_MASTER_STATUS {
        CREATE(10, "CREATE", "新建"),
        RECEIPT(20, "RECEIPT", "已发布"),
        SURE(30, "SURE", "已确认"),
        PRINTED(40, "PRINTED", "已打印"),
        DELIVERY(50, "DELIVERY", "已发货");

        private int value;
        private String code;
        private String description;

        ORDER_MASTER_STATUS(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static int descOf(String desc) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].description.equals(desc)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static int codeOf(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 订单明细状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ORDER_DETAILS_STATUS {
        CREATE(10, "CREATE", "新建"),
        RECEIPT(20, "RECEIPT", "已发布"),
        SURE(30, "SURE", "已确认"),
        PRINTED(40, "PRINTED", "已打印"),
        DELIVERY(50, "DELIVERY", "已发货");

        private int value;
        private String code;
        private String description;

        ORDER_DETAILS_STATUS(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static int descOf(String desc) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].description.equals(desc)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static int codeOf(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 包装类型枚举
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum PACKAGE_TYPE {
        BOX(10, "BOX", "BOX（盒）"),
        CARTON(20, "CARTON", "CARTON（箱）"),
        PALLET(30, "PALLET", "PALLET（栈板）"),
        CONTAINER(40, "PALLET", "PALLET（集装箱）");

        private String code;
        private String description;
        int value;

        PACKAGE_TYPE(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }
    }

    /**
     * 订单类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ORDER_TYPE {
        STANDARD(10, "STANDARD", "标准包装"),
        NON_STANDARD(20, "NON_STANDARD", "非标准包装");

        private int value;
        private String code;
        private String description;

        ORDER_TYPE(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static int descOf(String desc) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].description.equals(desc)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 数据状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum DATA_STATUS {
        YES(1, "是", "fa fa-success cell-fa fa-check"),
        NO(2, "否", "fa fa-disabled cell-fa fa-times-circle");

        private int value;
        private String description;
        private String code;

        DATA_STATUS(int value, String code, String description) {
            this.value = value;
            this.description = description;
            this.code = code;
        }

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public String getCode() {
            return code;
        }

        public static String valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].getDescription();
                }
            }
            return tmp;
        }
    }

    /**
     * 用户消息类型
     * 1.NOTICE：通知
     * 2.STATION_LETTER：站内信
     * 3.SWEB_NOTICE：SWEB通知
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum MESSAGE_TYPE {

//        MAIL(1, "邮件", "邮件"),
//        LETTER(2, "站内信", "站内信"),
        SWEB_NOTICE(3, "SWEB通知", "SWEB通知"),
        SWEB_PUBLIC_NOTICE(4, "SWEB公告", "SWEB公告");

        private int value;
        private String name;
        private String description;

        MESSAGE_TYPE() {
        }

        MESSAGE_TYPE(int value, String name, String description) {
            this.value = value;
            this.name = name;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getName() {
            return name;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].name;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].name.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 附件来源
     * 1.NOTICE：通知
     * 2.STATION_LETTER：站内信
     * 3.SWEB_NOTICE：SWEB通知
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum FILE_ATTACH_SOURCE {
        MAIL(1, "邮件", "邮件"),
        LETTER(2, "站内信", "站内信"),
        SWEB_NOTICE(3, "SWEB通知", "SWEB通知"),
        SWEB_PUBLIC_NOTICE(4, "SWEB公告", "SWEB公告");

        private int value;
        private String name;
        private String description;

        FILE_ATTACH_SOURCE() {
        }

        FILE_ATTACH_SOURCE(int value, String name, String description) {
            this.value = value;
            this.name = name;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getName() {
            return name;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].name;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].name.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 前端系统平台
     * IMPP_FE：impp系统
     * SWEB_FE：sweb系统
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum FE_PLATFORM {
        IMPP_FE("IMPP_FE", "IMPP_FE", "impp系统"),
        SWEB_FE("SWEB_FE", "SWEB_FE", "sweb系统");

        private String value;
        private String code;
        private String description;

        FE_PLATFORM() {
        }

        FE_PLATFORM(String value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public String getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 用户消息状态
     * 1.READ：已读
     * 2.UNREAD：未读
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum MESSAGE_STATUS {

        READ(1,"已读","fa cell-fa fa-file-text"),
        UNREAD(2,"未读","fa cell-fa fa-file-o");

        private int value;
        private String code;
        private String description;

        MESSAGE_STATUS() {
        }

        MESSAGE_STATUS(int value, String description, String code) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }
}
