<?php

namespace Database\Seeders;

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

class ProductSeeder extends Seeder
{
    public function run(): void
    {
        $products = [
            ['name' => 'iPhone 15 Pro Max', 'price' => 169999, 'discount_price' => 159999],
            ['name' => 'iPhone 15 Pro', 'price' => 149999, 'discount_price' => 139999],
            ['name' => 'iPhone 15', 'price' => 119999, 'discount_price' => 109999],
            ['name' => 'Samsung Galaxy S24 Ultra', 'price' => 159999, 'discount_price' => 149999],
            ['name' => 'Samsung Galaxy S24+', 'price' => 129999, 'discount_price' => 119999],
            ['name' => 'Samsung Galaxy S24', 'price' => 99999, 'discount_price' => 89999],
            ['name' => 'Xiaomi 14 Pro', 'price' => 99999, 'discount_price' => 89999],
            ['name' => 'Xiaomi 14', 'price' => 79999, 'discount_price' => 74999],
            ['name' => 'OnePlus 12', 'price' => 89999, 'discount_price' => 84999],
            ['name' => 'OnePlus 12R', 'price' => 69999, 'discount_price' => 64999],
            ['name' => 'Realme GT5 Pro', 'price' => 59999, 'discount_price' => 54999],
            ['name' => 'Realme 12 Pro+', 'price' => 34999, 'discount_price' => 32999],
            ['name' => 'MacBook Pro 16"', 'price' => 249999, 'discount_price' => 229999],
            ['name' => 'MacBook Pro 14"', 'price' => 199999, 'discount_price' => 189999],
            ['name' => 'MacBook Air M3', 'price' => 119999, 'discount_price' => 109999],
            ['name' => 'Dell XPS 15', 'price' => 189999, 'discount_price' => 169999],
            ['name' => 'HP Spectre x360', 'price' => 159999, 'discount_price' => 149999],
            ['name' => 'Lenovo ThinkPad X1', 'price' => 179999, 'discount_price' => 159999],
            ['name' => 'ASUS ROG Zephyrus', 'price' => 229999, 'discount_price' => 199999],
            ['name' => 'AirPods Pro 2', 'price' => 24999, 'discount_price' => 22999],
        ];

        foreach ($products as $product) {
            Product::create([
                'name' => $product['name'],
                'slug' => strtolower(str_replace(' ', '-', $product['name'])),
                'description' => 'High quality ' . $product['name'] . ' with advanced features and premium design.',
                'price' => $product['price'],
                'discount_price' => $product['discount_price'] ?? null,
                'stock' => rand(5, 50),
                'brand_id' => rand(1, 10),
                'category_id' => rand(2, 10),
                'is_featured' => rand(0, 1),
                'view_count' => rand(100, 5000),
                'images' => json_encode(['products/product-1.jpg']),
                'is_active' => true,
            ]);
        }
    }
}