class Pdf::Nursing::MedicalAlertsService < Pdf::NewApplicationService
  def initialize(school, students)
    @students = students.map(&:decorate)
    @school = school
  end

  private
    def header
      content = ActionController::Base.new.render_to_string(
        partial: 'pdf/headers/school_info.html.haml',
        locals: {
          school: @school,
          side_content_partial: 'pdf/nursing/medical_alerts_header.html.haml',
          side_content: side_content
        }
      )
      { content: content, spacing: 25 }
    end

    def body
      ActionController::Base.new.render_to_string(
        partial: 'pdf/nursing/medical_alerts.html.haml',
        locals: set_local_variables
      )
    end

    def set_local_variables
      { students: @students }
    end

    def side_content
      { date: Time.zone.today }
    end
end
