package com.tmerclub.cloud.product.bo.mongo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.Document;

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

/**
 * 对应MongoDB中商品浏览记录表emp
 *
 * @author 菠萝凤梨
 */
@Data
@ToString
@Document("spu_browse_log")
@CompoundIndexes({
        @CompoundIndex(name = "userId_status_spuId_idx", def = "{'userId':1, 'status':1, 'spuId':1}"),
        @CompoundIndex(name = "userId_spuType_spuId_time_idx", def = "{'userId':1, 'spuType':1, 'spuId':1, 'createTime':1}"),
})
public class MongoSpuBrowseLogBO implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;
    @Id
    @Schema(description = "商品浏览记录id")
    private Long spuBrowseLogId;

    @Schema(description = "用户id")
    private Long userId;

    @Schema(description = "商品id")
    private Long spuId;

    @Schema(description = "分类id")
    private Long categoryId;

    @Schema(description = "1:正常 -1:删除")
    private Integer status;

    @Schema(description = "商品类型")
    private Integer spuType;

    @Schema(description = "创建时间")
    private Date createTime;

    @Schema(description = "更新时间")
    private Date updateTime;

    @Transient
    @Schema(description = "商品名称")
    private String spuName;

}
