from smtplib import SMTP
from email.message import Message
from django.conf import settings
import os, logging

logging.basicConfig(
    level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s"
)


def send_email(subject, content, to_emails, cc=None):
    email_msg = Message()
    email_msg["Subject"] = subject
    email_msg["From"] = "no-reply@dexterton.com"
    email_msg["To"] = to_emails

    if cc is not None:
        email_msg["Cc"] = cc

    email_msg.set_type("text/html")
    email_msg.set_payload(content)
    mail_server = SMTP(os.getenv("TEMP_SMTP_HOST"), os.getenv("TEMP_SMTP_PORT"))

    mail_server.ehlo()
    mail_server.send_message(msg=email_msg)
    mail_server.quit()


def inquiry_sender_copy(details):
    email = details.get("email")
    name = details.get("name")
    product = details.get("product")
    product_subcategory = details.get("product_subcategory")
    inquiry = details.get("inquiry")

    logging.info(f"Sending email copy of product inquiry to {email}...")

    content = f"""
        <div style="font-family: Arial, sans-serif; max-width: 600px; margin: auto; padding: 40px; background-color: #ffffff;">
            <div style="text-align: center;">
                <img src="https://assets.unlayer.com/projects/265721/1747377812014-caracolelogo.png" alt="caracole logo" style="max-width: 200px; margin-bottom: 20px;">
            </div>

            <p style="color: #555555; font-size: 14px; margin-top: 20px;">
                Hi { name },
            </p>

            <p style="color: #555555; font-size: 14px;">
                Thank you for your interest in <i><b>{ product }</b></i> from { product_subcategory } category. We have received your inquiry submitted through our Caracole website and will get back to you shortly.
            </p>

            <p style="color: #c2883d; font-weight: bold; font-size: 14px; margin-top: 20px;">
                Here are the details of your inquiry:
            </p>

            <p style="color: #555555; font-size: 14px;">
                { inquiry }
            </p>

            <p style="color: #555555; font-size: 14px; margin-top: 40px;">
                We appreciate your patience and look forward to assisting you.
            </p>

            <hr style="margin: 30px 0; border: none; border-top: 1px solid #cccccc;" />

            <p style="font-size: 13px; color: #999999;">
                Caracole Philippines |
                <a href="https://caracole.ph/" style="color: #c2883d; text-decoration: none;">https://caracole.ph/</a> |
                <a href="mailto:info@dexterton.com" style="color: #c2883d; text-decoration: none;">info@dexterton.com</a>
            </p>

            <p style="color: #555555; font-size: 13px; line-height: 1.6;">
                <strong>(02) 8362-1111 | 0917-8583858<br />
                (02) 8772-2029 | 0917-5942563</strong>
            </p>

            <div style="margin-top: 20px;">
                <a href="https://www.facebook.com/caracolephilippines" target="_blank" style="margin-right: 10px;">
                    <img src="https://cdn.tools.unlayer.com/social/icons/rounded/facebook.png" alt="Facebook" style="width: 30px; height: 30px;" />
                </a>
                <a href="https://www.instagram.com/caracoleph/?hl=en" target="_blank">
                    <img src="https://cdn.tools.unlayer.com/social/icons/rounded/instagram.png" alt="Instagram" style="width: 30px; height: 30px;" />
                </a>
            </div>
        </div>
    """

    send_email(
        subject=f"Your '{product}' Inquiry - Caracole Philippines",
        content=content,
        to_emails=email,
    )


