package shop.alien.entity.second.vo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import shop.alien.entity.second.SecondGoodsRecord;

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

@Data
@ApiModel("商品操作记录详情VO")
public class SecondGoodsRecordDetailVo {

    @ApiModelProperty(value = "主键ID")
    private Integer id;

    @ApiModelProperty(value = "商品ID")
    private Integer goodsId;

    @TableField(exist = false)
    @ApiModelProperty(value = "用户电话")
    private String userPhone;

    @ApiModelProperty("一级分类名称")
    @TableField(exist = false)
    private String categoryOneName;

    @ApiModelProperty("二级分类名称")
    @TableField(exist = false)
    private String categoryTwoName;

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

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

    @TableField("operation_name")
    @ApiModelProperty(value = "操作名称")
    private String operationName;

    @ApiModelProperty(value = "商品标题")
    private String title;

    @ApiModelProperty(value = "商品描述")
    private String description;

    @ApiModelProperty(value = "商品价格（元，保留小数后两位）")
    private BigDecimal price;

    @ApiModelProperty(value = "商品位置")
    private String position;

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

    @ApiModelProperty(value = "收藏数量")
    private Integer collectCount;

    @ApiModelProperty(value = "一级类别ID")
    private Integer categoryOneId;

    @ApiModelProperty(value = "二级类别ID")
    private Integer categoryTwoId;

    @ApiModelProperty(value = "标签")
    private String label;

    @ApiModelProperty(value = "话题（以逗号分隔）")
    private String topic;

    @ApiModelProperty(value = "交易ID")
    private Integer tradeId;

    @ApiModelProperty(value = "发布时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date releaseTime;

    @ApiModelProperty(value = "商品状态 0:草稿 1:审核中 2:审核失败 3:已上架 4:已下架 5:已售出")
    private Integer goodsStatus;

    @ApiModelProperty(value = "审核失败原因")
    private String failedReason;

    @ApiModelProperty(value = "首页图")
    private String homeImage;

    @ApiModelProperty(value = "视频审核任务id")
    private String videoTaskId;

    @ApiModelProperty(value = "视频第一帧图片")
    private String videoFirstFrame;

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

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

    @ApiModelProperty(value = "创建人ID")
    private Integer createdUserId;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updatedTime;

    @ApiModelProperty(value = "修改人ID")
    private Integer updatedUserId;

    @ApiModelProperty(value = "地址文本")
    private String addressText;

    @ApiModelProperty(value = "商品图片列表")
    private List<String> imageUrls;

    @ApiModelProperty(value = "图片集合")
    private List<Map<String, Object>> imgList;
    public static SecondGoodsRecordDetailVo fromRecord(SecondGoodsRecord record) {
        SecondGoodsRecordDetailVo vo = new SecondGoodsRecordDetailVo();
        vo.setId(record.getId());
        vo.setUserId(record.getUserId());
        vo.setOperationName(record.getOperationName());
        vo.setGoodsId(record.getGoodsId());
        vo.setTitle(record.getTitle());
        vo.setDescription(record.getDescription());
        vo.setPrice(record.getPrice());
        vo.setPosition(record.getPosition());
        vo.setLikeCount(record.getLikeCount());
        vo.setCollectCount(record.getCollectCount());
        vo.setCategoryOneId(record.getCategoryOneId());
        vo.setCategoryTwoId(record.getCategoryTwoId());
        vo.setLabel(record.getLabel());
        vo.setTopic(record.getTopic());
        vo.setTradeId(record.getTradeId());
        vo.setReleaseTime(record.getReleaseTime());
        vo.setGoodsStatus(record.getGoodsStatus());
        vo.setFailedReason(record.getFailedReason());
        vo.setHomeImage(record.getHomeImage());
        vo.setVideoTaskId(record.getVideoTaskId());
        vo.setVideoFirstFrame(record.getVideoFirstFrame());
        vo.setDeleteFlag(record.getDeleteFlag());
        vo.setCreatedTime(record.getCreatedTime());
        vo.setCreatedUserId(record.getCreatedUserId());
        vo.setUpdatedTime(record.getUpdatedTime());
        vo.setUpdatedUserId(record.getUpdatedUserId());
        vo.setAddressText(record.getAddressText());
        vo.setUpdatedUserId(record.getUpdatedUserId());
        vo.setAddressText(record.getAddressText());
        vo.setCategoryOneName(record.getCategoryOneName());
        vo.setCategoryTwoName(record.getCategoryTwoName());

        return vo;
    }
}