# frozen_string_literal: true

class SendNotifyEmailJob < ApplicationJob
  queue_as :default

  def perform(email_id, mail_type)
    email_filter = FilterForEmail.where(id: email_id).first
    return unless email_filter

    if mail_type == 1
      NewDotationMailer.with(email_filter: email_filter.id).welcome_email
                       .deliver
    elsif mail_type == 2
      NewDotationMailer.with(email_filter: email_filter.id).notification_email
                       .deliver
    end
  end
end
