<?php
include_once '../../config/root_path.php';
require_once '../MailTemplate.php';

$basePath = ROOT_PATH . '/api/mail_templates';

$lang     = $_GET['lang'] ?? 'id';
$template = $_GET['template'] ?? 'verify_register';

$mail = new MailTemplate($basePath);

$dummyData = [
    'LogoURL'            => 'https://dummyimage.com/200x60/000/fff&text=LOGO',
    'CompanyName'        => 'Padel Indonesia',
    'CompanyAddress'     => 'Jakarta',
    'CompanyPhone'       => '08123456789',
    'CompanyEmail'       => 'info@mail.com',
    'CurrentYear'        => date('Y'),

    'NamaCustomer'       => 'Budi Hartono',
    'OrderID'            => 'ORDER-123456',
    'TotalPembayaran'    => 'Rp 150.000',
    'PaymentMethod'      => 'QRIS',
    'TanggalBayar'       => date('d M Y H:i'),
    'URLLinkVerifikasi'  => '#'
];

try {
    echo $mail->render($template, $dummyData, $lang);
} catch (Exception $e) {
    echo $e->getMessage();
}