from email.message import EmailMessage

from pydantic import EmailStr

from app.config import settings


def create_registration_confirmation_template(
        username: str,
        email_to: EmailStr,
        confirmation_code: str,
):
    email = EmailMessage()

    email["Subject"] = "Подтверждение регистрации"
    email["From"] = settings.SMTP_USER
    email["To"] = email_to

    email.set_content(
        f"""
             <h1>{username}, лови аптечку</h1>
             <h2>{confirmation_code}</h2>
        """,
        subtype="html"
    )
    return email
