package com.sckw.excel.common;

/**
 * @description:    文件类型
 * @author: LengFaQiang
 * @copyright
 * @create: 2022-01-27 16:02
 */
public class FileType {

    public enum type {
        /**
         * 商品主档信息导入模板
         */
        REGISTERED(1, "商品主档信息导入模板.xlsx"),
        /**
         * 备案结果导入模板
         */
        LOGIN(2, "备案结果导入模板.xlsx"),
        /**
         * 商品分类导入模板
         */
        BIND(3, "商品分类导入模板.xlsx"),
        /**
         * 商品品牌导入模板
         */
        UPDATE(4, "商品品牌导入模板.xlsx"),
        /**
         * 入库单导入模板
         */
        SET(5, "入库单导入模板.xlsx"),
        /**
         * 调拨单导入模板
         */
        SET_PASSWORD(6, "调拨单导入模板.xlsx"),
        /**
         * 出库单导入模板
         */
        BANK(7, "出库单导入模板.xlsx");
        private Integer code;
        private String value;

        type(Integer code, String value) {
            this.code = code;
            this.value = value;
        }

        public int getCode() {
            return code;
        }

        public String getValue() {
            return value;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public void setValue(String value) {
            this.value = value;
        }
    }

    public static String getValue(Integer code) {
        for (type ele : type.values()) {
            if (ele.getCode() == code) {
                return ele.getValue();
            }
        }
        return null;
    }

    public static int getCode(Integer code) {
        for (type ele : type.values()) {
            if (ele.getCode() == code) {
                return ele.getCode();
            }
        }
        return 0;
    }
}
