<?php

namespace Database\Seeders;

use App\Models\Category;
use App\Models\Page;
use App\Models\Service;
use App\Models\Setting;
use App\Models\User;
use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    public function run(): void
    {
        User::factory()->create([
            'name' => 'Admin',
            'email' => 'admin@autodiag.com',
            'password' => bcrypt('password'),
            'role' => 'admin',
            'is_active' => true,
        ]);

        User::factory()->create([
            'name' => 'John Customer',
            'email' => 'customer@autodiag.com',
            'password' => bcrypt('password'),
            'role' => 'customer',
            'is_active' => true,
        ]);

        User::factory()->create([
            'name' => 'Mike Technician',
            'email' => 'technician@autodiag.com',
            'password' => bcrypt('password'),
            'role' => 'technician',
            'is_active' => true,
        ]);

        $categories = [
            ['name' => 'Agricultural', 'icon' => '&#127793;', 'description' => 'Diagnostic software and parts for tractors, harvesters, and farm equipment'],
            ['name' => 'Automotive', 'icon' => '&#128663;', 'description' => 'Diagnostics and software for cars, SUVs, and light commercial vehicles'],
            ['name' => 'Controllers', 'icon' => '&#9881;', 'description' => 'ECU controllers, modules, and programming tools'],
            ['name' => 'Crane', 'icon' => '&#9974;', 'description' => 'Diagnostic solutions for crane and lifting equipment'],
            ['name' => 'Forklift', 'icon' => '&#128666;', 'description' => 'Forklift diagnostics, parts, and service software'],
            ['name' => 'Generator Sets', 'icon' => '&#9889;', 'description' => 'Generator set diagnostics, controllers, and maintenance tools'],
            ['name' => 'Heavy Equipment', 'icon' => '&#9874;', 'description' => 'Construction and industrial machinery diagnostics'],
            ['name' => 'Marine', 'icon' => '&#9973;', 'description' => 'Marine engine diagnostics and software solutions'],
            ['name' => 'Others', 'icon' => '&#128194;', 'description' => 'Other diagnostic tools, adapters, and accessories'],
            ['name' => 'Transmission', 'icon' => '&#9881;', 'description' => 'Transmission diagnostics, reprogramming, and parts'],
            ['name' => 'Truck & Heavy Truck', 'icon' => '&#128741;', 'description' => 'Truck diagnostics, software, and repair solutions'],
        ];

        foreach ($categories as $cat) {
            Category::create($cat);
        }

        $services = [
            ['title' => 'Diagnostics', 'slug' => 'diagnostics', 'icon' => '&#128300;', 'description' => 'Advanced computer diagnostics for all vehicle types. We use state-of-the-art equipment to identify issues quickly and accurately.', 'order' => 1],
            ['title' => 'Calibration', 'slug' => 'calibration', 'icon' => '&#9881;', 'description' => 'Professional calibration services for sensors, cameras, radar systems, and engine control units to ensure optimal performance.', 'order' => 2],
            ['title' => 'Maintenance', 'slug' => 'maintenance', 'icon' => '&#128295;', 'description' => 'Comprehensive maintenance services including oil changes, filter replacement, fluid checks, and preventive care programs.', 'order' => 3],
            ['title' => 'Reprogramming', 'slug' => 'reprogramming', 'icon' => '&#128187;', 'description' => 'ECU reprogramming and software updates for improved performance, fuel efficiency, and compliance with latest standards.', 'order' => 4],
            ['title' => 'Repair', 'slug' => 'repair', 'icon' => '&#128736;', 'description' => 'Expert repair services for engines, transmissions, brakes, electrical systems, and more by certified technicians.', 'order' => 5],
            ['title' => 'Spare Parts', 'slug' => 'spare-parts', 'icon' => '&#128230;', 'description' => 'Genuine OEM and high-quality aftermarket spare parts for all vehicle types at competitive prices with fast delivery.', 'order' => 6],
        ];

        foreach ($services as $service) {
            Service::create($service);
        }

        Page::create(['title' => 'About Us', 'slug' => 'about', 'content' => 'AutoDiag is a premier provider of automotive diagnostics, calibration, maintenance, reprogramming, and spare parts services. Founded by industry experts with decades of experience, we serve a wide range of vehicles including light vehicles, heavy vehicles, agricultural machinery, heavy equipment, trucks, and engines.

Our team of certified technicians uses the latest diagnostic equipment and follows manufacturer specifications to ensure the highest quality of service. We are committed to keeping your vehicles running at peak performance.

## Why Choose AutoDiag?

- **Expert Technicians**: Our team is highly trained and certified
- **State-of-the-Art Equipment**: We use the latest diagnostic technology
- **Comprehensive Services**: From diagnostics to spare parts, we cover everything
- **Quality Parts**: We use only genuine OEM and high-quality parts
- **Customer Satisfaction**: Your satisfaction is our top priority

Contact us today to schedule a service or browse our product catalog for genuine spare parts.', 'is_active' => true, 'order' => 1]);

        Setting::setValue('site_name', 'AutoDiag', 'general');
        Setting::setValue('site_description', 'Professional auto diagnostics, calibration, maintenance & spare parts', 'general');
        Setting::setValue('contact_email', 'info@autodiag.com', 'general');
        Setting::setValue('contact_phone', '+1 (234) 567-890', 'general');
        Setting::setValue('address', '123 Automotive Street, Tech City, TC 12345', 'general');
        Setting::setValue('primary_color', '#f0c040', 'design');
        Setting::setValue('secondary_color', '#1a1a2e', 'design');
        Setting::setValue('accent_color', '#d4a830', 'design');
        Setting::setValue('hero_title', 'Professional Auto Diagnostics & Repair', 'design');
        Setting::setValue('hero_subtitle', 'Expert diagnostics, calibration, maintenance, and reprogramming services for all vehicle types. Premium quality spare parts and certified technicians.', 'design');
        Setting::setValue('about_title', 'About AutoDiag', 'design');
        Setting::setValue('about_content', 'AutoDiag is your trusted partner for professional vehicle diagnostics, calibration, maintenance, reprogramming, and spare parts. We serve light vehicles, heavy vehicles, agricultural machinery, heavy equipment, trucks, and engines with premium quality service and products.', 'design');
        Setting::setValue('footer_text', 'Built with precision. Driven by excellence.', 'design');
        Setting::setValue('facebook', '#', 'social');
        Setting::setValue('twitter', '#', 'social');
        Setting::setValue('instagram', '#', 'social');
        Setting::setValue('youtube', '#', 'social');
        Setting::setValue('linkedin', '#', 'social');
    }
}
