from core.models import Category, Product

# Clear existing data
Product.objects.all().delete()
Category.objects.all().delete()

# Create Categories
categories = [
    {'name': 'VR Headsets', 'slug': 'vr-headsets', 'icon': 'bi-headset-vr'},
    {'name': 'Consoles', 'slug': 'consoles', 'icon': 'bi-controller'},
    {'name': 'Neural Gear', 'slug': 'neural-gear', 'icon': 'bi-cpu'},
    {'name': 'RGB Hardware', 'slug': 'rgb-hardware', 'icon': 'bi-lightning-charge'},
]

cat_objs = {}
for cat in categories:
    c = Category.objects.create(**cat)
    cat_objs[cat['slug']] = c

# Create Products
products = [
    {
        'name': 'NeuralLink X1',
        'slug': 'neurallink-x1',
        'category': cat_objs['neural-gear'],
        'description': 'Direct brain-to-game interface with zero latency. Experience gaming like never before.',
        'price': 1299.99,
        'image_url': 'https://images.pexels.com/photos/8473479/pexels-photo-8473479.jpeg?auto=compress&cs=tinysrgb&w=800',
        'is_featured': True,
    },
    {
        'name': 'HoloVisor Pro',
        'slug': 'holovisor-pro',
        'category': cat_objs['vr-headsets'],
        'description': '8K holographic display with 240Hz refresh rate and wide FOV.',
        'price': 899.99,
        'image_url': 'https://images.pexels.com/photos/3761153/pexels-photo-3761153.jpeg?auto=compress&cs=tinysrgb&w=800',
        'is_featured': True,
    },
    {
        'name': 'Quantum Console S',
        'slug': 'quantum-console-s',
        'category': cat_objs['consoles'],
        'description': 'Powered by quantum processing units for instant loading and photorealistic graphics.',
        'price': 499.99,
        'image_url': 'https://images.pexels.com/photos/5947116/pexels-photo-5947116.jpeg?auto=compress&cs=tinysrgb&w=800',
        'is_featured': True,
    },
    {
        'name': 'Neon Striker Keyboard',
        'slug': 'neon-striker-keyboard',
        'category': cat_objs['rgb-hardware'],
        'description': 'Mechanical keys with customizable OLED screens and liquid RGB cooling.',
        'price': 249.99,
        'image_url': 'https://images.pexels.com/photos/1779487/pexels-photo-1779487.jpeg?auto=compress&cs=tinysrgb&w=800',
        'is_featured': False,
    },
    {
        'name': 'Synapse Controller',
        'slug': 'synapse-controller',
        'category': cat_objs['neural-gear'],
        'description': 'Haptic feedback so precise you can feel the textures of the virtual world.',
        'price': 149.99,
        'image_url': 'https://images.pexels.com/photos/3945657/pexels-photo-3945657.jpeg?auto=compress&cs=tinysrgb&w=800',
        'is_featured': False,
    },
]

for prod in products:
    Product.objects.create(**prod)

print("Seed data created successfully!")
