class AnnonceAccountMailer < ApplicationMailer
  layout "mail"
  # Subject can be set in your I18n file at config/locales/en.yml
  # with the following lookup:
  #
  #   en.annonce_account.confirm.subject
  #
  def confirm(annonce_account)
    @annonce_account = annonce_account

    mail from: "no-reply@sideplace.com", to: annonce_account.email, :subject => "Important : Activation de votre compte Sideplace"
  end
  
  
  def new_user(annonce_account)
    @annonce_account = annonce_account
    @parent = @annonce_account.parent
    if @parent
      mail from: "no-reply@sideplace.com", to: @parent.email, :subject => "Vous avez un nouvel affilié sur Sideplace.com !" do |format|
        format.html { render layout: false }
    

      end
      
    end
  end

  # Subject can be set in your I18n file at config/locales/en.yml
  # with the following lookup:
  #
  #   en.annonce_account.reset_password.subject
  #
  
  def new_message(annonce_account)
    @annonce_account = annonce_account

    mail from: "Sideplace.com <no-reply@sideplace.com>", to: annonce_account.email, :subject => "Vous avez un nouveau message privé"
  end
  
  def password_reset(annonce_account)
    @annonce_account = annonce_account
    mail :to => @annonce_account.email, :subject => "Reinitialisation du mot de passe.", :from => "Sideplace.com <no-reply@sideplace.com>"
  end
  
  def new_commission(commission)
    @commission = commission
    
    if @commission.commission_type_id == 1 or @commission.commission_type_id == 2 or @commission.commission_type_id == 3
      mail from: "no-reply@sideplace.com", to: @commission.annonce_account.email, :subject => "Vous avez reçu une commission sur Sideplace.com !" do |format|
        format.html { render layout: false }
    

      end
      
    end
  end
  
end
