from django.core.management.base import BaseCommand

from store.seeding import seed


class Command(BaseCommand):
    help = "Load SEO-ready categories and the product catalogue (store/data). Existing items with the same slug are left untouched."

    def add_arguments(self, parser):
        parser.add_argument("--reset", action="store_true", help="Delete all products and categories first")
        parser.add_argument("--reprice", action="store_true",
                            help="Re-apply catalogue prices (source price minus 10%) to existing products")
        parser.add_argument("--rewrite-content", action="store_true",
                            help="Regenerate the long-form SEO description and FAQs for existing products")

    def handle(self, *args, **opts):
        result = seed(reset=opts["reset"], reprice=opts["reprice"], rewrite_content=opts["rewrite_content"])
        self.stdout.write(self.style.SUCCESS(f"Seeded: {result}"))
