object @lesson_booking

attributes :id, :status, :lesson_type, :payment_style, :recurring, :teacher_id, :description, :lesson_length, :created_at, :user_id, :active, :accepter_id, :canceler_id, :cancel_message, :booked_price, :card_presumed_ok, :no_slots, :posa_card_id, :posa_card_purchased, :remaining_roll_forward_amount_in_cents, :canceled_by_admin

child(:lesson_booking_slots => :slots) {
  attributes :id, :preferred_day, :day_of_week, :hour, :minute, :slot_type,  :message, :proposer_id, :is_student_created?, :is_teacher_created?, :timezone, :pretty_timezone, :from_package

  node :pretty_start_time do |slot|
    slot.pretty_start_time(true, current_timezone)
  end

  node :pretty_scheduled_start do |slot|
    slot.pretty_scheduled_start(true, current_timezone)
  end
}

child(:default_slot => :default_slot) {
  attributes :id, :preferred_day, :day_of_week, :hour, :minute, :slot_type, :message, :proposer_id, :is_student_created?, :is_teacher_created?, :timezone, :pretty_timezone, :from_package
  node :pretty_start_time do |slot|
    slot.pretty_start_time(true, current_timezone)
  end
  node :pretty_scheduled_start do |slot|
    slot.pretty_scheduled_start(true, current_timezone)
  end
}

child(:alt_slot => :alt_slot) {
  attributes :id, :preferred_day, :day_of_week, :hour, :minute, :slot_type, :message, :proposer_id, :is_student_created?, :is_teacher_created?, :timezone, :pretty_timezone, :from_package
  node :pretty_start_time do |slot|
    slot.pretty_start_time(true, current_timezone)
  end
  node :pretty_scheduled_start do |slot|
    slot.pretty_scheduled_start(true, current_timezone)
  end
}

child(:counter_slot => :counter_slot) {
  attributes :id, :preferred_day, :day_of_week, :hour, :minute, :slot_type, :message, :proposer_id, :is_student_created?, :is_teacher_created?, :timezone, :pretty_timezone, :from_package, :is_recurring?
  node :pretty_scheduled_start_with_timezone do |slot|
    pretty_scheduled_start_slot(slot, true)
  end
  node :pretty_start_time do |slot|
    slot.pretty_start_time(true, current_timezone)
  end
  node :pretty_scheduled_start do |slot|
    slot.pretty_scheduled_start(true, current_timezone)
  end
}


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

node :teacher do |lesson_booking|
  partial "api_users/show", object: lesson_booking.teacher
end

node :next_lesson do |lesson_booking|
  partial "api_lesson_sessions/show", object: lesson_booking.next_lesson
end

if @lesson_session
  node :focused_lesson do
    partial "api_lesson_sessions/show", object: @lesson_session
  end
end