def inquirer_receiver_copy(details):
    name = details.get("name")
    email = details.get("email")
    contact_number = details.get("contact_number")
    date = details.get("created_at").strftime("%B %d, %Y")
    product = details.get("product")
    inquiry = details.get("inquiry")

    logging.info(f"Sending email copy of product inquiry by {email} to receivers...")

    content = f"""
        <div style="font-family: Arial, sans-serif; max-width: 600px; margin: auto; padding: 20px; background-color: #ffffff; border: 1px solid #ddd; border-radius: 6px;">
            <div style="text-align: center;">
                <img src="https://assets.unlayer.com/projects/265721/1747377812014-caracolelogo.png" alt="caracole logo" style="max-width: 200px; margin-bottom: 20px;">
            </div>

            <h2 style="color: #d69c54; font-size: 20px;">Inquiry From { name }</h2>

            <p style="font-size: 14px; color: #000000;">
                <strong>Sender's Email:</strong> { email }<br>
                <strong>Sender's Contact Number:</strong> { contact_number }<br>
                <strong>Date Inquired:</strong> { date }<br>
                <strong>Product to Inquire:</strong> { product }
            </p>

            <p style="font-size: 14px; color: #000000;">
                { inquiry }
            </p>

            <hr style="margin: 30px 0; border: none; border-top: 1px solid #ccc;">

            <p style="font-size: 13px; color: #000000; text-align: center;">
                Caracole Philippines | <a href="https://caracole.ph/" style="color: #d69c54; text-decoration: none;">https://caracole.ph/</a> | 
                <a href="mailto:info@dexterton.com" style="color: #d69c54; text-decoration: none;">info@dexterton.com</a>
            </p>

            <p style="font-size: 13px; color: #000000; text-align: center;">
                <strong>(02) 8362-1111</strong> | <strong>0917-8583858</strong><br>
                <strong>(02) 8772-2029</strong> | <strong>0917-5942563</strong>
            </p>

            <div style="text-align: center; margin-top: 10px;">
                <a href="https://www.facebook.com/caracolephilippines" style="margin-right: 10px;">
                    <img src="https://cdn.tools.unlayer.com/social/icons/rounded/facebook.png" alt="Facebook" style="width: 24px; height: 24px;">
                </a>
                <a href="https://www.instagram.com/caracoleph/?hl=en">
                    <img src="https://cdn.tools.unlayer.com/social/icons/rounded/instagram.png" alt="Instagram" style="width: 24px; height: 24px;">
                </a>
            </div>
        </div>
    """

    to_emails = ", ".join(settings.INQUIRY_RECEIVER)
    send_email(
        subject=f"Product Inquiry From {email}",
        content=content,
        to_emails=to_emails,
        cc=settings.EMAIL_WEBDEV,
    )


def appointment_sender_copy(details):
    name = f"{details["first_name"]} {details["last_name"]}"
    email = details.get("email")
    contact_number = details.get("contact_number")
    company_name = details.get("company_name")
    branch = details.get("branch")
    date_and_time = details.get("date_and_time").strftime("%B %-d, %Y, %-I:%M%p")

    logging.info(f"Sending email copy of appointment to {email}...")

    content = f"""
        <div style="font-family: Arial, sans-serif; max-width: 600px; margin: auto; padding: 20px; background-color: #ffffff; border: 1px solid #ddd; border-radius: 6px;">
            <div style="text-align: center;">
                <img src="https://assets.unlayer.com/projects/265721/1747377812014-caracolelogo.png" alt="caracole logo" style="max-width: 200px; margin-bottom: 20px;">
            </div>

            <h2 style="color: #d69c54; font-size: 20px;">Thank You For Your Appointment!</h2>

            <p style="font-size: 14px; color: #000000;">
                Hi { name },
            </p>

            <p style="font-size: 14px; color: #000000;">
                We have received your appointment request submitted through our Caracole website. We will contact you shortly to finalize the scheduling. Below are the appointment details you provided.
            </p>

            <h3 style="color: #d69c54; font-size: 16px;">Your Appointment Details:</h3>

            <p style="font-size: 14px; color: #000000;">
                <strong>Name:</strong> { name }<br>
                <strong>Email Address:</strong> { email }<br>
                <strong>Contact Number:</strong> { contact_number }<br>
                <strong>Company Name:</strong> { company_name }<br>
                <strong>Branch to visit:</strong> { branch }<br>
                <strong>Date & Time:</strong> { date_and_time }
            </p>

            <hr style="margin: 30px 0; border: none; border-top: 1px solid #ccc;">

            <p style="font-size: 13px; color: #000000; text-align: center;">
                Caracole Philippines | <a href="https://caracole.ph/" style="color: #d69c54; text-decoration: none;">https://caracole.ph/</a> |
                <a href="mailto:info@dexterton.com" style="color: #d69c54; text-decoration: none;">info@dexterton.com</a>
            </p>

            <p style="font-size: 13px; color: #000000; text-align: center;">
                <strong>(02) 8362-1111</strong> | <strong>0917-8583858</strong><br>
                <strong>(02) 8772-2029</strong> | <strong>0917-5942563</strong>
            </p>

            <div style="text-align: center; margin-top: 10px;">
                <a href="https://www.facebook.com/caracolephilippines" style="margin-right: 10px;">
                    <img src="https://cdn.tools.unlayer.com/social/icons/rounded/facebook.png" alt="Facebook" style="width: 24px; height: 24px;">
                </a>
                <a href="https://www.instagram.com/caracoleph/?hl=en">
                    <img src="https://cdn.tools.unlayer.com/social/icons/rounded/instagram.png" alt="Instagram" style="width: 24px; height: 24px;">
                </a>
            </div>
        </div>
    """

    send_email(
        subject="Caracole Appointment Request Received",
        content=content,
        to_emails=email,
    )


