class Reporting::Admissions::ApplicantListJob < Reporting::Job
  def process
    review = @params['review']
    enrollment = @params['enrollment']
    school_year = @school.school_years.find(@params['school_year_id'])

    applicants = school_year.admission_applicants
      .by_enrollment(@params['enrollment'])
      .by_review(@params['review'])
      .with_state(@params['state'])
      .with_grade(@params['grades'])
      .with_application(@params['application_ids'])
      .with_returning(@params['student_type'])
      .with_tags(@params['tag_ids'])
      .ordered

    @tmp_file = Pdf::Admissions::ApplicantListService.call(@school, applicants, review, enrollment)
    @filename = "applicants_list_#{timestamp}.pdf"
    save_to_user
    send_report
  end
end
