package com.yonge.cooleshow.bbs.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yonge.cooleshow.bbs.enums.ArticleEnum;
import com.yonge.cooleshow.bbs.enums.YesOrNoEnum;
import com.yonge.cooleshow.bbs.valid.AddGroup;
import com.yonge.cooleshow.bbs.valid.OtherGroup;
import com.yonge.cooleshow.bbs.valid.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 文章
 */
@TableName("bbs_article")
@ApiModel(value = "BbsArticle对象", description = "文章")
public class BbsArticle implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(value = "id_", type = IdType.AUTO)
    @NotNull(groups = {UpdateGroup.class,OtherGroup.class}, message = "文章id不能为空")
    private Long id;

    @ApiModelProperty("发布者id")
    @TableField(value = "user_id_")
    private Long userId;

    @ApiModelProperty("文章标题")
    @TableField(value = "title_")
    @NotBlank(groups = {AddGroup.class}, message = "标题不能为空")
    private String title;

    @ApiModelProperty("文章内容")
    @TableField(value = "content_")
    @NotBlank(groups = {AddGroup.class}, message = "内容不能为空")
    private String content;

    @ApiModelProperty("标签id")
    @TableField(value = "label_id_")
    @NotNull(groups = {AddGroup.class}, message = "标签id不能为空")
    private Integer labelId;

    @ApiModelProperty("标签名称(冗余字段)")
    @TableField(value = "label_name_")
    private String labelName;

    @ApiModelProperty("阅读量")
    @TableField(value = "views_count_")
    private Long viewsCount;

    @ApiModelProperty("点赞量")
    @TableField(value = "likes_count_")
    private Long likesCount;

    @ApiModelProperty("评论量")
    @TableField(value = "comments_count_")
    private Long commentsCount;

    @ApiModelProperty("收藏量")
    @TableField(value = "collects_count_")
    private Long collectsCount;

    @ApiModelProperty("草稿:DRAFT，审核中:DOING，通过:PASS，驳回:REJECT")
    @TableField(value = "status_")
    private ArticleEnum status;

    @ApiModelProperty("是否置顶 0:未置顶 1:置顶")
    @TableField(value = "top_flag_")
    private YesOrNoEnum topFlag;

    @ApiModelProperty("是否可评论 0:不可评论 1:可评论")
    @TableField(value = "reply_flag_")
    private YesOrNoEnum replyFlag;

    @ApiModelProperty("审核通过时间")
    @TableField(value = "examine_time_")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date examineTime;

    @TableField(value = "created_time_")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createdTime;

    @TableField(value = "updated_time_")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updatedTime;

    @ApiModelProperty("0:正常 1:删除")
    @TableField(value = "del_flag_")
    private Boolean delFlag;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Integer getLabelId() {
        return labelId;
    }

    public void setLabelId(Integer labelId) {
        this.labelId = labelId;
    }

    public String getLabelName() {
        return labelName;
    }

    public void setLabelName(String labelName) {
        this.labelName = labelName;
    }

    public Long getViewsCount() {
        return viewsCount;
    }

    public void setViewsCount(Long viewsCount) {
        this.viewsCount = viewsCount;
    }

    public Long getLikesCount() {
        return likesCount;
    }

    public void setLikesCount(Long likesCount) {
        this.likesCount = likesCount;
    }

    public Long getCommentsCount() {
        return commentsCount;
    }

    public void setCommentsCount(Long commentsCount) {
        this.commentsCount = commentsCount;
    }

    public Long getCollectsCount() {
        return collectsCount;
    }

    public void setCollectsCount(Long collectsCount) {
        this.collectsCount = collectsCount;
    }

    public ArticleEnum getStatus() {
        return status;
    }

    public void setStatus(ArticleEnum status) {
        this.status = status;
    }

    public YesOrNoEnum getTopFlag() {
        return topFlag;
    }

    public void setTopFlag(YesOrNoEnum topFlag) {
        this.topFlag = topFlag;
    }

    public YesOrNoEnum getReplyFlag() {
        return replyFlag;
    }

    public void setReplyFlag(YesOrNoEnum replyFlag) {
        this.replyFlag = replyFlag;
    }

    public Date getExamineTime() {
        return examineTime;
    }

    public void setExamineTime(Date examineTime) {
        this.examineTime = examineTime;
    }

    public Date getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
    }

    public Date getUpdatedTime() {
        return updatedTime;
    }

    public void setUpdatedTime(Date updatedTime) {
        this.updatedTime = updatedTime;
    }

    public Boolean getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(Boolean delFlag) {
        this.delFlag = delFlag;
    }
}