from django.core.management.base import BaseCommand

from seekers.models import SeekerProfile


SEED_SEEKERS = [
    {
        'slug': 'chanda-mwila',
        'full_name': 'Chanda Mwila',
        'headline': 'Senior Finance Analyst',
        'category': 'Finance & Accounting',
        'category_slug': 'finance-accounting',
        'location': 'Lusaka',
        'years_experience': 7,
        'experience_level': SeekerProfile.ExperienceLevel.SENIOR,
        'availability': SeekerProfile.Availability.ACTIVE,
        'tier': SeekerProfile.Tier.GOLD,
        'is_featured': True,
        'qualification': 'ACCA Qualified',
        'salary_min': 18000,
        'salary_max': 22000,
        'cover_image_url': 'https://images.unsplash.com/photo-1497366216548-37526070297c?w=400&q=70',
        'avatar_url': 'https://images.unsplash.com/photo-1573496359142-b8d87734a5a2?w=150&q=75&fit=crop&crop=face',
        'skills': 'IFRS\nExcel\nSage\nBudgeting',
        'bio': (
            'Results-driven finance professional with 7 years of experience in corporate banking, '
            'financial reporting and budgeting across Zambia\'s leading financial institutions.'
        ),
        'experience_summary': 'Senior Finance Analyst · ZANACO Bank · 2020–Present\nFinancial Analyst · FNB Zambia · 2017–2020',
        'education': 'BSc Accounting · University of Zambia · 2016',
    },
    {
        'slug': 'tendai-ncube',
        'full_name': 'Tendai Ncube',
        'headline': 'Full-Stack Developer',
        'category': 'Technology & IT',
        'category_slug': 'technology-it',
        'location': 'Lusaka',
        'years_experience': 5,
        'experience_level': SeekerProfile.ExperienceLevel.MID,
        'availability': SeekerProfile.Availability.ACTIVE,
        'tier': SeekerProfile.Tier.GOLD,
        'is_featured': True,
        'salary_min': 15000,
        'salary_max': 20000,
        'cover_image_url': 'https://images.unsplash.com/photo-1461749280684-dccba630e2f6?w=400&q=70',
        'avatar_url': 'https://images.unsplash.com/photo-1556157382-97eda2f9aa60?w=150&q=75&fit=crop&crop=face',
        'skills': 'React\nNode.js\nPython\nAWS',
        'bio': 'Full-stack engineer building scalable web applications for fintech and telecom clients across Africa.',
        'experience_summary': 'Software Engineer · Airtel Zambia · 2021–Present\nJunior Developer · Startup Hub · 2019–2021',
        'education': 'BSc Computer Science · Copperbelt University · 2018',
    },
    {
        'slug': 'lina-mutale',
        'full_name': 'Lina Mutale',
        'headline': 'Marketing Manager',
        'category': 'Marketing',
        'category_slug': 'marketing',
        'location': 'Lusaka',
        'years_experience': 6,
        'experience_level': SeekerProfile.ExperienceLevel.MID,
        'availability': SeekerProfile.Availability.PASSIVE,
        'tier': SeekerProfile.Tier.SILVER,
        'cover_image_url': 'https://images.unsplash.com/photo-1542744173-8e7e53415bb0?w=400&q=70',
        'avatar_url': 'https://images.unsplash.com/photo-1508214751196-bcfd4ca60f91?w=150&q=75&fit=crop&crop=face',
        'skills': 'Brand Strategy\nSEO\nSocial Media',
        'bio': 'Creative marketing leader with expertise in brand campaigns, digital growth and consumer engagement.',
    },
    {
        'slug': 'brian-kabwe',
        'full_name': 'Brian Kabwe',
        'headline': 'Civil Engineer',
        'category': 'Engineering',
        'category_slug': 'engineering',
        'location': 'Ndola',
        'years_experience': 9,
        'experience_level': SeekerProfile.ExperienceLevel.SENIOR,
        'availability': SeekerProfile.Availability.PASSIVE,
        'tier': SeekerProfile.Tier.SILVER,
        'cover_image_url': 'https://images.unsplash.com/photo-1503387762-592deb58ef4e?w=400&q=70',
        'avatar_url': 'https://images.unsplash.com/photo-1519085360753-af0119f7cbe7?w=150&q=75&fit=crop&crop=face',
        'skills': 'AutoCAD\nProject Mgmt\nStructural',
        'bio': 'Licensed civil engineer specialising in infrastructure projects across the Copperbelt region.',
    },
    {
        'slug': 'grace-phiri',
        'full_name': 'Grace Phiri',
        'headline': 'Data Scientist',
        'category': 'Technology & IT',
        'category_slug': 'technology-it',
        'location': 'Lusaka',
        'years_experience': 4,
        'experience_level': SeekerProfile.ExperienceLevel.MID,
        'availability': SeekerProfile.Availability.ACTIVE,
        'tier': SeekerProfile.Tier.GOLD,
        'is_featured': True,
        'salary_min': 20000,
        'salary_max': 28000,
        'cover_image_url': 'https://images.unsplash.com/photo-1551288049-bebda4e38f71?w=400&q=70',
        'avatar_url': 'https://images.unsplash.com/photo-1580489944761-15a19d654956?w=150&q=75&fit=crop&crop=face',
        'skills': 'Python\nMachine Learning\nSQL\nPower BI',
        'bio': 'Data scientist with experience in mining analytics, predictive modelling and business intelligence.',
    },
    {
        'slug': 'samuel-mulenga',
        'full_name': 'Samuel Mulenga',
        'headline': 'HR Business Partner',
        'category': 'Human Resources',
        'category_slug': 'human-resources',
        'location': 'Lusaka',
        'years_experience': 8,
        'experience_level': SeekerProfile.ExperienceLevel.SENIOR,
        'availability': SeekerProfile.Availability.ACTIVE,
        'tier': SeekerProfile.Tier.SILVER,
        'cover_image_url': 'https://images.unsplash.com/photo-1521737711867-e3b97375f902?w=400&q=70',
        'avatar_url': 'https://images.unsplash.com/photo-1500648767791-00dcc994a43e?w=150&q=75&fit=crop&crop=face',
        'skills': 'Recruitment\nEmployee Relations\nHRIS',
        'bio': 'HR professional supporting talent acquisition and people operations for large employers in Lusaka.',
    },
]


class Command(BaseCommand):
    help = 'Seed public job seeker profiles'

    def handle(self, *args, **options):
        created = updated = 0
        for data in SEED_SEEKERS:
            slug = data['slug']
            _, was_created = SeekerProfile.objects.update_or_create(
                slug=slug,
                defaults={**data, 'is_public': True},
            )
            if was_created:
                created += 1
            else:
                updated += 1

        self.stdout.write(
            self.style.SUCCESS(
                f'Seed complete: {created} created, {updated} updated '
                f'({SeekerProfile.objects.count()} total profiles)'
            )
        )
