package com.ruoyi.enums.message;

import io.swagger.annotations.ApiModelProperty;

import java.util.Arrays;

/**
 * 互动消息枚举
 * @Author liwenlong
 */
public enum InteractionMessageEnums {

    @ApiModelProperty(value = "点赞帖子",example = "LIKE_POST")
    LIKE_POST(1, "赞了你的动态","赞了你的动态"),

    @ApiModelProperty(value = "点赞作品",example = "LIKE_WORKS")
    LIKE_WORKS(2, "赞了你的作品","赞了你的作品"),

    @ApiModelProperty(value = "点赞帖子评论",example = "LIKE_COMMENT")
    LIKE_POST_COMMENT(3, "赞了你的评论","赞了你的评论"),

    @ApiModelProperty(value = "评论帖子",example = "COMMENT_POST")
    COMMENT_POST(4, "评论了你的动态","评论了你的动态"),

    @ApiModelProperty(value = "评论作品",example = "COMMENT_WORKS")
    COMMENT_WORKS(5, "评论了你的作品","评论了你的作品"),

    @ApiModelProperty(value = "关注用户",example = "FOLLOW")
    FOLLOW(6, "关注了你","关注了你"),

    @ApiModelProperty(value = "回复帖子评论",example = "REPLY_POST_COMMENT")
    REPLY_POST_COMMENT(7, "回复了你的评论","回复了你的评论"),

    @ApiModelProperty(value = "回复作品",example = "REPLY_WORKS_COMMENT")
    REPLY_WORKS_COMMENT(8, "回复了你的评论","回复了你的评论"),

    @ApiModelProperty(value = "评论新闻",example = "COMMENT_NEWS")
    COMMENT_NEWS(9, "评论了你的新闻","评论了你的新闻"),

    @ApiModelProperty(value = "回复新闻",example = "REPLY_NEWS_COMMENT")
    REPLY_NEWS_COMMENT(10, "回复了你的评论","回复了你的评论"),


    @ApiModelProperty(value = "点赞作品评论",example = "LIKE_COMMENT")
    LIKE_WORKS_COMMENT(11, "赞了你的评论","赞了你的评论"),

    @ApiModelProperty(value = "点赞投票评论",example = "VOTE_COMMENT")
    LIKE_VOTE_COMMENT(12, "赞了你的评论","赞了你的评论"),
    ;

    private final Integer code;

    private final String title;
    private final String content;

    public static String getTitle(Integer code) {
        return getInteractionMessageEnums(code).title;
    }

    public static String getContent(Integer code) {
        return getInteractionMessageEnums(code).content;
    }

    public static InteractionMessageEnums getInteractionMessageEnums(Integer code) {
        return Arrays.stream(InteractionMessageEnums.values()).filter(c->c.getCode().equals(code)).findFirst().get();
    }

    InteractionMessageEnums(Integer code, String title, String content) {
        this.code = code;
        this.title = title;
        this.content = content;
    }

    public Integer getCode() {
        return code;
    }

    public String getTitle() {
        return title;
    }


    public String getContent() {
        return content;
    }


}
