class FeedCard < Struct.new(:type, :timestamp, :json)
  # Create json for exactly what UI needs and return as `FeedCard`
  def self.event_note_card(event_note)
    json = event_note.as_json({
      :only => [:id, :recorded_at, :event_note_type_id, :text],
      :include => {
        :educator => {:only => [:id, :full_name, :email]},
        :student => {
          :only => [:id, :email, :first_name, :last_name, :grade, :house, :has_photo],
          :methods => [:has_photo],
          :include => {
            :school => {
              :only => [:local_id, :school_type]
            },
            :homeroom => {
              :only => [:id, :name],
              :include => {
                :educator => {:only => [:id, :full_name, :email]}
              }
            }
          }
        }
      }
    })
    FeedCard.new(:event_note_card, event_note.recorded_at, json)
  end
end
