package com.storlead.sales.util.sku.constants;

public class SsdProductConstants {
    /**
     * 最大置顶数量
     */
    public static final int TOP_MAX_COUNT = 3;

    /** 置顶 */
    public static final int IS_RECOMMEND = 1 ;

    /** 不置顶 */
    public static final int NOT_RECOMMEND = 0 ;

    /**
     * ssd 产品类型 code
     */
    public static final String ARTICLE_TYPE_CHECK_CODE = "code";

    /**
     * ssd 产品类型  name
     */
    public static final String ARTICLE_TYPE_CHECK_NAME = "name";

    /**
     * 固态产品接口类型
     */
    public static final String SSD_PRODUCT_CONNECTOR_TYPE = "SSD_PRODUCT_CONNECTOR_TYPE";
    /**
     * 固态产品尺寸
     */
    public static final String SSD_PRODUCT_SIZE = "SSD_PRODUCT_SIZE";
    /**
     * 固态产品接口协议
     */
    public static final String SSD_PRODUCT_CONNECTOR_PROTOCOL = "SSD_PRODUCT_CONNECTOR_PROTOCOL";
    /**
     * 固态产品主控类型
     */
    public static final String SSD_PRODUCT_CORE_CHIP_TYPE = "SSD_PRODUCT_CORE_CHIP_TYPE";
    /**
     * 固态产品级别
     */
    public static final String SSD_PRODUCT_LEVEL = "SSD_PRODUCT_LEVEL";
    /**
     * 固态产品闪存类型
     */
    public static final String SSD_PRODUCT_FLASH_CHIP_TYPE = "SSD_PRODUCT_FLASH_CHIP_TYPE";
    /**
     * 固态产品容量
     */
    public static final String SSD_PRODUCT_CAPACITY = "SSD_PRODUCT_CAPACITY";

    /**
     * 产品状态(1:预上架 2:已上架 3:已下架 4:已删除 默认1)
     */

    public enum StatusEnum {
        /**
         * 预上架
         */
        STATUS_1(1, "预上架"),
        /**
         * 已上架
         */
        STATUS_2(2, "已上架"),
        /**
         * 已下架
         */
        STATUS_3(3, "已下架"),
        /**
         * 已删除
         */
        STATUS_4(4, "已删除");

        private int code;
        private String codeName;

        StatusEnum(int code, String codeName) {
            this.code = code;
            this.codeName = codeName;
        }

        public int getCode() {
            return code;
        }

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

        public String getCodeName() {
            return codeName;
        }

        public void setCodeName(String codeName) {
            this.codeName = codeName;
        }

        public static StatusEnum getStatusEnum(int status){
            for (StatusEnum statusEnum : StatusEnum.values()){
                if (statusEnum.getCode() == status){
                    return statusEnum;
                }
            }
            return null;
        }
    }

    /**
     * 判断某个值是否在指定的枚举范围内
     *
     * @param code 状态
     * @return boolean
     * @author YPZ
     * @since 2024-08-13 上午 10:19
     */
    public static boolean contains(int code) {
        for (StatusEnum statusEnum : StatusEnum.values()) {
            if (statusEnum.code == code) {
                return true;
            }
        }
        return false;
    }
}