def appointment_receiver_copy(details):
    name = f"{details["first_name"]} {details["last_name"]}"
    email = details.get("email")
    contact_number = details.get("contact_number")
    company_name = details.get("company_name")
    branch = details.get("branch")
    date_and_time = details.get("date_and_time").strftime("%B %-d, %Y, %-I:%M%p")

    logging.info(f"Sending email copy of appointment by {email} to receivers...")

    content = f"""
        <div style="font-family: Arial, sans-serif; max-width: 600px; margin: auto; padding: 30px; background-color: #ffffff; border: 1px solid #ddd; border-radius: 6px; text-align: center;">
            <div style="text-align: center;">
                <img src="https://assets.unlayer.com/projects/265721/1747377812014-caracolelogo.png" alt="caracole logo" style="max-width: 200px; margin-bottom: 20px;">
            </div>

            <h2 style="text-align: left; color: #4a4a4a; font-size: 20px; font-weight: bold;">Showroom Appointment from { name }</h2>

            <h3 style="text-align: left; color: #d69c54; font-size: 18px; font-weight: bold; margin-top: 30px;">Appointment Details</h3>

            <p style="font-size: 14px; color: #4a4a4a; text-align: left; margin-top: 20px;">
                <strong>Name:</strong> { name }<br>
                <strong>Email Address:</strong> { email }<br>
                <strong>Contact Number:</strong> { contact_number }<br>
                <strong>Company Name:</strong> { company_name }<br>
                <strong>Branch to visit:</strong> { branch }<br>
                <strong>Date & Time:</strong> { date_and_time }
            </p>

            <hr style="margin: 30px 0; border: none; border-top: 1px solid #ccc;">

            <p style="font-size: 13px; color: #777;">
                Caracole Philippines |
                <a href="https://caracole.ph/" style="color: #d69c54; text-decoration: none;">https://caracole.ph/</a> |
                <a href="mailto:info@dexterton.com" style="color: #d69c54; text-decoration: none;">info@dexterton.com</a>
            </p>

            <p style="font-size: 14px; color: #4a4a4a; font-weight: bold; margin-top: 10px;">
                (02) 8362-1111 | 0917-8583858<br>
                (02) 8772-2029 | 0917-5942563
            </p>

            <div style="text-align: center; margin-top: 10px;">
                <a href="https://www.facebook.com/caracolephilippines" style="margin-right: 10px;">
                    <img src="https://cdn.tools.unlayer.com/social/icons/rounded/facebook.png" alt="Facebook" style="width: 24px; height: 24px;">
                </a>
                <a href="https://www.instagram.com/caracoleph/?hl=en">
                    <img src="https://cdn.tools.unlayer.com/social/icons/rounded/instagram.png" alt="Instagram" style="width: 24px; height: 24px;">
                </a>
            </div>
        </div>
    """

    to_emails = ", ".join(settings.INQUIRY_RECEIVER)
    send_email(
        subject=f"Appointment From { email }",
        content=content,
        to_emails=to_emails,
        cc=settings.EMAIL_WEBDEV,
    )


