package shop.alien.entity.store;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
 * 评论表（商户仅可回复）
 *
 * @author system
 * @since 2025-01-XX
 */
@Data
@JsonInclude
@TableName("common_comment")
@ApiModel(value = "CommonComment对象", description = "评论表（商户仅可回复）")
public class CommonComment implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "评论来源类型：1-评价的评论 2-动态评论 3-打卡评论，4-二手商品评论")
    @TableField("source_type")
    private Integer sourceType;

    @ApiModelProperty(value = "来源关联ID：source_type=1时=rating.id，=2时=动态ID，=3打卡id，=4时=二手商品ID")
    @TableField("source_id")
    private Long sourceId;

    @ApiModelProperty(value = "评论发布者ID：用户=用户ID，商户=商户运营账号ID")
    @TableField("user_id")
    private Long userId;

    @ApiModelProperty(value = "父评论ID：0=根评论，>0=回复某条评论")
    @TableField("parent_id")
    private Long parentId;

    @ApiModelProperty(value = "评论纯文本内容")
    @TableField("content")
    private String content;

    @ApiModelProperty(value = "评论图片URL（可选）")
    @TableField("image_urls")
    private String imageUrls;

    @ApiModelProperty(value = "是否匿名：0-否 1-是（仅用户评论生效）")
    @TableField("is_anonymous")
    private Integer isAnonymous;

    @ApiModelProperty(value = "评论主体：1-用户评论 2-商户评论（仅回复）")
    @TableField("comment_type")
    private Integer commentType;

    @ApiModelProperty(value = "商户ID：comment_type=2时必填")
    @TableField("merchant_id")
    private Long merchantId;

    @ApiModelProperty(value = "是否展示：0-隐藏 1-展示")
    @TableField("is_show")
    private Integer isShow;

    @ApiModelProperty(value = "审核状态：0-待审核 1-通过 2-驳回")
    @TableField("audit_status")
    private Integer auditStatus;

    @ApiModelProperty(value = "点赞数")
    @TableField("like_count")
    private Integer likeCount;

    @ApiModelProperty(value = "回复数")
    @TableField("reply_count")
    private Integer replyCount;

    @ApiModelProperty(value = "删除标记, 0:未删除, 1:已删除")
    @TableField("delete_flag")
    @TableLogic
    private Integer deleteFlag;

    @ApiModelProperty(value = "创建时间")
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createdTime;

    @ApiModelProperty(value = "更新时间")
    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updatedTime;

    @ApiModelProperty(value = "扩展字段：如评论楼层")
    @TableField(value = "ext_info", typeHandler = com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler.class)
    private String extInfo;

    @ApiModelProperty(value = "审核失败原因")
    @TableField(value = "audit_reason")
    private String auditReason;
}

