<?php

class Mail_Templates
{
    // 检查使用邮件发送模板
    public function Templates($type, $G_user)
    {
        if ($type == 'miss') {
            return $this->MissYou($G_user);
        } elseif ($type == 'over_miss') {
            return $this->MissYouOver($G_user);
        }
    }

    /**
     * @param string $G_user 邮件昵称
     * @return string 返回HTML
     */
    private function MissYou(string $G_user): string
    {
        $G_year = date('Y');
        $G_date = date("Y-m-d H:i:s");
        return <<<EOF
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml">
            <head>
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
                <title>XF_TLS_MAIL</title>
                <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
            </head>
            <table align="center" border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse;border: 1px solid #cccccc;box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175)">
                <tr>
                    <td align="center" bgcolor="#70bbd9" style="padding: 30px 0 30px 0;">
                        <img src="https://www.na-wen.love/sources/img/BigLogo.png" alt="EmailLogo" width="358.2" height="97.8" style="display: block;" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <table border="0" cellpadding="0" cellspacing="0" width="100%" style="padding: 30px 30px 30px 30px;">
                            <tr>
                                <td style="padding: 10px 0px 30px 0px;color: #08212b; font-family: Arial, sans-serif; font-size: 10px;">
                                    时间： <font style="font-family: var(--bs-font-monospace)">$G_date</font>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding: 0px 0px 10px 0px;color: #000000; font-family: Arial, sans-serif; font-size: 24px;">
                                    Dear. $G_user
                                </td>
                            </tr>
                            <tr>
                                <td style="padding: 0px 5px 5px 0px;color: #000000; font-family: Arial, sans-serif; font-size: 16px;">
                                    你的崽崽想你啦~快去回想她一下吧！<br/>
                                    <a href="https://www.na-wen.love/tools/miss_you.php" style="text-decoration: none;color: #198754;">去想想TA</a>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td bgcolor="#f0f0f0" style="padding: 30px 20px 30px 20px;">
                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                                <td style="font-family: Arial, sans-serif; font-size: 14px;">
                                    <font style="color: grey;">&copy; 2022 - $G_year <a style="text-decoration: none;color: #198754;" href="https://www.na-wen.love/">青空</a> All Rights Reserved.</font><br/>
                                    <font style="color: grey;">本邮件为 <a href="https://www.x-lf.com" style="text-decoration: none;color: #198754;">XF_Mail</a> 自动发出，请勿直接回复</font>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            <tr>
                <td style="padding: 30px 0 20px 0;"></td>
            </tr>
            </html>
            EOF;
    }

    private function MissYouOver(string $G_user): string
    {
        $G_year = date('Y');
        $G_date = date("Y-m-d H:i:s");
        return <<<EOF
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml">
            <head>
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
                <title>XF_TLS_MAIL</title>
                <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
            </head>
            <table align="center" border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse;border: 1px solid #cccccc;box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175)">
                <tr>
                    <td align="center" bgcolor="#70bbd9" style="padding: 30px 0 30px 0;">
                        <img src="https://www.na-wen.love/sources/img/BigLogo.png" alt="EmailLogo" width="358.2" height="97.8" style="display: block;" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <table border="0" cellpadding="0" cellspacing="0" width="100%" style="padding: 30px 30px 30px 30px;">
                            <tr>
                                <td style="padding: 10px 0px 30px 0px;color: #08212b; font-family: Arial, sans-serif; font-size: 10px;">
                                    时间： <font style="font-family: var(--bs-font-monospace)">$G_date</font>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding: 0px 0px 10px 0px;color: #000000; font-family: Arial, sans-serif; font-size: 24px;">
                                    Dear. $G_user
                                </td>
                            </tr>
                            <tr>
                                <td style="padding: 0px 5px 5px 0px;color: #000000; font-family: Arial, sans-serif; font-size: 16px;">
                                    你的崽崽今天也想你啦~ 两个人要天天想念彼此哦~
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td bgcolor="#f0f0f0" style="padding: 30px 20px 30px 20px;">
                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                                <td style="font-family: Arial, sans-serif; font-size: 14px;">
                                    <font style="color: grey;">&copy; 2022 - $G_year <a style="text-decoration: none;color: #198754;" href="https://www.na-wen.love/">青空</a> All Rights Reserved.</font><br/>
                                    <font style="color: grey;">本邮件为 <a href="https://www.x-lf.com" style="text-decoration: none;color: #198754;">XF_Mail</a> 自动发出，请勿直接回复</font>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            <tr>
                <td style="padding: 30px 0 20px 0;"></td>
            </tr>
            </html>
            EOF;
    }
}