<?php

/**
 * OpenKM, Open Knowledge Management System S.L.  (http://www.openkm.com)
 * Copyright (c) 2006-2018
 *
 * No bytes were intentionally harmed during the development of this application.
 *
 * This program is commercial software; you can use it under the terms of the
 * EULA - OpenKM SDK End User License Agreement as published by OpenKM Knowledge Management System S.L.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * EULA - OpenKM SDK End User License Agreement for more details:
 * http://docs.openkm.com/kcenter/view/licenses/eula-openkm-sdk-end-user-license-agreement.html
 */


namespace openkm\bean;

/**
 * Mail
 *
 * @author sochoa
 */
class Mail extends Node {

    const MIME_TEXT = 'text/plain';
    const MIME_HTML = 'text/html';
    const ORIGIN_MSG = 'msg';
    const ORIGIN_EML = 'eml';
    const ORIGIN_API = 'api';
    const ORIGIN_POP3 = 'pop3';
    const ORIGIN_IMAP = 'imap';
    const TYPE = 'okm:mail';
    const SIZE = 'okm:size';
    const FROM = 'okm:from';
    const REPLY = 'okm:reply';
    const TO = 'okm:to';
    const CC = 'okm:cc';
    const BCC = 'okm:bcc';
    const SENT_DATE = 'okm:sentDate';
    const RECEIVED_DATE = 'okm:receivedDate';
    const SUBJECT = 'okm:subject';
    const CONTENT = 'okm:content';
    const MIME_TYPE = 'okm:mimeType';

    private $title;
    private $from;
    private $reply = [];
    private $to = [];
    private $cc = [];
    private $bcc = [];
    private $sentDate;
    private $receivedDate;
    private $subject;
    private $content;
    private $mimeType;
    private $headers;
    private $raw;
    private $origin;
    private $size;
    private $hasAttachments;

    function __construct() {
        
    }

    public function getTitle() {
        return $this->title;
    }

    public function setTitle($title) {
        $this->title = $title;
    }

    public function istHasAttachments() {
        return $this->hasAttachments;
    }

    public function setHasAttachments($hasAttachments) {
        $this->hasAttachments = $hasAttachments;
    }

    public function getFrom() {
        return $this->from;
    }

    public function getReply() {
        return $this->reply;
    }

    public function getTo() {
        return $this->to;
    }

    public function getCc() {
        return $this->cc;
    }

    public function getBcc() {
        return $this->bcc;
    }

    public function getSentDate() {
        return $this->sentDate;
    }

    public function getReceivedDate() {
        return $this->receivedDate;
    }

    public function getSubject() {
        return $this->subject;
    }

    public function getContent() {
        return $this->content;
    }

    public function getMimeType() {
        return $this->mimeType;
    }

    public function getHeaders() {
        return $this->headers;
    }

    public function getRaw() {
        return $this->raw;
    }

    public function getOrigin() {
        return $this->origin;
    }

    public function getSize() {
        return $this->size;
    }

    public function setFrom($from) {
        $this->from = $from;
    }

    public function setReply($reply) {
        $this->reply = $reply;
    }

    public function setTo($to) {
        $this->to = $to;
    }

    public function setCc($cc) {
        $this->cc = $cc;
    }

    public function setBcc($bcc) {
        $this->bcc = $bcc;
    }

    public function setSentDate($sentDate) {
        $this->sentDate = $sentDate;
    }

    public function setReceivedDate($receivedDate) {
        $this->receivedDate = $receivedDate;
    }

    public function setSubject($subject) {
        $this->subject = $subject;
    }

    public function setContent($content) {
        $this->content = $content;
    }

    public function setMimeType($mimeType) {
        $this->mimeType = $mimeType;
    }

    public function setHeaders($headers) {
        $this->headers = $headers;
    }

    public function setRaw($raw) {
        $this->raw = $raw;
    }

    public function setOrigin($origin) {
        $this->origin = $origin;
    }

    public function setSize($size) {
        $this->size = $size;
    }

    public function toString() {
        $mail = '{';
        $mail .= "path=" . $this->path;
        $mail .= ", uuid=" . $this->uuid;
        $mail .= ", permissions=" . $this->permissions;
        $mail .= ", size=" . $this->size;
        $mail .= ", title=" . $this->title;
        $mail .= ", from=" . $this->from;
        $mail .= ", reply=" . implode(',', $this->reply);
        $mail .= ", to=" . implode(',', $this->to);
        $mail .= ", sentDate=" . $this->sentDate == null ? null : $this->sentDate;
        $mail .= ", receivedDate=" . $this->receivedDate == null ? null : $this->receivedDate;
        $mail .= ", subject=" . $this->subject;
        $mail .= ", content=" . $this->content;
        $mail .= ", author=" . $this->author;
        $mail .= ", created=" . $this->created == null ? null : $this->created;
        $mail .= ", mimeType=" . $this->mimeType;
        $mail .= ", keywords=" . implode(',', $this->keywords);
        $mail .= ", categories=" . implode(',', $this->categories);
        $mail .= ", origin=" . $this->origin;
        $mail .= ", notes=" . implode(',', $this->notes);
        $mail .= ", hasAttachments=" . $this->hasAttachments;
        $mail .=", headers=" . $this->headers;
        $mail .= "}";
        return $mail;
    }

}
