package com.red.circle.other.infra.database.mongo.entity.live;

import cn.hutool.core.convert.Convert;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.red.circle.other.inner.enums.live.RoomContributionCountType;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
import lombok.AccessLevel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * 榜单&queen统计.
 *
 * @author pengshigang on 2022/10/25
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
@Document("room_contribution_count")
@FieldDefaults(level = AccessLevel.PRIVATE)
public class RoomContributionCount extends Convert implements Serializable {

  @Serial
  private static final long serialVersionUID = 1L;

  /**
   * 记录id.
   */
  @Id
  @JsonSerialize(using = ToStringSerializer.class)
  String id;

  /**
   * 系统.
   */
  String sysOrigin;

  /**
   * 类型.
   */
  RoomContributionCountType type;

  /**
   * 用户id.
   */
  @JsonSerialize(using = ToStringSerializer.class)
  private Long userId;

  /**
   * 房间id.
   */
  @JsonSerialize(using = ToStringSerializer.class)
  private Long roomId;

  /**
   * 总额数量.
   */
  private BigDecimal totalQuantity;

  /**
   * 日期.
   */
  private String dateNumber;

  /**
   * 提取数量.
   */
  private BigDecimal withdrawQuantity;

  /**
   * 计算余额.
   */
//  public BigDecimal calculationBalance() {
//    return totalQuantity.subtract(withdrawQuantity).setScale(2, RoundingMode.DOWN);
//  }

  /**
   * 创建时间.
   */
  Timestamp createTime;

  /**
   * 过期时间.
   */
  Timestamp expiredTime;

}
