class Pdf::Service::LogSummaryService < Pdf::ApplicationService
  def initialize(students, school)
    @filename = 'service_log_summary.pdf'
    @school = school
    @students = students
    @requirement = @school.service_requirement&.student_hours
    @date = Date.today.strftime('%B %d, %Y')
    super
  end

  private
    def configuration
      {}.tap do |config|
        config[:margin] = { top: 10, bottom: 20 }
      end
    end

    def body
      ActionController::Base.new.render_to_string(
        partial: 'pdf/reports/service_log_summary.html.haml',
        locals: {
          school: @school,
          students: @students,
          date: @date,
          requirement: @requirement
        }
      )
    end
end
