package com.zfire.mall.manager.enums;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum TradeLoginOrderTypeEnum {
    WORK("WORK","工装"),
    HOME("HOME","家装"),;

    @JsonValue
    @EnumValue
    private final String key;
    private final String value;

    public static String findKeyByValue(String value) {
        TradeLoginOrderTypeEnum[] enums = TradeLoginOrderTypeEnum.values();
        for (TradeLoginOrderTypeEnum anEnum : enums) {
            boolean b = anEnum.getValue().equals(StrUtil.trim(value));
            if (b)
                return anEnum.getKey();
        }
        return null;
    }
}
