from django.core.management.base import BaseCommand
from core.models import Product

class Command(BaseCommand):
    help = 'Populates the database with demo products'

    def handle(self, *args, **kwargs):
        Product.objects.all().delete()
        demo_data = [
            {"name": "Ethiopian Specialty Coffee", "price": 12.99, "description": "Authentic Yirgacheffe coffee beans, medium roast."},
            {"name": "Traditional Woven Scarf", "price": 25.50, "description": "Hand-woven cotton scarf with cultural patterns."},
            {"name": "Handmade Clay Vase", "price": 18.00, "description": "Beautifully crafted artisan clay vase for home decor."},
            {"name": "Organic Teff Flour", "price": 8.50, "description": "High-quality, gluten-free organic teff flour, 1kg."},
            {"name": "Leather Journal", "price": 15.00, "description": "Hand-stitched genuine leather notebook, perfect for sketching."},
        ]
        for item in demo_data:
            Product.objects.create(**item)
        self.stdout.write(self.style.SUCCESS('Successfully added 5 demo products!'))