def contact_us_sender_copy(details):
    email = details.get("email")
    name = f"{details["first_name"]} {details["last_name"]}"
    inquiry = details.get("inquiry")

    logging.info(f"Sending email copy of inquiry to {email}...")

    content = f"""
        <div style="font-family: Arial, sans-serif; max-width: 600px; margin: auto; padding: 30px; background-color: #ffffff; border: 1px solid #ddd; border-radius: 6px; text-align: center;">
            <div style="text-align: center;">
                <img src="https://assets.unlayer.com/projects/265721/1747377812014-caracolelogo.png" alt="caracole logo" style="max-width: 200px; margin-bottom: 20px;">
            </div>

            <p style="font-size: 14px; color: #4a4a4a; text-align: left;">
                Hi { name },
            </p>

            <p style="font-size: 14px; color: #4a4a4a; text-align: left;">
                We have received your inquiry submitted through our Caracole website and will get back to you shortly.
            </p>

            <p style="font-size: 14px; color: #d69c54; font-weight: bold; text-align: left;">
                Here are the details of your inquiry:
            </p>

            <p style="font-size: 14px; color: #4a4a4a; text-align: left;">
                { inquiry }
            </p>

            <p style="font-size: 14px; color: #4a4a4a; text-align: left; margin-top: 30px;">
                We appreciate your patience and look forward to assisting you.
            </p>

            <hr style="margin: 30px 0; border: none; border-top: 1px solid #ccc;">

            <p style="font-size: 13px; color: #777;">
                Caracole Philippines |
                <a href="https://caracole.ph/" style="color: #d69c54; text-decoration: none;">https://caracole.ph/</a> |
                <a href="mailto:info@dexterton.com" style="color: #d69c54; text-decoration: none;">info@dexterton.com</a>
            </p>

            <p style="font-size: 14px; color: #4a4a4a; font-weight: bold; margin-top: 10px;">
                (02) 8362-1111 | 0917-8583858<br>
                (02) 8772-2029 | 0917-5942563
            </p>

            <div style="text-align: center; margin-top: 10px;">
                <a href="https://www.facebook.com/caracolephilippines" style="margin-right: 10px;">
                    <img src="https://cdn.tools.unlayer.com/social/icons/rounded/facebook.png" alt="Facebook" style="width: 24px; height: 24px;">
                </a>
                <a href="https://www.instagram.com/caracoleph/?hl=en">
                    <img src="https://cdn.tools.unlayer.com/social/icons/rounded/instagram.png" alt="Instagram" style="width: 24px; height: 24px;">
                </a>
            </div>
        </div>
    """

    send_email(
        subject="Thank you for your Inquiry - Caracole Philippines",
        content=content,
        to_emails=email,
    )


