package com.ruoyi.generator.domain.Community;

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.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @TableName community_article
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("community_article")
public class CommunityArticle implements Serializable {

    /**
     * 文章id
     */
    @NotNull(message = "[文章id]不能为空")
    @ApiModelProperty("文章id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 创建人id
     */
    @NotNull(message = "[创建人id]不能为空")
    @ApiModelProperty("创建人id")
    private Long userId;
    /**
     * 文章标题
     */
    @NotBlank(message = "[文章标题]不能为空")
    @Size(max = 255, message = "编码长度不能超过255")
    @Length(max = 255, message = "编码长度不能超过255")
    @ApiModelProperty("文章标题")
    private String title;

    /**
     * 分类id
     */
    @ApiModelProperty("分类id")
    @TableField(exist = false)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long classId;

    /**
     * 圈子id
     */
    @ApiModelProperty("圈子id")
    @TableField(exist = false)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long circleId;

    /**
     * 文章内容
     */
    @ApiModelProperty("文章内容")
    private String content;

    /**
     * 板块圈子
     */
    @ApiModelProperty("板块圈子")
    @TableField(exist = false)
    private List<String> circleIds;

    /**
     * 文章标签
     */
    @ApiModelProperty("文章标签")
    @TableField(exist = false)
    @JsonSerialize(using = ToStringSerializer.class)
    private List<String> tags;

    /**
     * 合集
     */
    @ApiModelProperty("合集")
    @TableField(exist = false)
    private List<String> collectionIds;

    /**
     * 图片地址
     */
    @ApiModelProperty("图片地址")
    @TableField(exist = false)
    private List<String> images;

    /**
     * 是否允许评价
     */
    @ApiModelProperty("是否允许评价")
    private boolean isComment;

    /**
     * 浏览量
     */
    @ApiModelProperty("浏览量")
    private long pageViews;

    /**
     * 是否已删除
     */
    @ApiModelProperty("是否已删除")
    private Boolean isDelete;

    /**
     * 用户id集合
     */
    @ApiModelProperty("用户id集合")
    @TableField(exist = false)
    private List<Long> userIds;

    /**
     * 创建者
     */
    private Long createBy;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 更新者
     */
    private Long updateBy;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
}
