from typing import Optional, List, Any
from datetime import datetime

from ....core.interfaces.dto import Dto
from ....core.interfaces.core import Core
from ....enums.touch.emails import EmailProvider

from .smtp import EmailSmtp, EmailSmtpDto


class Email[Properties: Any](Core[Properties]):
  provider: EmailProvider

  to: List[str]
  cc: Optional[List[str]]
  bcc: Optional[List[str]]

  # from: str
  subject: str

  html: Optional[str]
  text: Optional[str]

  date: Optional[datetime]
  reply_to: Optional[List[str]]  # Email Address
  in_reply_to: Optional[str]  # Message ID

  attachments: Optional[List[str]]

  smtp: Optional[EmailSmtp]


# ----------------------------------------
# Data Transfer Object Interface
# ----------------------------------------


class EmailDto[Properties: Any](Dto[Properties]):
  provider: EmailProvider

  to: List[str]
  cc: Optional[List[str]]
  bcc: Optional[List[str]]

  # from: str
  subject: str

  html: Optional[str]
  text: Optional[str]

  date: Optional[datetime]
  reply_to: Optional[List[str]]  # Email Address
  in_reply_to: Optional[str]  # Message ID

  attachments: Optional[List[str]]

  smtp: Optional[EmailSmtpDto]


class EmailSendDto[Properties: Any](Dto[Properties]):
  provider: Optional[EmailProvider]

  to: List[str]
  cc: Optional[List[str]]
  bcc: Optional[List[str]]

  # from: str
  subject: str

  html: Optional[str]
  text: Optional[str]

  date: Optional[datetime]
  reply_to: Optional[List[str]]  # Email Address
  in_reply_to: Optional[str]  # Message ID

  attachments: Optional[List[str]]

  smtp: Optional[EmailSmtpDto]
