<?php

namespace Database\Seeders;

use App\Models\EmailTemplate;
use Illuminate\Database\Seeder;

class EmailTemplateSeeder extends Seeder
{
    public function run(): void
    {
        $templates = [
            [
                'name' => 'Abstract Submission Confirmation',
                'slug' => 'abstract_submission_confirmation',
                'subject' => 'Abstract Received - {{abstract_title}}',
                'description' => 'Sent when a user submits a new abstract',
                'body' => '
<p>Dear <strong>{{user_name}}</strong>,</p>

<p>Thank you for submitting your abstract to the <strong>TEFLIN International Conference 2026</strong>.</p>

<p>We have successfully received your submission with the following details:</p>

<ul>
    <li><strong>Submission ID:</strong> {{submission_id}}</li>
    <li><strong>Title:</strong> {{abstract_title}}</li>
    <li><strong>Submission Date:</strong> {{submission_date}}</li>
</ul>

<p>Your abstract is now in our system and will be reviewed by our scientific committee. You will receive another email notification once the review process is complete.</p>

<p><strong>What happens next?</strong></p>
<ol>
    <li>Our reviewers will evaluate your abstract (typically within 4-6 weeks)</li>
    <li>You will receive a notification about the acceptance decision</li>
    <li>If accepted, you will be invited to register and submit your full paper</li>
</ol>

<p>If you have any questions, please do not hesitate to contact us.</p>

<p>Best regards,<br>
<strong>TEFLIN Conference 2026 Committee</strong></p>
',
                'is_active' => true,
                'available_variables' => [
                    'user_name' => 'Full name of the submitter',
                    'user_email' => 'Email of the submitter',
                    'submission_id' => 'Unique submission reference number',
                    'abstract_title' => 'Title of the submitted abstract',
                    'submission_date' => 'Date and time of submission',
                ],
            ],
            [
                'name' => 'Abstract Accepted',
                'slug' => 'abstract_accepted',
                'subject' => 'Congratulations! Your Abstract Has Been Accepted - {{abstract_title}}',
                'description' => 'Sent when an abstract is approved by reviewers',
                'body' => '
<p>Dear <strong>{{user_name}}</strong>,</p>

<p>We are pleased to inform you that your abstract has been <strong>ACCEPTED</strong> for presentation at the <strong>TEFLIN International Conference 2026</strong>.</p>

<p><strong>Submission Details:</strong></p>
<ul>
    <li><strong>Submission ID:</strong> {{submission_id}}</li>
    <li><strong>Title:</strong> {{abstract_title}}</li>
</ul>

<p><strong>Next Steps:</strong></p>
<ol>
    <li>Complete your conference registration before the deadline</li>
    <li>Prepare and submit your full paper (if applicable)</li>
    <li>Prepare your presentation materials</li>
</ol>

<p>Please visit our website to complete your registration and view important deadlines.</p>

<p>Congratulations again, and we look forward to seeing you at the conference!</p>

<p>Best regards,<br>
<strong>TEFLIN Conference 2026 Committee</strong></p>
',
                'is_active' => true,
                'available_variables' => [
                    'user_name' => 'Full name of the submitter',
                    'submission_id' => 'Unique submission reference number',
                    'abstract_title' => 'Title of the submitted abstract',
                ],
            ],
            [
                'name' => 'Abstract Rejected',
                'slug' => 'abstract_rejected',
                'subject' => 'Abstract Review Result - {{abstract_title}}',
                'description' => 'Sent when an abstract is rejected',
                'body' => '
<p>Dear <strong>{{user_name}}</strong>,</p>

<p>Thank you for your interest in the <strong>TEFLIN International Conference 2026</strong>.</p>

<p>After careful review by our scientific committee, we regret to inform you that your abstract titled "<strong>{{abstract_title}}</strong>" (Submission ID: {{submission_id}}) has not been accepted for this conference.</p>

<p>Please note that this decision does not reflect on the quality of your research. Due to the high number of submissions we received, we were unable to accommodate all proposals.</p>

<p>We encourage you to consider submitting to future TEFLIN conferences.</p>

<p>Thank you for your understanding.</p>

<p>Best regards,<br>
<strong>TEFLIN Conference 2026 Committee</strong></p>
',
                'is_active' => true,
                'available_variables' => [
                    'user_name' => 'Full name of the submitter',
                    'submission_id' => 'Unique submission reference number',
                    'abstract_title' => 'Title of the submitted abstract',
                ],
            ],
            [
                'name' => 'Abstract Revision Required',
                'slug' => 'abstract_revision_required',
                'subject' => 'Revision Required for Your Abstract - {{abstract_title}}',
                'description' => 'Sent when reviewers request revisions to an abstract',
                'body' => '
<p>Dear <strong>{{user_name}}</strong>,</p>

<p>Thank you for your submission to the <strong>TEFLIN International Conference 2026</strong>.</p>

<p>Our reviewers have evaluated your abstract and would like to request some revisions before a final decision can be made.</p>

<p><strong>Submission Details:</strong></p>
<ul>
    <li><strong>Submission ID:</strong> {{submission_id}}</li>
    <li><strong>Title:</strong> {{abstract_title}}</li>
</ul>

<p><strong>Reviewer Comments:</strong></p>
<blockquote>{{reviewer_comments}}</blockquote>

<p>Please submit your revised abstract by <strong>{{revision_deadline}}</strong>.</p>

<p>If you have any questions about the requested revisions, please contact us.</p>

<p>Best regards,<br>
<strong>TEFLIN Conference 2026 Committee</strong></p>
',
                'is_active' => true,
                'available_variables' => [
                    'user_name' => 'Full name of the submitter',
                    'submission_id' => 'Unique submission reference number',
                    'abstract_title' => 'Title of the submitted abstract',
                    'reviewer_comments' => 'Feedback from reviewers',
                    'revision_deadline' => 'Deadline for submitting revision',
                ],
            ],
            [
                'name' => 'Registration Confirmation',
                'slug' => 'registration_confirmation',
                'subject' => 'Registration Confirmed - TEFLIN Conference 2026',
                'description' => 'Sent when a user completes their conference registration',
                'body' => '
<p>Dear <strong>{{user_name}}</strong>,</p>

<p>Your registration for the <strong>TEFLIN International Conference 2026</strong> has been confirmed!</p>

<p><strong>Registration Details:</strong></p>
<ul>
    <li><strong>Registration ID:</strong> {{registration_id}}</li>
    <li><strong>Registration Type:</strong> {{registration_type}}</li>
    <li><strong>Amount Paid:</strong> {{amount_paid}}</li>
</ul>

<p><strong>Conference Details:</strong></p>
<ul>
    <li><strong>Date:</strong> October 7-9, 2026</li>
    <li><strong>Venue:</strong> UIN Ar-Raniry, Banda Aceh, Indonesia</li>
</ul>

<p>Please keep this email for your records. You will receive additional information about the conference schedule and venue closer to the event date.</p>

<p>We look forward to welcoming you!</p>

<p>Best regards,<br>
<strong>TEFLIN Conference 2026 Committee</strong></p>
',
                'is_active' => true,
                'available_variables' => [
                    'user_name' => 'Full name of the registrant',
                    'registration_id' => 'Unique registration reference',
                    'registration_type' => 'Type of registration (Early Bird, Regular, etc.)',
                    'amount_paid' => 'Total amount paid',
                ],
            ],
        ];

        foreach ($templates as $template) {
            EmailTemplate::updateOrCreate(
                ['slug' => $template['slug']],
                $template
            );
        }
    }
}
