package de.ivu.elect.business.system.entity;

import java.io.Serializable;

import javax.annotation.Nullable;

import de.ivu.elect.business.mandant.entity.Mandant;

public class MailEvent implements Serializable {

  public static final String BODY_TYPE_TEXT_PLAIN = "text/plain";
  public static final String BODY_TYPE_TEXT_HTML = "text/html";

  private static final long serialVersionUID = -3721626832031649272L;

  private final Mandant mandant;

  private final String betreff;

  private final String body;

  private final String bodyType;

  private final String empfaenger;

  protected MailEvent() {
    this(null, null, null, null, null);
  }

  public static MailEvent createPlainTextMail(Mandant mandant, String betreff, String body, @Nullable String empfaenger) {
    return new MailEvent(mandant, betreff, body, BODY_TYPE_TEXT_PLAIN, empfaenger);
  }

  protected MailEvent(Mandant mandant, String betreff, String body, String bodyType, @Nullable String empfaenger) {
    this.mandant = mandant;
    this.betreff = betreff;
    this.body = body;
    this.bodyType = bodyType;
    this.empfaenger = empfaenger;
  }

  public String getBetreff() {
    return betreff;
  }

  public String getBody() {
    return body;
  }

  public String getBodyType() {
    return bodyType;
  }

  @Nullable
  public String getEmpfaenger() {
    return empfaenger;
  }

  public Mandant getMandant() {
    return mandant;
  }
}
