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

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

/**
 * 行业类型枚举
 */
@Getter
public enum IndustryTypeEnum {

    AUTO_REPLY(0, "自动回复", true),
    FWH_PUSH(1, "服务号推送", true),
    QW_GROUP(2, "企微-社群", false),
    QW_AUTO_REPLY(3, "企微-自动回复", false),
    GZH_PUSH(4, "公众号推送", true),
    XCX(5, "小程序投流", false),

    OTHER(999, "", false);

    private final int val;
    private final String description;
    /** 是否为公众号入口(type ∈ {0,1,4}) */
    private final boolean gzh;

    IndustryTypeEnum(int val, String description, boolean gzh) {
        this.val = val;
        this.description = description;
        this.gzh = gzh;
    }

    @JsonValue
    public int getVal() {
        return val;
    }

    @JsonCreator
    public static IndustryTypeEnum from(int val) {
        for (IndustryTypeEnum t : values()) {
            if (t.val == val) return t;
        }
        return OTHER;
    }
}
