class JoinRequest
  attr_reader :user, :list
  def id
    "jr-#{user_id}"
  end

  def initialize(user: nil, list: nil)
    @user, @list = user, list
  end

  def user_id
    user.id
  end

  def user_email
    user.email
  end

  def user_facebook_id
    user.uid
  end

  def list_id
    list.id
  end

  def read_attribute_for_serialization(a)
    serializable_hash[a]
  end

  def object
    self
  end

  def serializable_hash
    {
      id: id,
      user_id: user.id,
      user_facebook_id: user.uid,
      user_email: user.email,
      list_id: list.id
    }
  end
end
