package com.red.circle.other.inner.enums.team;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Objects;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * 成员指标.
 *
 * @author pengliang on 2022/12/1
 */
@Data
@Accessors(chain = true)
public class TeamMemberTargetIndex implements Serializable {

  private static final long serialVersionUID = 1L;

  /**
   * 自己房间-在线时长（分钟）.
   */
  @JsonSerialize(using = ToStringSerializer.class)
  private Long ownOnlineTime;

  /**
   * 其他房间在线时长（分钟）.
   */
  @JsonSerialize(using = ToStringSerializer.class)
  private Long otherOnlineTime;

  /**
   * 20240918 政策新增有效天字段
   * 大于1小时（60分钟）即可获取当天有效天
   */
  private Integer effectiveDay;

  /**
   * 收到的礼物.
   */
  @JsonSerialize(using = ToStringSerializer.class)
  private Long acceptGiftValue;

    /**
     * 溢出值
     */
  private Long overFlowGiftValue;

  /**
   * 送出等礼物.
   */
  @JsonSerialize(using = ToStringSerializer.class)
  private Long giveGiftValue;

  /**
   * 房间的流水.
   */
  @JsonSerialize(using = ToStringSerializer.class)
  private Long roomValue;

  /**
   * 日期数.
   */
  private Integer dateNumber;

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

  /**
   * 修改时间.
   */
  private Timestamp updateTime;


  public Long allOnlineTime() {
    Long ownTime = Objects.nonNull(ownOnlineTime) ? ownOnlineTime : 0L;
    Long otherTime = Objects.nonNull(otherOnlineTime) ? otherOnlineTime : 0L;
    return ownTime + otherTime;
  }

}
