# Copyright (c) 2015, XhiveFramework Technologies and contributors
# License: MIT. See LICENSE

import xhiveframework
from xhiveframework.model.document import Document


class EmailQueueRecipient(Document):
	DOCTYPE = "Email Queue Recipient"

	def is_mail_to_be_sent(self):
		return self.status == "Not Sent"

	def is_main_sent(self):
		return self.status == "Sent"

	def update_db(self, commit=False, **kwargs):
		xhiveframework.db.set_value(self.DOCTYPE, self.name, kwargs)
		if commit:
			xhiveframework.db.commit()
