package com.slodon.b2b2c.vo.member;

import com.slodon.b2b2c.core.config.DomainUrlUtil;
import com.slodon.b2b2c.core.util.FileUrlUtil;
import com.slodon.b2b2c.member.pojo.MemberProductLookLog;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

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

/**
 * 商品浏览记录表
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ProductLookLogVO implements Serializable {

    private static final long serialVersionUID = -7443981875499946002L;
    @ApiModelProperty("分组时间")
    private String time;
    @ApiModelProperty("我的足迹集合")
    private List<ProductLookLogInfo> productLookLogInfoList;

    @Data
    public static class ProductLookLogInfo implements Serializable {

        private static final long serialVersionUID = 3686921908412188137L;
        @ApiModelProperty("记录id")
        private Integer logId;

        @ApiModelProperty("会员id，没有登录ID为0")
        private Integer memberId;

        @ApiModelProperty("商品id")
        private Long goodsId;

        @ApiModelProperty("商品名称")
        private String goodsName;

        @ApiModelProperty("商品副标题，长度建议140个字符内")
        private String goodsBrief;

        @ApiModelProperty("商品图片")
        private String goodsImage;

        @ApiModelProperty("产品id")
        private Long productId;

        @ApiModelProperty("货品价格")
        private BigDecimal productPrice;

        @ApiModelProperty("货品新价格")
        private String goodsMoney;

        @ApiModelProperty("店铺id")
        private Long storeId;

        @ApiModelProperty("访问时间")
        private Date createTime;

        @ApiModelProperty("收藏id")
        private Integer followId;

        //非足迹列表
        @ApiModelProperty("分享链接")
        private String shareLink;

        @ApiModelProperty("是否收藏商品:false 未收藏, true 收藏")
        private Boolean isFollowProduct;

        @ApiModelProperty("商品状态：11-放入仓库无需审核；12-放入仓库审核通过；20-立即上架待审核；21-放入仓库待审核；3-上架（a. 审核通过上架，b. 不需要平台审核，商户创建商品后点击上架操作）；4-审核驳回(平台驳回）；5-商品下架（商户自行下架）；6-违规下架（平台违规下架操作）；7-已删除（状态1、5、6可以删除后进入此状态）")
        private Integer state;

        public ProductLookLogInfo(MemberProductLookLog memberProductLookLog) {
            logId = memberProductLookLog.getLogId();
            memberId = memberProductLookLog.getMemberId();
            goodsId = memberProductLookLog.getGoodsId();
            goodsName = memberProductLookLog.getGoodsName();
            goodsBrief = memberProductLookLog.getGoodsBrief();
            goodsImage = FileUrlUtil.getFileUrl(memberProductLookLog.getGoodsImage(), null);
            productId = memberProductLookLog.getProductId();
            productPrice = memberProductLookLog.getProductPrice();
            goodsMoney = memberProductLookLog.getGoodsMoney();
            createTime = memberProductLookLog.getCreateTime();
            storeId = memberProductLookLog.getStoreId();
            followId = memberProductLookLog.getLogId();
            shareLink = DomainUrlUtil.SLD_H5_URL + "/standard/product/detail?productId=" + memberProductLookLog.getProductId() + "&goodsId=" + memberProductLookLog.getGoodsId();
        }
    }

}