class Users::ListSerializer
  include Qwaiter::UserBaseSerializer
  # user ids for facebook pictures
  #self.root = :list
  attributes :state, :needs_help, :needs_payment, :user_requests_closing,
    :is_paid, :price, :closed_at

  has_many :users, serializer: Users::UserSerializer
  has_many(:orders, serializer: Users::OrderSerializer)
  has_many :join_requests, serializer: Users::JoinRequestSerializer
  has_one :supplier, serializer: Users::SupplierSerializer
  has_one :table, serializer: Users::TableSerializer

  def include_orders?
    @_include_linkages.any?{|link| link =~ /orders/}
  end

  related_link_for :orders, :table
  #belongs_to :table
end