def contact_us_receiver_copy(details):
    email = details.get("email")
    name = f"{details["first_name"]} {details["last_name"]}"
    inquiry = details.get("inquiry")
    contact_number = details.get("contact_number")

    logging.info(f"Sending email copy of inquiry by {email} to receivers...")

    content = f"""
        <div style="font-family: Arial, sans-serif; max-width: 600px; margin: auto; padding: 30px; background-color: #ffffff; border: 1px solid #ddd; border-radius: 6px; text-align: center;">
            <div style="text-align: center;">
                <img src="https://assets.unlayer.com/projects/265721/1747377812014-caracolelogo.png" alt="caracole logo" style="max-width: 200px; margin-bottom: 20px;">
            </div>

            <p style="font-size: 16px; color: #4a4a4a; text-align: left;">
                You've received a new inquiry through <strong>Contact Us</strong> form
            </p>

            <h3 style="color: #d69c54; font-size: 16px; text-align: left;">Sender's Details:</h3>

            <p style="font-size: 14px; color: #4a4a4a; text-align: left;">
                <strong>Name:</strong> { name }<br>
                <strong>Email:</strong> { email }<br>
                <strong>Contact Number:</strong> { contact_number }
            </p>

            <h3 style="color: #d69c54; font-size: 16px; text-align: left;">Inquiry</h3>

            <p style="font-size: 14px; color: #4a4a4a; text-align: left;">
                { inquiry }
            </p>

            <hr style="margin: 30px 0; border: none; border-top: 1px solid #ccc;">

            <p style="font-size: 13px; color: #777;">
                Caracole Philippines |
                <a href="https://caracole.ph/" style="color: #d69c54; text-decoration: none;">https://caracole.ph/</a> |
                <a href="mailto:info@dexterton.com" style="color: #d69c54; text-decoration: none;">info@dexterton.com</a>
            </p>

            <p style="font-size: 14px; color: #4a4a4a; font-weight: bold; margin-top: 10px;">
                (02) 8362-1111 | 0917-8583858<br>
                (02) 8772-2029 | 0917-5942563
            </p>

            <div style="text-align: center; margin-top: 10px;">
                <a href="https://www.facebook.com/caracolephilippines" style="margin-right: 10px;">
                    <img src="https://cdn.tools.unlayer.com/social/icons/rounded/facebook.png" alt="Facebook" style="width: 24px; height: 24px;">
                </a>
                <a href="https://www.instagram.com/caracoleph/?hl=en">
                    <img src="https://cdn.tools.unlayer.com/social/icons/rounded/instagram.png" alt="Instagram" style="width: 24px; height: 24px;">
                </a>
            </div>
        </div>
    """

    to_emails = ", ".join(settings.INQUIRY_RECEIVER)
    send_email(
        subject="New General Inquiry Received via Contact Us Form",
        content=content,
        to_emails=to_emails,
        cc=settings.EMAIL_WEBDEV,
    )


def staff_invitation_email(details):
    email = details.get("email")
    name = details.get("name")
    role = details.get("role")
    registration_link = details.get("url")

    content = f"""
        <div style="font-family: Arial, sans-serif; max-width: 600px; margin: auto; padding: 30px; background-color: #ffffff; border: 1px solid #ddd; border-radius: 6px; text-align: center;">
            <div style="text-align: center;">
                <img src="https://assets.unlayer.com/projects/265721/1747377812014-caracolelogo.png" alt="caracole logo" style="max-width: 200px; margin-bottom: 20px;">
            </div>

            <p style="font-size: 14px; color: #4a4a4a; text-align: left;">
                Hi { name },
            </p>

            <p style="font-size: 14px; color: #4a4a4a; text-align: left;">
                You've been invited to join as a/an <strong><em>{ role }</em></strong> of the Caracole PH. To complete your registration, just click the button below and fill the additional details.
            </p>

            <a href="{ registration_link }" style="display: inline-block; margin: 20px 0; padding: 10px 20px; background-color: #000000; color: #ffffff; text-decoration: none; border-radius: 4px; font-weight: bold;">
                Register Now
            </a>

            <p style="font-size: 12px; color: #888888;">
                If the button does not work, <a href="{ registration_link }" style="color: #d69c54; text-decoration: none;">click here</a>
            </p>

            <p style="font-size: 14px; color: #4a4a4a; text-align: left;">
                For any questions, feel free to reach out to <b>webdev@dexterton.com</b>.
            </p>

            <hr style="margin: 30px 0; border: none; border-top: 1px solid #ccc;">

            <p style="font-size: 13px; color: #777;">
                Caracole Philippines |
                <a href="https://caracole.ph/" style="color: #d69c54; text-decoration: none;">https://caracole.ph/</a> |
                <a href="mailto:info@dexterton.com" style="color: #d69c54; text-decoration: none;">info@dexterton.com</a>
            </p>

            <p style="font-size: 14px; color: #4a4a4a; font-weight: bold; margin-top: 10px;">
                (02) 8362-1111 | 0917-8583858<br>
                (02) 8772-2029 | 0917-5942563
            </p>

            <div style="text-align: center; margin-top: 10px;">
                <a href="https://www.facebook.com/caracolephilippines" style="margin-right: 10px;">
                    <img src="https://cdn.tools.unlayer.com/social/icons/rounded/facebook.png" alt="Facebook" style="width: 24px; height: 24px;">
                </a>
                <a href="https://www.instagram.com/caracoleph/?hl=en">
                    <img src="https://cdn.tools.unlayer.com/social/icons/rounded/instagram.png" alt="Instagram" style="width: 24px; height: 24px;">
                </a>
            </div>
        </div>
    """

    send_email(
        subject="Account Invitation",
        content=content,
        to_emails=email,
    )


