package com.tzld.piaoquan.api.common.enums.contentplatform;

import lombok.Getter;

@Getter
public enum QwPlanTypeEnum {
    GROUP(0, "社群"),
    REPLY(1, "自动回复"),

    other(999, "其他");

    private final int val;
    private final String description;

    QwPlanTypeEnum(int val, String description) {
        this.val = val;
        this.description = description;
    }

    public static QwPlanTypeEnum from(int val) {
        for (QwPlanTypeEnum typeEnum : QwPlanTypeEnum.values()) {
            if (typeEnum.getVal() == val) {
                return typeEnum;
            }
        }
        return other;
    }

    public static QwPlanTypeEnum from(String description) {
        for (QwPlanTypeEnum typeEnum : QwPlanTypeEnum.values()) {
            if (typeEnum.getDescription().equals(description)) {
                return typeEnum;
            }
        }
        return other;
    }


}
