package com.zm.order.tool.server.enums;

import java.util.Objects;

/**
 * 评论枚举
 * @author nianchang
 * @ClassName CommentTypeEnum
 * @date 2021/05/13 5:19 下午
 */
public enum CommentTypeEnum {

    /**
     * 好评
     */
    GOOD_COMMENT(0, "好评"),

    /**
     * 中评
     */
    MIDDLE_COMMENT(1, "中评"),

    /**
     * 差评
     */
    BAD_COMMENT(2, "差评"),
    ;

    private final Integer type;

    private final String desc;

    CommentTypeEnum(final Integer type, final String desc) {
        this.type = type;
        this.desc = desc;
    }

    public Integer getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    public static CommentTypeEnum getValue(Integer commentType) {
        for (CommentTypeEnum commentTypeEnum : values()) {
            if (Objects.equals(commentTypeEnum.getType(), commentType)) {
                return commentTypeEnum;
            }
        }
        return null;
    }
}
