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

import jingrow
from jingrow.model.page import Page


class UnhandledEmail(Page):
	# begin: auto-generated types
	# This code is auto-generated. Do not modify anything in this block.

	from typing import TYPE_CHECKING

	if TYPE_CHECKING:
		from jingrow.types import DF

		email_account: DF.Link | None
		message_id: DF.Code | None
		raw: DF.Code | None
		reason: DF.LongText | None
		uid: DF.Data | None
	# end: auto-generated types

	@staticmethod
	def clear_old_logs(days=30):
		jingrow.db.delete(
			"Unhandled Email",
			{
				"modified": ("<", jingrow.utils.add_days(jingrow.utils.nowdate(), -1 * days)),
			},
		)
