// import { HttpException, HttpStatus, Injectable } from '@nestjs/common';
// import { JwtService } from '@nestjs/jwt';
// import * as random_string from 'randomstring'
// import { ConfigService } from '@nestjs/config';
// import * as nodemailer from "nodemailer";
// import { CommonService } from './common.service';
// import * as fs from 'fs'
// import * as path from 'path'
// // import {} from '../../public/templates/'
// @Injectable()
// export class SendNotification {
//     // private nodemailer_email
//     // private nodemailer_password
//     constructor(
//         private readonly CommonService: CommonService,
//         // private readonly Model: ModelService,
//         // private readonly ConfigService:ConfigService
//     ) {

//     }

//     send_welcome_email = async (user_dto: any) => {
//         try {
//             let { email, name } = user_dto;

//             let file_path = path.resolve(__dirname, '../../templates', 'welcome.html');
//             console.log("file_path...", file_path)
//             let html = fs.readFileSync(file_path, { encoding: 'utf-8' });

//             let set_name = name != null ? name : "User";
//             let subject = `Welcome to Abundish - Get Started Today!`;
//             html = html.replace('%USER_NAME1%', set_name)
//             html = html.replace('%USER_NAME2%', set_name)
//             await this.CommonService.send_email(email, subject, html);
//         }
//         catch (err) {
//             throw err;
//         }
//     }

//     send_otp_to_user = async (user_dto: any) => {
//         try {
//             let { email, email_otp, name: user_name } = user_dto;
//             let digits = email_otp.toString().split('');

//             // let subject = `Your OTP for Together We Can Registration`;
//             let subject = `Your OTP for Abundish  Registration`;

//             let file_path = path.resolve(__dirname, '../../templates', 'email_verification.html');
//             let html = fs.readFileSync(file_path, { encoding: 'utf-8' });
//             html = html.replace('%USER_NAME%', user_name);
//             html = html.replace('%OTP_1%', digits[0]);
//             html = html.replace('%OTP_2%', digits[1]);
//             html = html.replace('%OTP_3%', digits[2]);
//             html = html.replace('%OTP_4%', digits[3]);
//             await this.CommonService.send_email(email, subject, html);
//         }
//         catch (err) {
//             throw err;
//         }
//     }

//     resend_otp_email = async (user_dto: any) => {
//         try {
//             let { email, email_otp, user_name } = user_dto;
//             let digits = email_otp.toString().split('');

//             let subject = `Your New OTP for Abundish Store Registration`;
//             let file_path = path.resolve(__dirname, '../../templates', 'email_verification.html');
//             let html = fs.readFileSync(file_path, { encoding: 'utf-8' });

//             html = html.replace('%USER_NAME%', user_name);
//             html = html.replace('%OTP_1%', digits[0]);
//             html = html.replace('%OTP_2%', digits[1]);
//             html = html.replace('%OTP_3%', digits[2]);
//             html = html.replace('%OTP_4%', digits[3]);
//             // await this.CommonService.send_email(email, subject, html);
//         }
//         catch (err) {
//             throw err;
//         }
//     }

//     forgot_password_mail = async (user_dto: any) => {
//         let { email, email_otp, name } = user_dto;
//         let subject = `Reset Your Password - Abundish Store`;
//         try {
//             let file_path = path.resolve(__dirname, '../../templates', 'reset_password.html');
//             let html = fs.readFileSync(file_path, { encoding: 'utf-8' });
//             let digits = email_otp.toString().split('');

//             html = html.replace('%USER_NAME%', name);
//             html = html.replace('%OTP_1%', digits[0]);
//             html = html.replace('%OTP_2%', digits[1]);
//             html = html.replace('%OTP_3%', digits[2]);
//             html = html.replace('%OTP_4%', digits[3]);
//             await this.CommonService.send_email(email, subject, html);
//         }
//         catch (err) {
//             throw err;
//         }
//     }

//     resend_forgot_password_mail = async (user_dto: any) => {
//         let { email, forgot_password_otp, user_name } = user_dto;
//         let subject = `Resend OTP to Reset Your Password - Abundish Store`;
//         try {
//             let file_path = path.resolve(__dirname, '../../templates', 'reset_password.html');
//             let html = fs.readFileSync(file_path, { encoding: 'utf-8' });
//             let digits = forgot_password_otp.toString().split('');

//             html = html.replace('%USER_NAME%', user_name);
//             html = html.replace('%OTP_1%', digits[0]);
//             html = html.replace('%OTP_2%', digits[1]);
//             html = html.replace('%OTP_3%', digits[2]);
//             html = html.replace('%OTP_4%', digits[3]);
//             // await this.CommonService.send_email(email, subject, html)
//         }
//         catch (err) {
//             throw err;
//         }
//     }

// }