def user_registration_notification_email(details):
    name = f"{details["first_name"]} {details["last_name"]}"
    email = details.get("email")
    mobile_number = details.get("mobile_number")
    birthdate = details.get("birthdate").strftime("%B %-d, %Y, %-I:%M%p")
    company = details.get("company")
    company_address = details.get("company_address")
    company_website = details.get("company_website")
    touchpoint = details.get("touchpoint")
    how_did_you_know = details.get("how_did_you_know")

    content = f"""
        <div style="font-family: Arial, sans-serif; max-width: 600px; margin: auto; padding: 30px; background-color: #ffffff; border: 1px solid #ddd; border-radius: 6px; text-align: left;">
            <div style="text-align: center;">
                <img src="https://assets.unlayer.com/projects/265721/1747377812014-caracolelogo.png" alt="caracole logo" style="max-width: 200px; margin-bottom: 20px;">
            </div>

            <p style="font-size: 14px; color: #4a4a4a;">
                A potential designer has registered to Caracole PH! Below are his/her details:
            </p>

            <p style="font-size: 14px; color: #4a4a4a; line-height: 1.8;">
                <strong>Name:</strong> { name }<br>
                <strong>Email:</strong> { email }<br>
                <strong>Mobile Number:</strong> { mobile_number }<br>
                <strong>Birthdate:</strong> { birthdate }<br>
                <strong>Company:</strong> { company }<br>
                <strong>Company Address:</strong> { company_address }<br>
                <strong>Company Website:</strong> { company_website }<br>
                <strong>Touchpoint:</strong> { touchpoint }<br>
                <strong>How did you know about Caracole?</strong> { how_did_you_know }
            </p>

            <p style="font-size: 14px; color: #4a4a4a; margin-top: 20px;">
                Make sure to check it out and see if another designer is in sight!
            </p>

            <hr style="margin: 30px 0; border: none; border-top: 1px solid #ccc;">

            <p style="font-size: 13px; color: #777; text-align: center;">
                Caracole Philippines |
                <a href="https://caracole.ph/" style="color: #d69c54; text-decoration: none;">https://caracole.ph/</a> |
                <a href="mailto:info@dexterton.com" style="color: #d69c54; text-decoration: none;">info@dexterton.com</a>
            </p>

            <p style="font-size: 14px; color: #4a4a4a; font-weight: bold; text-align: center;">
                (02) 8362-1111 | 0917-8583858<br>
                (02) 8772-2029 | 0917-5942563
            </p>

           <div style="text-align: center; margin-top: 10px;">
                <a href="https://www.facebook.com/caracolephilippines" style="margin-right: 10px;">
                    <img src="https://cdn.tools.unlayer.com/social/icons/rounded/facebook.png" alt="Facebook" style="width: 24px; height: 24px;">
                </a>
                <a href="https://www.instagram.com/caracoleph/?hl=en">
                    <img src="https://cdn.tools.unlayer.com/social/icons/rounded/instagram.png" alt="Instagram" style="width: 24px; height: 24px;">
                </a>
            </div>
        </div>
    """

    to_emails = ", ".join(settings.INQUIRY_RECEIVER)
    send_email(
        subject="Caracole Designer Registration",
        content=content,
        to_emails=to_emails,
        cc=settings.EMAIL_WEBDEV,
    )


