package shop.alien.util.common.constant;

// 举报类型枚举
public enum ViolationEnum {
    VIOLATION1(1, "用户违规"),
    VIOLATION2(2, "色情低俗"),
    VIOLATION3(3, "违法违规"),
    VIOLATION4(4, "谩骂嘲讽、煽动对立"),
    VIOLATION5(5, "涉嫌诈骗"),
    VIOLATION6(6, "人身攻击"),
    VIOLATION7(7, "种族歧视"),
    VIOLATION8(8, "政治敏感"),
    VIOLATION9(9, "虚假、不实内容"),
    VIOLATION10(10, "违反公德秩序"),
    VIOLATION11(11, "危害人身安全"),
    VIOLATION12(12, "网络暴力"),
    VIOLATION13(13, "其他原因");

    private final int code;
    private final String value;

    ViolationEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }

    public int getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    // 通过code获取枚举实例
    public static ViolationEnum getByCode(int code) {
        for (ViolationEnum status : ViolationEnum.values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        return null;
    }

    // 通过code获取value
    public static String getValueByCode(int code) {
        ViolationEnum status = getByCode(code);
        return status != null ? status.getValue() : null;
    }
}


