"""Seed seeker CV categories from the canonical PEZAJOB job category taxonomy."""
from django.core.management.base import BaseCommand

from jobs.category_data import sync_pezajob_categories
from seekers.models import SeekerCategory


class Command(BaseCommand):
    help = 'Sync CV library categories from PEZAJOB job categories'

    def handle(self, *args, **options):
        sync_pezajob_categories(deactivate_unknown=True)
        self.stdout.write(
            self.style.SUCCESS(
                f'CV categories synced ({SeekerCategory.objects.filter(is_active=True).count()} active).'
            )
        )
