object @teacher

attributes  :id,
            :biography,
            :created_at,
            :id,
            :introductory_video,
            :lesson_duration_120,
            :lesson_duration_30,
            :lesson_duration_45,
            :lesson_duration_60,
            :lesson_duration_90,
            :price_per_lesson_120_cents,
            :price_per_lesson_30_cents,
            :price_per_lesson_45_cents,
            :price_per_lesson_60_cents,
            :price_per_lesson_90_cents,
            :price_per_month_120_cents,
            :price_per_month_30_cents,
            :price_per_month_45_cents,
            :price_per_month_60_cents,
            :price_per_month_90_cents,
            :prices_per_lesson,
            :prices_per_month,
            :teaches_advanced,
            :teaches_age_lower,
            :teaches_age_upper,
            :teaches_beginner,
            :teaches_intermediate,
            :updated_at,
            :user_id,
            :website,
            :years_playing,
            :years_teaching,
            :teaches_test_drive,
            :test_drives_per_week,
            :errors,
            :profile_pct,
            :school_id,
            :background_check_at,
            :is_searchable


child :review_summary => :review_summary do
  attributes :avg_rating, :wilson_score, :review_count
end

child :school => :school do
  attributes :id, :education
end

child :recent_reviews => :recent_reviews do
  attributes :id, :description, :rating, :created_at

  child(:user => :user) {
      attributes :id, :first_name, :last_name, :name, :photo_url
    }
end

node :profile_pct_summary do |teacher|
  teacher.profile_pct_summary
end


node :instruments do |teacher|
  teacher.instruments.collect{|o|o.id}
end

node :subjects do |teacher|
  teacher.subjects.collect{|o|o.id}
end

node :genres do |teacher|
  teacher.genres.collect{|o|o.id}
end

node :languages do |teacher|
  teacher.languages.collect{|o|o.id}
end

node :experiences_teaching do |teacher|
  teacher.experiences_teaching.collect do |o|
    {
        name: o.name,
        experience_type: o.experience_type,
        organization: o.organization,
        start_year: o.start_year,
        end_year: o.end_year
    }
  end # collect
end

node :experiences_education do |teacher|
  teacher.experiences_education.collect do |o|
    {
        name: o.name,
        experience_type: o.experience_type,
        organization: o.organization,
        start_year: o.start_year,
        end_year: o.end_year
    }
  end # collect
end

node :experiences_award do |teacher|
  teacher.experiences_award.collect do |o|
    {
        name: o.name,
        experience_type: o.experience_type,
        organization: o.organization,
        start_year: o.start_year,
        end_year: o.end_year
    }
  end # collect
end

if current_user
  node :has_rated_teacher do |teacher|
      current_user.has_rated_teacher(teacher)
    end
end