package com.cf.imes.framework.common.enums;


import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author 未排单过滤字段枚举类
 */

@AllArgsConstructor
@Getter
public enum GoodsFilterConditionsEnum {

    THICKNESS( "厚度","thickness"),
    MATERIAL( "材质","material"),
    TEXTURE( "纹理","texture"),
    BRAND( "品牌","brand"),
    WIDTH("宽度","width"),
    HEIGHT( "长度","height"),
    COLOR("颜色","color");

    private final String name;
    private final String filterField;


    public String getKey() {
        return filterField;
    }


    public String getValue() {
        return name;
    }


    public boolean equals(String status) {
        return this.name.equals(status) ;
    }

    public boolean equals(GoodsFilterConditionsEnum enableStatusEnum) {
        return enableStatusEnum != null && enableStatusEnum.name .equals(this.getName()) ;
    }


    // 根据 key 获取对应的 value
    public static String getValueByKey(String filterField) {
        for (GoodsFilterConditionsEnum enumValue : GoodsFilterConditionsEnum.values()) {
            if (enumValue.getKey().equals(filterField)) {
                return enumValue.getValue();
            }
        }
        return null;  // 如果没有找到对应的 key，可以返回 null 或者抛出异常
    }


}
