package email

import (
	"fmt"
	"strings"
)

const mylomen_code_email_template = `<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>code</title>
    <style>
         @font-face{
            font-family:Montserrat-Bold;
            src: url('https://cdn.shopifycdn.net/s/files/1/0592/3766/2905/files/Montserrat-Bold.otf?v=1678861979');
        }
        @font-face{
            font-family:Montserrat-Medium;
            src: url('https://cdn.shopify.com/s/files/1/0592/3766/2905/files/Montserrat-Medium.otf?v=1680083530');
        }
        @font-face{
            font-family:DINCond-Bold;
            src: url('https://cdn.shopify.com/s/files/1/0592/3766/2905/files/DINCond-Bold_e86b57e0-624c-475b-b6ed-00d5538b9a0e.otf?v=1680260215');
        }
        *{
            margin: 0;
            padding: 0;
        }
        .code{
            background: #F3F3F7;
        }
        .code_con{
            width: 600px;
            height: 100vh;
            margin: auto;
        }
        .navigation_bar{
            width: 100%%;
            height: 8px;
            background: #A1F200;
        }
        .icon{
            width: 120px;
            margin: auto;
            padding-top: 14px;
        }
        .icon img{
            width: 100%%;
        }
        .freebeat_img{
            width: 100px;
            margin: auto;
            padding-top: 61px;
        }
        .freebeat_img img{
            width: 100%%;
        }
        .verification{
            margin:60px 25px 0 25px;
            background: #FFFFFF;
            border-radius: 20px 20px 20px 20px;
        }
        .verification .title{
            font-size: 20px;
            font-family: Montserrat-Bold, Montserrat;
            font-weight: bold;
            color: #121212;
            line-height: 20px;
            text-align: center;
            padding-top: 34px;
        }
        .verification .num{
            margin:30px 85px;
            background: #F7F7F7;
            border-radius: 14px 14px 14px 14px;
        }
        .verification .num p{
            font-size: 60px;
            font-family: DINCond-Bold-Regular, DINCond-Bold;
            font-weight: 400;
            color: #121212;
            line-height: 60px;
            padding: 20px 0;
            text-align: center;
        }
        .verification .desc{
            font-size: 14px;
            font-family: Montserrat-Medium, Montserrat;
            font-weight: 500;
            color: #121212;
            line-height: 18px;
            text-align: center;
            padding: 0 138px 30px 138px;
            opacity: 0.5;
        }
        .important{
            margin-top: 40px;
            margin-left: 25px;
        }
        .important .title{
            font-size: 18px;
            font-family: Montserrat-Bold, Montserrat;
            font-weight: bold;
            color: #121212;
            line-height: 18px;
            margin-bottom: 14px;
        }
        .important .desc{
            font-size: 14px;
            font-family: Montserrat-Medium, Montserrat;
            font-weight: 500;
            color: #000000;
            line-height: 20px;
        }
        .bottom{
            width: 100%%;
            height: 48px;
            background: #FFFFFF;
            margin-top: 63px;
        }
        .bottom .con{
            padding: 18px 162px;
            display: flex;
            justify-content: space-between;
        }
        .bottom .con a{
            font-size: 12px;
            font-family: Montserrat-Medium, Montserrat;
            font-weight: 500;
            color: #121212;
            line-height: 12px;
            opacity: 0.8;
            text-decoration: underline;
        }
        @media screen and (max-width: 640px){
            .code_con{
                width: 100%%;
            }
            .navigation_bar{
                height: 5px;
            }
            .icon{
                width: 75px;
                padding-top: 9px;
            }
            .freebeat_img{
                width: 63px;
                padding-top: 38px;
            }      
            .verification{
                margin:38px 16px 0 16px;
                border-radius: 13px 13px 13px 13px;
            }
            .verification .title{
                font-size: 13px;
                line-height: 13px;
                padding-top: 21px;
            }
            .verification .num{
                margin:19px 53px;
                border-radius: 9px 9px 9px 9px;
            }
            .verification .num p{
                font-size: 38px;
                line-height: 38px;
                padding: 13px 0;
            }
            .verification .desc{
                font-size: 9px;
                line-height: 11px;  
                padding: 0 86px 19px 86px;
            }
            .important{
                margin-top: 25px;
                margin-left: 16px;
            }
            .important .title{
                font-size: 11px;
                line-height: 11px;
                margin-bottom: 9px;
            }
            .important .desc{
                font-size: 9px;
                line-height: 13px;
            }
            .bottom{
                height: 30px;           
                margin-top: 39px;
            }
            .bottom .con{
                padding: 11px 80px;
            }
            .bottom .con a{
                font-size: 8px;            
                line-height: 8px;
            }
        }
    </style>
</head>
<body>
    <div class="code">
        <div class="code_con">
            <div class="navigation_bar"></div>
            <div class="verification">
                <div class="title">Your verification code to reset your password</div>
                <div class="num"><p>%s</p></div>
                <div class="desc">Please complete the account verification process in one hours!</div>
            </div>
            <div class="important">
                <div class="title">IMPORTANT:</div>
                <div class="desc">
                    Please do not share this email with anyone!<br>
                    This email was automatically generated, please do not reply.<br>
                    If you do not know why you have received this email, please discard it.
                </div>
            </div>
            <div class="bottom">
                <div class="con">
                    <a href="https://mylomen.com//#/privacyPolicy">Privacy Policy</a>
                    <a href="https://mylomen.com//#/serviceTerms">Terms of Service</a>
                </div>
            </div>
        </div>
    </div>
</body>
</html>`

func SendEmailVerifyCodeByEmail(code string, address ...string) error {
	content := fmt.Sprintf(mylomen_code_email_template, strings.TrimSpace(code))
	return sendNoticeEmail(
		"🎉 Your verification code to reset your password",
		content,
		address...)
}