
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_balance_log")
@CompoundIndexes({
        @CompoundIndex(name = "idx_refund_id_number", def = "{'refundId':1, 'refundNumber':1}"),
        @CompoundIndex(name = "idx_user_id", def = "{'userId':1}"),
        @CompoundIndex(name = "idx_recharge_id", def = "{'rechargeId':1}"),
        @CompoundIndex(name = "idx_pay_id", def = "{'payId':1}")
})
@Data
@ToString
public class MongoUserBalanceLogBO implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @Id
    @Schema(description = "用户余额记录id", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long balanceLogId;

    @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 = "充值id")
    private Long rechargeId;

    @Schema(description = "改变金额", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long changeBalance;

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

    @Schema(description = "支付编号(用于余额充值)")
    private Long payId;

    @Schema(description = "支付类型")
    private Integer payType;

    @Schema(description = "RechargeTypeEnum 1:充值 2:赠送 3:支付  4:退款 5:平台手动修改 6:购买会员 7.提现", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer type;

    @Schema(description = "1:已支付 0:未支付(用于余额充值)")
    private Integer isPayed;

    @Schema(description = "退款单号(用于余额支付进行退款)")
    private Long refundId;

    @Schema(description = "退款序号")
    private Integer refundNumber;

    @Schema(description = "支付系统类型(0:默认支付, 1:通联支付)", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer paySysType;

}
