package com.ruoyi.frequency.works.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.controller.req.WorksReleaseReq;
import com.ruoyi.frequency.workspanorama.entity.WorksPanorama;
import com.ruoyi.vo.UserInfo;
import com.ruoyi.vo.UserVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 作品对象 t_works
 *
 * @author zj
 * @date 2023-09-22
 */
@Data
@Accessors(chain = true)
@TableName("t_works")
public class Works extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 租户号 */
    private Long id;


    /** 删除标志;1 正常 2 删除 3 禁用 */
    private Integer delFlag;

    /** 作品类型ID */
    @Excel(name = "作品类型ID")
    private Long worksTypeId;

    /** 标题 */
    @Excel(name = "标题")
    private String title;

    /** 封面图 */
    @Excel(name = "封面图")
    private String coverImage;

    /** 作品图片 */
    @Excel(name = "作品图片")
    private String images;

    /** 价格(订单来源的作品) */
    @Excel(name = "价格(订单来源的作品)")
    private BigDecimal price;

    /** 表现师id */
    @Excel(name = "表现师id")
    private Long storeId;

    /** 设计师id */
    @Excel(name = "设计师id")
    private Long customerId;

    private Integer userType;

    /** 来源 1 手动创建 2 订单同步 */
    @Excel(name = "来源 1 手动创建 2 订单同步")
    private Integer source;

    /** $column.columnComment */
    @Excel(name = "来源 1 手动创建 2 订单同步")
    private Long orderId;

    /** 点赞数 */
    @Excel(name = "点赞数")
    private Integer likeNum;

    /** 踩的数量 */
    @Excel(name = "踩的数量")
    private Integer stepNum;

    /** 评论数 */
    @Excel(name = "评论数")
    private Integer commentNum;

    /** 收藏数 */
    @Excel(name = "收藏数")
    private Integer collectNum;

    /** 浏览数 */
    @Excel(name = "浏览数")
    private Integer browseNum;

    @ApiModelProperty("是否是高端客户 1普通 2 高端 ")
    private Integer ifHighend;

    @ApiModelProperty("精彩评论id")
    private Long commentId;

    @ApiModelProperty("是否隐藏 1 否 2 是 ")
    private Integer isHide;

    @ApiModelProperty("热度时间")
    private Date trendsTime;

    @ApiModelProperty("订单编号")
    @TableField(exist = false)
    private String orderNo;

    @ApiModelProperty("开始时间")
    @TableField(exist = false)
    private UserInfo storeInfo;

    @ApiModelProperty(value = "3D 全景图")
    @TableField(exist = false)
    private List<WorksPanorama> worksPanoramaList;

    @ApiModelProperty("开始时间")
    @TableField(exist = false)
    private Date beginTime;

    @ApiModelProperty("结束时间")
    @TableField(exist = false)
    private Date endTime;

    @ApiModelProperty("作品类型名称")
    @TableField(exist = false)
    private String worksTypeName;

    @ApiModelProperty("企业id")
    @TableField(exist = false)
    private Long enterpriseId;

    public Works() {
    }

    public Works(WorksReleaseReq req, UserVo userVo) {
        this.title = req.getTitle();
        this.coverImage=req.getCoverImage();
        this.images = req.getImages();
        this.price = req.getPrice();
        this.userType = userVo.getUserType();
        this.storeId = userVo.getUserId();
        this.customerId=req.getCustomerId();
        this.source = req.getSource();
        this.orderId = req.getOrderId();
        this.worksTypeId = req.getWorksTypeId();
        this.ifHighend = req.getIfHighend();
    }
}