def designer_invitation_email(details):
    email = details.get("email")
    name = details.get("name")
    caracole_url = "https://caracole.ph/"

    content = f"""
        <div style="font-family: Arial, sans-serif; max-width: 600px; margin: auto; padding: 30px; background-color: #ffffff; border: 1px solid #ddd; border-radius: 6px; text-align: left;">
            <div style="text-align: center;">
                <img src="https://assets.unlayer.com/projects/265721/1747377812014-caracolelogo.png" alt="caracole logo" style="max-width: 200px; margin-bottom: 20px;">
            </div>

            <p style="font-size: 14px; color: #4a4a4a;">
                Hi { name },
            </p>

            <p style="font-size: 14px; color: #4a4a4a;">
                Upon registering, you've been approved and given access to the Caracole PH where you can explore our current products and other articles related to Caracole. Just login and start exploring the Caracole PH Website.
            </p>

            <p style="font-size: 14px; color: #4a4a4a;">
                To visit the website, click this link: 
                <a href="{ caracole_url }" style="color: #d69c54; text-decoration: none;">{ caracole_url }</a>
            </p>

            <p style="font-size: 14px; color: #4a4a4a;">
                Thank you!
            </p>

            <hr style="margin: 30px 0; border: none; border-top: 1px solid #ccc;">

            <p style="font-size: 13px; color: #777; text-align: center;">
                Caracole Philippines |
                <a href="https://caracole.ph/" style="color: #d69c54; text-decoration: none;">https://caracole.ph/</a> |
                <a href="mailto:info@dexterton.com" style="color: #d69c54; text-decoration: none;">info@dexterton.com</a>
            </p>

            <p style="font-size: 14px; color: #4a4a4a; font-weight: bold; text-align: center;">
                (02) 8362-1111 | 0917-8583858<br>
                (02) 8772-2029 | 0917-5942563
            </p>

            <div style="text-align: center; margin-top: 10px;">
                <a href="https://www.facebook.com/caracolephilippines" style="margin-right: 10px;">
                    <img src="https://cdn.tools.unlayer.com/social/icons/rounded/facebook.png" alt="Facebook" style="width: 24px; height: 24px;">
                </a>
                <a href="https://www.instagram.com/caracoleph/?hl=en">
                    <img src="https://cdn.tools.unlayer.com/social/icons/rounded/instagram.png" alt="Instagram" style="width: 24px; height: 24px;">
                </a>
            </div>
        </div>
    """

    send_email(
        subject="Welcome to Caracole PH",
        content=content,
        to_emails=email,
    )


def reset_password_email(details):
    email = details.get("email")
    reset_link = details.get("link")

    content = f"""
        <div style="font-family: Arial, sans-serif; max-width: 600px; margin: auto; padding: 40px; background-color: #ffffff;">
            <div style="text-align: center;">
                <h1 style="color: #000000; font-size: 32px; margin-bottom: 0;">FORGOT</h1>
                <h2 style="color: #000000; font-size: 24px; margin-top: 0;">YOUR PASSWORD?</h2>
            </div>

            <p style="color: #555555; font-size: 14px; text-align: center; margin-top: 20px;">
                Do not worry, we got you! Let's get you a new password.
            </p>

            <div style="text-align: center; margin-top: 30px;">
                <a href="{ reset_link }" style="background-color: #f08373; color: #ffffff; padding: 15px 25px; font-size: 16px; border-radius: 10px; text-decoration: none; display: inline-block;">
                Reset Password
                </a>
            </div>

            <p style="color: #555555; font-size: 14px; text-align: center; margin-top: 30px;">
                Button not working? Copy this link then paste it to the URL bar:<br />
                <span style="color: #f08373;">{ reset_link }</span>
            </p>

            <p style="color: #999999; font-size: 12px; text-align: center; margin-top: 40px;">
                If it is not you who requested it, please ignore this email.
            </p>
        </div>
    """

    send_email(
        subject="Reset Your Password",
        content=content,
        to_emails=email,
    )
