package plant

import (
	"sundynix-go/global"
	"sundynix-go/model/system"
)

// Post 帖子
type Post struct {
	global.BaseModel
	UserId       string `json:"userId" form:"userId" gorm:"column:user_id;size:50;comment:用户id"`
	Title        string `json:"title" form:"title" gorm:"column:title;size:100;comment:帖子标题"`
	Content      string `json:"content" form:"content" gorm:"column:content;size:500;comment:帖子内容"`
	ViewCount    int    `json:"viewCount" form:"viewCount" gorm:"default:0;column:view_count;comment:浏览次数"`
	CommentCount int    `json:"commentCount" form:"commentCount" gorm:"default:0;column:comment_count;comment:评论次数"`
	LikeCount    int    `json:"likeCount" form:"likeCount" gorm:"default:0;column:like_count;comment:点赞次数"`
	StarCount    int    `json:"starCount" form:"starCount" gorm:"default:0;column:star_count;comment:收藏次数"`
	Location     string `json:"location" form:"location" gorm:"column:location;size:100;comment:位置"`
	HasReviewed  int    `json:"hasReviewed" form:"hasReviewed" gorm:"column:has_reviewed;default:0;comment:是否审核通过"` // 0-未审核 1-审核通过 2-违规
	HasLiked     int    `json:"hasLiked" form:"hasLiked" gorm:"-"`
	HasStar      int    `json:"hasStar" form:"hasStar" gorm:"-"`
	//图片
	ImgList []*system.Oss `json:"imgList" form:"imgList" gorm:"many2many:post_oss;comment:图片列表"`
	//评论
	CommentList []*PostComment `json:"commentList" form:"commentList" gorm:"foreignKey:PostId;comment:评论列表"`
	//点赞
	LikeList  []*PostLike  `json:"likeList" form:"likeList" gorm:"foreignKey:PostId;comment:点赞列表"`
	Publisher *system.User `json:"publisher" form:"publisher" gorm:"foreignKey:UserId;comment:用户"`
}
