# frozen_string_literal: true

# Mailer for dotations
class NewDotationMailer < ApplicationMailer
  default from: 'pomoc@kalendarzdotacji.pl'

  def welcome_email
    @email_filter = FilterForEmail.where(id: params[:email_filter]).first
    @email_params = {
      i: @email_filter.email,
      k: @email_filter.unique_name
    }
    # @emailfilter = FilterForEmail.find(params[:emailfilter])
    mail(to: @email_filter.email, subject: 'Dodano subskrypcję dla nowych dotacji')
  end

  def notification_email
    @email_filter = FilterForEmail.where(id: params[:email_filter]).first
    @dotation = Dotation.where(id: params[:dotation_id]).first
    @email_params = {
      i: @email_filter.email,
      k: @email_filter.unique_name
    }
    mail(to: @email_filter.email, subject: 'Pojawiła się nowa dotacja')
  end
end
