
package com.tmerclub.cloud.user.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.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
 * @author TRACK
 */
@Document("user_score_log")
@CompoundIndexes({
        @CompoundIndex(name = "idx_user_id", def = "{'userId':1}"),
        @CompoundIndex(name = "idx_biz_id", def = "{'bizId':1}")
})
@Data
@ToString
public class MongoUserScoreLogBO implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @Id
    @Schema(description = "用户积分记录id", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long logId;

    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    private Date createTime;

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

    @Schema(description = "用户id", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long userId;

    @Schema(description = "1.购物 2.会员等级提升加积分 3.签到加积分 4.购物抵扣使用积分 5.积分过期", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer source;

    @Schema(description = "变动积分数额")
    private Long score;

    @Schema(description = "业务id")
    private Long bizId;

    @Schema(description = "出入类型 0=支出 1=收入", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer ioType;

}
