<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\ContentSection;
use App\Models\Statistic;
use App\Models\AdminUser;
use Illuminate\Support\Facades\Hash;

class ContentSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        // Create default admin user
        AdminUser::updateOrCreate(
            ['email' => 'admin@lecl.com'],
            [
                'name' => 'Admin User',
                'password' => Hash::make('admin123'),
                'role' => 'super_admin',
                'is_active' => true
            ]
        );

        // Create hero section content
        ContentSection::updateOrCreate(
            ['section_key' => 'hero'],
            [
                'title' => 'Opening Doors to Global Education',
                'content' => 'Empowering students worldwide with premier educational opportunities across the UK, South Asia, Africa, and Europe. Your gateway to academic excellence and global success.',
                'is_active' => true,
                'sort_order' => 1
            ]
        );

        // Create about section content
        ContentSection::updateOrCreate(
            ['section_key' => 'about'],
            [
                'title' => 'About LECL',
                'content' => 'London Education and Consulting LTD (LECL) is a premier international student recruitment agency with offices strategically located across the UK, South Asia, Africa, and Europe.',
                'is_active' => true,
                'sort_order' => 2
            ]
        );

        // Create Unparalleled Guidance section
        ContentSection::updateOrCreate(
            ['section_key' => 'guidance_experts'],
            [
                'title' => 'Unparalleled Guidance from Education Experts',
                'content' => 'Our team of seasoned education consultants brings decades of experience in international education. We provide personalized guidance tailored to your academic goals and career aspirations.',
                'data' => [
                    'features' => [
                        [
                            'icon' => 'bi-mortarboard-fill',
                            'title' => 'Expert Counselors',
                            'description' => 'Certified education consultants with extensive knowledge of global universities and admission requirements.'
                        ],
                        [
                            'icon' => 'bi-globe',
                            'title' => 'Global Network',
                            'description' => 'Direct partnerships with top universities across UK, Europe, Australia, and North America.'
                        ],
                        [
                            'icon' => 'bi-award-fill',
                            'title' => 'Proven Success',
                            'description' => 'Over 95% success rate in university admissions with scholarship opportunities.'
                        ]
                    ]
                ],
                'is_active' => true,
                'sort_order' => 3
            ]
        );

        // Create Destinations section
        ContentSection::updateOrCreate(
            ['section_key' => 'destinations'],
            [
                'title' => 'Study Destinations',
                'content' => 'Explore world-class education opportunities across our partner countries.',
                'data' => [
                    'countries' => [
                        [
                            'name' => 'United Kingdom',
                            'flag' => '🇬🇧',
                            'universities' => 150,
                            'description' => 'Home to world-renowned institutions like Oxford, Cambridge, and Imperial College.'
                        ],
                        [
                            'name' => 'Australia',
                            'flag' => '🇦🇺',
                            'universities' => 85,
                            'description' => 'Leading universities with excellent research facilities and post-study work opportunities.'
                        ],
                        [
                            'name' => 'Canada',
                            'flag' => '🇨🇦',
                            'universities' => 120,
                            'description' => 'Quality education with affordable tuition and immigration-friendly policies.'
                        ],
                        [
                            'name' => 'United States',
                            'flag' => '🇺🇸',
                            'universities' => 200,
                            'description' => 'Diverse academic programs at top-ranked universities with extensive scholarship options.'
                        ]
                    ]
                ],
                'is_active' => true,
                'sort_order' => 4
            ]
        );

        // Create Why Select LECL section
        ContentSection::updateOrCreate(
            ['section_key' => 'why_lecl'],
            [
                'title' => 'Why Select LECL?',
                'content' => 'Choose LECL for comprehensive support throughout your educational journey.',
                'data' => [
                    'benefits' => [
                        [
                            'icon' => 'bi-shield-check',
                            'title' => 'Trusted Partner',
                            'description' => 'Official representative of 300+ universities worldwide with verified credentials.'
                        ],
                        [
                            'icon' => 'bi-cash-coin',
                            'title' => 'No Hidden Fees',
                            'description' => 'Transparent pricing with no hidden charges. Free consultation and application support.'
                        ],
                        [
                            'icon' => 'bi-headset',
                            'title' => '24/7 Support',
                            'description' => 'Round-the-clock assistance from application to graduation and beyond.'
                        ],
                        [
                            'icon' => 'bi-graph-up-arrow',
                            'title' => 'Career Guidance',
                            'description' => 'Post-graduation career support and job placement assistance in your chosen field.'
                        ]
                    ]
                ],
                'is_active' => true,
                'sort_order' => 5
            ]
        );

        // Create Testimonials section
        ContentSection::updateOrCreate(
            ['section_key' => 'testimonials'],
            [
                'title' => 'Student Success Stories',
                'content' => 'Hear from our successful students who achieved their dreams with LECL.',
                'data' => [
                    'testimonials' => [
                        [
                            'name' => 'Sarah Ahmed',
                            'university' => 'University of Oxford',
                            'course' => 'MSc Computer Science',
                            'country' => 'UK',
                            'rating' => 5,
                            'comment' => 'LECL made my dream of studying at Oxford a reality. Their guidance throughout the application process was exceptional.'
                        ],
                        [
                            'name' => 'Michael Chen',
                            'university' => 'University of Toronto',
                            'course' => 'MBA',
                            'country' => 'Canada',
                            'rating' => 5,
                            'comment' => 'The team at LECL provided excellent support from application to visa processing. Highly recommended!'
                        ],
                        [
                            'name' => 'Priya Patel',
                            'university' => 'University of Melbourne',
                            'course' => 'Bachelor of Medicine',
                            'country' => 'Australia',
                            'rating' => 5,
                            'comment' => 'Thanks to LECL, I am now studying medicine at one of Australia\'s top universities. Their expertise is unmatched.'
                        ]
                    ]
                ],
                'is_active' => true,
                'sort_order' => 6
            ]
        );

        // Create Trusted Partners section
        ContentSection::updateOrCreate(
            ['section_key' => 'trusted_partners'],
            [
                'title' => 'Our Trusted University Partners',
                'content' => 'We work directly with leading universities to provide you with the best opportunities.',
                'data' => [
                    'partners' => [
                        [
                            'name' => 'University of Oxford',
                            'country' => 'United Kingdom',
                            'logo' => 'oxford-logo.png',
                            'ranking' => 1
                        ],
                        [
                            'name' => 'University of Cambridge',
                            'country' => 'United Kingdom',
                            'logo' => 'cambridge-logo.png',
                            'ranking' => 2
                        ],
                        [
                            'name' => 'Imperial College London',
                            'country' => 'United Kingdom',
                            'logo' => 'imperial-logo.png',
                            'ranking' => 3
                        ],
                        [
                            'name' => 'University of Toronto',
                            'country' => 'Canada',
                            'logo' => 'toronto-logo.png',
                            'ranking' => 18
                        ],
                        [
                            'name' => 'University of Melbourne',
                            'country' => 'Australia',
                            'logo' => 'melbourne-logo.png',
                            'ranking' => 14
                        ],
                        [
                            'name' => 'University of Sydney',
                            'country' => 'Australia',
                            'logo' => 'sydney-logo.png',
                            'ranking' => 19
                        ]
                    ]
                ],
                'is_active' => true,
                'sort_order' => 7
            ]
        );

        // Create Impact Numbers section
        ContentSection::updateOrCreate(
            ['section_key' => 'impact_numbers'],
            [
                'title' => 'Our Impact in Numbers',
                'content' => 'See the difference we\'ve made in students\' lives worldwide.',
                'data' => [
                    'statistics' => [
                        [
                            'number' => '300+',
                            'label' => 'University Partners',
                            'description' => 'Direct partnerships with top universities worldwide'
                        ],
                        [
                            'number' => '50+',
                            'label' => 'Countries Covered',
                            'description' => 'Global reach across all major study destinations'
                        ],
                        [
                            'number' => '95%',
                            'label' => 'Success Rate',
                            'description' => 'Students successfully placed in their preferred universities'
                        ]
                    ]
                ],
                'is_active' => true,
                'sort_order' => 8
            ]
        );

        // Create statistics
        $statistics = [
            [
                'title' => 'Students Served',
                'icon' => 'bi-people-fill',
                'value' => 15422,
                'sort_order' => 1
            ],
            [
                'title' => 'Courses Offered',
                'icon' => 'bi-book-fill',
                'value' => 5946,
                'sort_order' => 2
            ],
            [
                'title' => 'Recruiting Partners',
                'icon' => 'bi-building',
                'value' => 311,
                'sort_order' => 3
            ],
            [
                'title' => 'Student Satisfaction',
                'icon' => 'bi-emoji-smile-fill',
                'value' => 93,
                'suffix' => '%',
                'sort_order' => 4
            ]
        ];

        foreach ($statistics as $stat) {
            Statistic::create($stat);
        }
    }
}
