<?php

namespace Database\Seeders;

use App\Models\Faq;
use App\Models\Page;
use App\Models\Pricing;
use App\Models\Setting;
use App\Models\Timeline;
use App\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;

class DatabaseSeeder extends Seeder
{
    public function run(): void
    {
        // Create Admin User
        User::create([
            'name' => 'Admin',
            'email' => 'admin@teflin2026.id',
            'password' => Hash::make('password'),
            'role' => 'admin',
        ]);

        // Create Reviewer User
        User::create([
            'name' => 'Reviewer',
            'email' => 'reviewer@teflin2026.id',
            'password' => Hash::make('password'),
            'role' => 'reviewer',
        ]);


          // Create Panitia User
        User::create([
            'name' => 'Panitia',
            'email' => 'panitia@teflin2026.id',
            'password' => Hash::make('password'),
            'role' => 'user',
        ]);

        // Settings
        $settings = [
            ['key' => 'site_name', 'value' => 'The 72nd TEFLIN International Conference', 'group' => 'general'],
            ['key' => 'site_tagline', 'value' => 'English Language Teaching in the Era of Digital Transformation', 'group' => 'general'],
            ['key' => 'conference_date', 'value' => '2025-12-15', 'group' => 'conference'],
            ['key' => 'conference_end_date', 'value' => '2025-12-17', 'group' => 'conference'],
            ['key' => 'abstract_submission_open', 'value' => 'true', 'group' => 'submission'],
            ['key' => 'full_paper_submission_open', 'value' => 'false', 'group' => 'submission'],
            ['key' => 'contact_email', 'value' => 'info@teflin.org', 'group' => 'contact'],
        ];
        foreach ($settings as $setting) {
            Setting::create($setting);
        }

        // Timeline
        $timelines = [
            ['title' => 'Abstract Submission Opens', 'start_date' => '2025-03-01', 'order' => 1],
            ['title' => 'Abstract Submission Deadline', 'start_date' => '2025-06-30', 'order' => 2],
            ['title' => 'Notification of Acceptance', 'start_date' => '2025-07-31', 'order' => 3],
            ['title' => 'Early Bird Registration', 'start_date' => '2025-08-01', 'end_date' => '2025-09-30', 'order' => 4],
            ['title' => 'Full Paper Submission', 'start_date' => '2025-08-01', 'end_date' => '2025-10-31', 'order' => 5],
            ['title' => 'Regular Registration', 'start_date' => '2025-10-01', 'end_date' => '2025-11-30', 'order' => 6],
            ['title' => 'Conference Date', 'start_date' => '2025-12-15', 'end_date' => '2025-12-17', 'order' => 7],
        ];
        foreach ($timelines as $timeline) {
            Timeline::create($timeline);
        }

        // Pricing
        $pricing = [
            ['category' => 'Presenter (Local)', 'early_bird_price' => 1500000, 'regular_price' => 1750000, 'onsite_price' => 2000000, 'order' => 1],
            ['category' => 'Presenter (International)', 'early_bird_price' => 200, 'regular_price' => 250, 'onsite_price' => 300, 'currency' => 'USD', 'order' => 2],
            ['category' => 'Participant (Local)', 'early_bird_price' => 1000000, 'regular_price' => 1250000, 'onsite_price' => 1500000, 'order' => 3],
            ['category' => 'Participant (International)', 'early_bird_price' => 150, 'regular_price' => 175, 'onsite_price' => 200, 'currency' => 'USD', 'order' => 4],
            ['category' => 'Student', 'early_bird_price' => 500000, 'regular_price' => 750000, 'onsite_price' => 1000000, 'order' => 5],
            ['category' => 'Online Participant', 'early_bird_price' => 300000, 'regular_price' => 400000, 'onsite_price' => 500000, 'order' => 6],
        ];
        foreach ($pricing as $price) {
            Pricing::create($price);
        }

        // Pages
        $pages = [
            ['title' => 'Concept Note', 'slug' => 'concept-note', 'section' => 'about', 'content' => '<p>The 72nd TEFLIN International Conference brings together educators, researchers, and practitioners to discuss the latest developments in English language teaching.</p>', 'order' => 1],
            ['title' => 'Sub-themes', 'slug' => 'sub-themes', 'section' => 'about', 'content' => '<h3>Conference Sub-themes</h3><ul><li>English Language Teaching Methodologies</li><li>Applied Linguistics Research</li><li>Literature and Language Studies</li><li>Translation and Interpretation</li><li>Technology-Enhanced Language Learning</li></ul>', 'order' => 2],
            ['title' => 'About TEFLIN', 'slug' => 'about-teflin', 'section' => 'about', 'content' => '<p>TEFLIN (The Association for the Teaching of English as a Foreign Language in Indonesia) is a professional organization for English language teachers in Indonesia.</p>', 'order' => 3],
            ['title' => 'Committee', 'slug' => 'committee', 'section' => 'about', 'content' => '<p>Meet our organizing committee members.</p>', 'order' => 4],
            ['title' => 'Submission Guidelines', 'slug' => 'submission-guidelines', 'section' => 'call-for-papers', 'content' => '<h3>Guidelines</h3><p>Abstracts should be 200-300 words. Include 3-5 keywords.</p>', 'order' => 1],
            ['title' => 'Timeline', 'slug' => 'timeline', 'section' => 'call-for-papers', 'content' => '<p>Important dates for the conference.</p>', 'order' => 2],
            ['title' => 'Registration Categories', 'slug' => 'registration-categories', 'section' => 'registration', 'content' => '<p>Choose the registration category that applies to you.</p>', 'order' => 1],
            ['title' => 'Pricing Table', 'slug' => 'pricing-table', 'section' => 'registration', 'content' => '<p>Registration fees for the conference.</p>', 'order' => 2],
            ['title' => 'Payment Instructions', 'slug' => 'payment-instructions', 'section' => 'registration', 'content' => '<h3>Bank Transfer</h3><p>Bank: Bank ABC<br>Account: 1234567890<br>Name: TEFLIN Conference</p>', 'order' => 3],
            ['title' => 'Location Info', 'slug' => 'location-info', 'section' => 'venue', 'content' => '<p>The conference will be held in Jakarta, Indonesia.</p>', 'order' => 1],
            ['title' => 'Accommodation', 'slug' => 'accommodation', 'section' => 'venue', 'content' => '<p>Recommended hotels near the venue.</p>', 'order' => 2],
            ['title' => 'Visa Information', 'slug' => 'visa-information', 'section' => 'venue', 'content' => '<p>Visa requirements for international participants.</p>', 'order' => 3],
            ['title' => 'Tourism', 'slug' => 'tourism', 'section' => 'venue', 'content' => '<p>Explore Jakarta and surrounding areas.</p>', 'order' => 4],
            ['title' => 'Explore Jakarta', 'slug' => 'explore-jakarta', 'section' => 'venue', 'content' => '<p>To help you make the most of your stay in Jakarta, we highly recommend experiencing <strong>Jakarta\'s Mass Rapid Transit (MRT)</strong>. As the only system of its kind in Indonesia, the MRT offers a sleek, world-class, and reliable way to bypass the city\'s famous traffic.</p>

<p>Starting from the <strong>Lebak Bulus MRT Station</strong>—conveniently accessible from the conference venue—you can enjoy a fast and comfortable ride directly into the heart of the capital. It serves as the perfect gateway to explore Jakarta\'s vibrant culture, premium shopping districts, and iconic landmarks. Whether you are heading to the bustling city centre or seeking out local hidden gems, the MRT is your most efficient ticket to discovering everything Jakarta has to offer.</p>

<h2>Must-See Stops</h2>

<h3>1. Lebak Bulus Station (The Starting Point)</h3>
<p><strong>Poins Mall:</strong> Accessible via a direct skywalk, this is a convenient spot for quick shopping or grabbing a meal right before or after your commute.</p>

<h3>2. Cipete Raya Station (The "Hipster" Hub)</h3>
<p><strong>Urban Forest Cipete:</strong> A lush, green oasis just a 5-minute walk from the station. It\'s packed with trendy cafes and outdoor seating, making it the perfect spot for a "work-from-cafe" session or a relaxed brunch.</p>

<h3>3. Blok M BCA Station (The Cultural & Culinary Gem)</h3>
<ul>
<li><strong>Little Tokyo:</strong> Step out into a district famous for authentic Japanese ramen houses and izakayas.</li>
<li><strong>M Bloc Space:</strong> A creative hub housed in a repurposed colonial building, featuring indie bookstores, local brands, and live music venues.</li>
<li><strong>Martha Tiahahu Literacy Park:</strong> A beautifully designed park perfect for reading or enjoying the city\'s afternoon vibe.</li>
</ul>

<h3>4. Istora Mandiri Station (Sports & Modernity)</h3>
<ul>
<li><strong>GBK City Forest (Hutan Kota by Plataran):</strong> Often called the "Central Park of Jakarta," this area offers stunning views of the city skyline against a backdrop of rolling green lawns.</li>
<li><strong>Pacific Place & SCBD:</strong> Access Jakarta\'s high-end business district for premium dining and luxury shopping.</li>
</ul>

<h3>5. Bundaran HI Station (The Heart of Jakarta)</h3>
<ul>
<li><strong>The Skydeck:</strong> Head to the second floor of the integrated TransJakarta bus stop for the most iconic photo op of the "Selamat Datang" (Welcome) Monument.</li>
<li><strong>Grand Indonesia & Plaza Indonesia:</strong> Explore two of the country\'s most expansive and prestigious shopping malls, located just steps from the station exits.</li>
<li><strong>Sarinah:</strong> Visit the newly revitalized historic mall, which now serves as a showcase for high-quality Indonesian crafts, textiles, and traditional food.</li>
</ul>

<h2>Other Destinations</h2>
<ul>
<li><strong>Cultural Icons:</strong> Monas, Istiqlal Mosque, Cathedral</li>
<li><strong>Shopping & Culinary:</strong> Grand Indonesia, Pondok Indah Mall, Blok M</li>
<li><strong>Historical Sites:</strong> Kota Tua/Old Town</li>
<li><strong>Green Spaces:</strong> Taman Mini Indonesia Indah</li>
</ul>', 'order' => 5],
        ];
        foreach ($pages as $page) {
            Page::create($page);
        }

        // FAQs
        $faqs = [
            ['question' => 'How do I submit my abstract?', 'answer' => '<p>You can submit your abstract through our online submission portal. Click on "Submit Abstract" in the navigation menu.</p>', 'category' => 'submission', 'order' => 1],
            ['question' => 'What is the abstract word limit?', 'answer' => '<p>Abstracts should be between 200-300 words.</p>', 'category' => 'submission', 'order' => 2],
            ['question' => 'How do I pay the registration fee?', 'answer' => '<p>You can pay via bank transfer. Details are provided in the Payment Instructions page.</p>', 'category' => 'payment', 'order' => 3],
            ['question' => 'Can I get a refund?', 'answer' => '<p>Refund policy will be announced soon.</p>', 'category' => 'payment', 'order' => 4],
            ['question' => 'Is there a virtual attendance option?', 'answer' => '<p>Yes, we offer online participation for those who cannot attend in person.</p>', 'category' => 'general', 'order' => 5],
        ];
        foreach ($faqs as $faq) {
            Faq::create($faq);
        }

        // Navigation
        $this->call(NavigationSeeder::class);
        
        // Settings and Sub-Themes
        $this->call(SettingsSeeder::class);
        
        // Page Sections (Categories)
        $this->call(PageSectionSeeder::class);
        
        // Speaker Types
        $this->call(SpeakerTypeSeeder::class);
    }
}
