package com.red.circle.other.inner.model.dto.user.account;

import com.red.circle.framework.dto.DTO;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import java.util.HashMap;
import java.util.Map;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * 用户账号.
 *
 * @author pengliang on 2020/11/2
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class UserAccountDTO extends DTO {

  /**
   * 令牌.
   */
  private String token;

  /**
   * 用户资料.
   */
  private UserProfileDTO userProfile;

  /**
   * IM用户签名.
   */
  private String userSig;

  /**
   * 扩展属性.
   */
  private Map<String, Object> extValues;

  public void putExtField(String fieldName, Object value) {
    if (this.extValues == null) {
      this.extValues = new HashMap<>(6);
    }
    this.extValues.put(fieldName, value);
  }

  public void putRewardProps(Object newUserReward) {
    putExtField("reward", newUserReward);
  }

}
