package cn.reghao.tnb.search.esapp.blog.model.vo;

import cn.reghao.jutil.jdk.converter.DateTimeConverter;
import cn.reghao.tnb.search.esapp.blog.model.po.Article;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.List;

/**
 * @author reghao
 * @date 2023-04-13 17:17:37
 */
@Setter
@Getter
public class ArticleVO implements Serializable {
    private static final long serialVersionUID = 1L;

    private int id;
    private String articleId;
    private String title;
    private String category;
    private List<String> tags;
    private String publishAt;
    private long views;
    private String editor;
    private String content;
    private ArticleLink prev;
    private ArticleLink next;

    public ArticleVO(Article article, int viewCount, String category, List<String> tags) {
        this.id = article.getId();
        this.articleId = article.getArticleId();
        this.title = article.getTitle();
        this.category = category;
        this.tags = tags;
        this.publishAt = DateTimeConverter.format(article.getPublishAt());
        this.views = viewCount;
        this.editor = article.getEditor();
        this.content = article.getContent();
    }
}
