# frozen_string_literal: true
class ReviewerMailer < ApplicationMailer
  def candidate_submission candidate
    @candidate = candidate
    recipients = candidate.quiz.reviewers.map(&:email)

    mail to: recipients, subject: "Skills Assessment Results - #{@candidate.test_hash}"
  end

  def reminder reminder
    @reminder = reminder

    mail to: reminder.email, subject: "Review Reminder"
  end

  def notify_manager candidate_id
    @candidate = Candidate.find_by(id: candidate_id)
    @manager = @candidate.manager

    mail to: @manager.email, subject: "Voting Complete"
  end

  def new_comment comment
    @comment = comment
    recipients = comment.candidate.reviewers.map(&:email)

    mail to: recipients, subject: "Skills Assessment Review Comment - #{@comment.test_hash}"
  end
end
