package com.gxwebsoft.cms.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

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

import static com.gxwebsoft.common.core.constants.ArticleConstants.ARTICLE_STATUS;

/**
 * 文章
 *
 * @author 科技小王子
 * @since 2023-10-22 15:47:09
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "Article对象", description = "文章")
@TableName("cms_article")
public class Article implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "文章ID")
    @TableId(value = "article_id", type = IdType.AUTO)
    private Integer articleId;

    @ApiModelProperty(value = "文章标题")
    private String title;

    @ApiModelProperty(value = "类型 0列表 1页面 2外链")
    private Integer type;

    @ApiModelProperty(value = "列表显示方式(10小图展示 20大图展示)")
    private Integer showType;

    @ApiModelProperty(value = "话题")
    private String topic;

    @ApiModelProperty(value = "文章分类ID")
    private Integer categoryId;

    @ApiModelProperty(value = "封面图")
    private String image;

    @ApiModelProperty(value = "来源")
    private String source;

    @ApiModelProperty(value = "文章内容")
    @TableField(exist = false)
    private String content;

    @ApiModelProperty(value = "虚拟阅读量(仅用作展示)")
    private Integer virtualViews;

    @ApiModelProperty(value = "实际阅读量")
    private Integer actualViews;

    @ApiModelProperty(value = "发布来源客户端 (APP、H5、小程序等)")
    private String platform;

    @ApiModelProperty(value = "文章附件")
    private String files;

    @ApiModelProperty(value = "视频地址")
    private String video;

    @ApiModelProperty(value = "接受的文件类型")
    private String accept;

    @ApiModelProperty(value = "经度")
    private String longitude;

    @ApiModelProperty(value = "纬度")
    private String latitude;

    @ApiModelProperty(value = "所在省份")
    private String province;

    @ApiModelProperty(value = "所在城市")
    private String city;

    @ApiModelProperty(value = "所在辖区")
    private String region;

    @ApiModelProperty(value = "街道地址")
    private String address;

    @ApiModelProperty(value = "点赞数")
    private Integer likes;

    @ApiModelProperty(value = "评论数")
    private Integer commentNumbers;

    @ApiModelProperty(value = "提醒谁看")
    private String toUsers;

    @ApiModelProperty(value = "用户ID")
    private Integer userId;

    @ApiModelProperty(value = "商户ID")
    private Integer merchantId;

    @ApiModelProperty(value = "商户名称")
    @TableField(exist = false)
    private String merchantName;

    @ApiModelProperty(value = "商户头像")
    @TableField(exist = false)
    private String merchantAvatar;

    @ApiModelProperty(value = "排序(数字越小越靠前)")
    private Integer sortNumber;

    @ApiModelProperty(value = "备注")
    private String comments;

    @ApiModelProperty(value = "状态, 0正常, 1冻结")
    private Integer status;

    @ApiModelProperty(value = "状态文本")
    @TableField(exist = false)
    private String statusText;

    @ApiModelProperty(value = "是否删除, 0否, 1是")
    @TableLogic
    private Integer deleted;

    @ApiModelProperty(value = "租户id")
    private Integer tenantId;

    @ApiModelProperty(value = "注册时间")
    private Date createTime;

    @ApiModelProperty(value = "修改时间")
    private Date updateTime;

    @ApiModelProperty(value = "栏目名称")
    @TableField(exist = false)
    private String categoryName;

    @ApiModelProperty(value = "父级栏目ID")
    @TableField(exist = false)
    private Integer parentId;

    @ApiModelProperty(value = "父级栏目名称")
    @TableField(exist = false)
    private String parentName;

    public String getStatusText() {
      return ARTICLE_STATUS[this.status];
    }
}
