<?php

namespace Database\Seeders;

use App\Models\Product;
use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    use WithoutModelEvents;

    public function run(): void
    {
        // Admin User
        User::factory()->create([
            'name'     => 'Admin User',
            'email'    => 'admin@autopart.com',
            'is_admin' => true,
        ]);

        // Default test user
        User::factory()->create([
            'name'     => 'Test User',
            'email'    => 'test@example.com',
            'is_admin' => false,
        ]);

        // Seed products
        $products = [
            [
                'name'        => 'Heavy Duty Aluminum Radiator',
                'category'    => 'Engine Parts',
                'brand'       => 'Mishimoto',
                'description' => 'High-performance aluminum radiator engineered for maximum cooling efficiency. Direct-fit replacement for easy installation.',
                'price'       => 134.99,
                'old_price'   => 155.00,
                'stock'       => 25,
                'image_path'  => '324a18f241fb7b3d1fad3ab47ca5aeaa.jpg',
                'is_new'      => true,
                'rating'      => 4.80,
                'num_reviews' => 87,
            ],
            [
                'name'        => 'Assorted Automotive Fuse Kit',
                'category'    => 'Electrical',
                'brand'       => 'Bussmann',
                'description' => 'Complete fuse assortment kit with multiple amperage ratings. Essential for every vehicle toolkit.',
                'price'       => 15.50,
                'old_price'   => null,
                'stock'       => 100,
                'image_path'  => '341fbb0976be66c1c36fd01a5b73ab10.jpg',
                'is_new'      => false,
                'rating'      => 5.00,
                'num_reviews' => 124,
            ],
            [
                'name'        => 'Iridium Spark Plugs Set of 4',
                'category'    => 'Engine Parts',
                'brand'       => 'NGK',
                'description' => 'Premium iridium spark plugs for improved ignition performance and fuel efficiency. Long-lasting design.',
                'price'       => 29.99,
                'old_price'   => null,
                'stock'       => 80,
                'image_path'  => 'IMG-20260320-WA0004.jpg',
                'is_new'      => false,
                'rating'      => 4.50,
                'num_reviews' => 56,
            ],
            [
                'name'        => 'Ceramic Front Brake Pads',
                'category'    => 'Brakes & Rotors',
                'brand'       => 'Brembo',
                'description' => 'High-performance ceramic brake pads with low dust and noise-free operation. Perfect for daily driving and spirited performance.',
                'price'       => 55.00,
                'old_price'   => 70.00,
                'stock'       => 40,
                'image_path'  => 'IMG-20260320-WA0005.jpg',
                'is_new'      => false,
                'rating'      => 4.20,
                'num_reviews' => 93,
            ],
            [
                'name'        => 'High Flow Engine Air Filter',
                'category'    => 'Maintenance',
                'brand'       => 'K&N',
                'description' => 'Washable and reusable high-flow air filter that increases horsepower and acceleration while providing excellent engine protection.',
                'price'       => 24.50,
                'old_price'   => null,
                'stock'       => 60,
                'image_path'  => 'IMG-20260320-WA0007.jpg',
                'is_new'      => true,
                'rating'      => 4.00,
                'num_reviews' => 45,
            ],
            [
                'name'        => 'OEM Replacement Headlight Assembly',
                'category'    => 'Lighting',
                'brand'       => 'TYC',
                'description' => 'Direct replacement headlight assembly that matches OEM quality and fitment. Clear lens with DOT/SAE compliance.',
                'price'       => 118.99,
                'old_price'   => null,
                'stock'       => 15,
                'image_path'  => '32bfd2fbca80bd42ab0467a4a293e40a.jpg',
                'is_new'      => false,
                'rating'      => 4.70,
                'num_reviews' => 67,
            ],
            [
                'name'        => 'All-Weather Floor Mats Set Black',
                'category'    => 'Interior Accessories',
                'brand'       => 'WeatherTech',
                'description' => 'Custom-fit all-weather floor mats that provide excellent coverage and protection. Deep channels to trap water, mud, and debris.',
                'price'       => 45.00,
                'old_price'   => 50.00,
                'stock'       => 35,
                'image_path'  => '446d6a2c0a73288a4e104521e0d936ac.jpg',
                'is_new'      => false,
                'rating'      => 4.90,
                'num_reviews' => 110,
            ],
            [
                'name'        => 'High-Torque Starter Motor',
                'category'    => 'Engine Parts',
                'brand'       => 'Denso',
                'description' => 'Powerful starter motor for reliable cold-weather starts. Remanufactured to OEM specifications with all components tested.',
                'price'       => 145.99,
                'old_price'   => null,
                'stock'       => 20,
                'image_path'  => 'IMG-20260320-WA0008.jpg',
                'is_new'      => false,
                'rating'      => 4.60,
                'num_reviews' => 78,
            ],
            [
                'name'        => 'Performance Aluminum Radiator',
                'category'    => 'Engine Parts',
                'brand'       => 'Koyorad',
                'description' => 'Lightweight polished aluminum radiator with increased core capacity for superior cooling. Track-ready performance.',
                'price'       => 189.99,
                'old_price'   => 220.00,
                'stock'       => 10,
                'image_path'  => '324a18f241fb7b3d1fad3ab47ca5aeaa.jpg',
                'is_new'      => false,
                'rating'      => 4.90,
                'num_reviews' => 52,
            ],
            [
                'name'        => 'Mini Blade Fuses 100-Pack',
                'category'    => 'Electrical',
                'brand'       => 'Littelfuse',
                'description' => 'Bulk pack of mini blade fuses in assorted amperages. Industry-standard construction for automotive applications.',
                'price'       => 12.00,
                'old_price'   => null,
                'stock'       => 200,
                'image_path'  => '341fbb0976be66c1c36fd01a5b73ab10.jpg',
                'is_new'      => false,
                'rating'      => 4.80,
                'num_reviews' => 98,
            ],
            [
                'name'        => 'Platinum Spark Plug 4-Pack',
                'category'    => 'Engine Parts',
                'brand'       => 'Bosch',
                'description' => 'Bosch Platinum spark plugs with fine-wire center electrode for enhanced ignitability and longer service life.',
                'price'       => 32.50,
                'old_price'   => null,
                'stock'       => 70,
                'image_path'  => 'IMG-20260320-WA0010.jpg',
                'is_new'      => false,
                'rating'      => 4.30,
                'num_reviews' => 43,
            ],
            [
                'name'        => 'Rear Semi-Metallic Brake Pads',
                'category'    => 'Brakes & Rotors',
                'brand'       => 'Wagner',
                'description' => 'Reliable semi-metallic brake pads designed for consistent stopping power. Premium friction material for all driving conditions.',
                'price'       => 42.00,
                'old_price'   => null,
                'stock'       => 50,
                'image_path'  => 'IMG-20260320-WA0011.jpg',
                'is_new'      => false,
                'rating'      => 4.50,
                'num_reviews' => 65,
            ],
            [
                'name'        => 'LED Light Bar 20" Combo Beam',
                'category'    => 'Lighting',
                'brand'       => 'Philips',
                'description' => 'Ultra-bright LED light bar with combo spot and flood beam pattern. IP68 waterproof rated for off-road adventures.',
                'price'       => 89.99,
                'old_price'   => 120.00,
                'stock'       => 30,
                'image_path'  => 'IMG-20260320-WA0028.jpg',
                'is_new'      => true,
                'rating'      => 4.70,
                'num_reviews' => 33,
            ],
            [
                'name'        => 'Premium Engine Oil 5W-30 5Qt',
                'category'    => 'Maintenance',
                'brand'       => 'Mobil 1',
                'description' => 'Full synthetic motor oil providing outstanding engine protection and performance. Exceeds industry standards.',
                'price'       => 28.99,
                'old_price'   => 35.00,
                'stock'       => 90,
                'image_path'  => 'IMG-20260320-WA0030.jpg',
                'is_new'      => false,
                'rating'      => 4.90,
                'num_reviews' => 156,
            ],
            [
                'name'        => 'Chrome Alloy Wheel 17" Set of 4',
                'category'    => 'Wheels & Tires',
                'brand'       => 'Enkei',
                'description' => 'Lightweight cast alloy wheels with chrome finish. Universal 5-bolt pattern for wide vehicle compatibility.',
                'price'       => 399.99,
                'old_price'   => 480.00,
                'stock'       => 8,
                'image_path'  => 'zoshua-colah-kQzRZjrr6sw-unsplash.jpg',
                'is_new'      => true,
                'rating'      => 4.80,
                'num_reviews' => 28,
            ],
            [
                'name'        => 'Serpentine Drive Belt',
                'category'    => 'Engine Parts',
                'brand'       => 'Continental',
                'description' => 'Quiet and durable serpentine belt engineered for consistent power transmission across all accessories.',
                'price'       => 18.50,
                'old_price'   => null,
                'stock'       => 120,
                'image_path'  => 'IMG-20260320-WA0031.jpg',
                'is_new'      => false,
                'rating'      => 4.40,
                'num_reviews' => 71,
            ],
        ];

        foreach ($products as $product) {
            Product::create($product);
        }
    }
}
