from django.core.management.base import BaseCommand

from blog.models import BlogPost


POSTS = [
    {
        'slug': 'zambia-2025-salary-guide',
        'title': "Zambia's 2025 Salary Guide: What Top Professionals Are Earning",
        'excerpt': 'A comprehensive breakdown of salaries across banking, tech, engineering, and healthcare sectors in Zambia.',
        'content': 'We surveyed thousands of professionals across Zambia to produce this salary guide. Use it to benchmark your current package and negotiate with confidence.\n\nBanking and finance roles in Lusaka continue to lead mid-level compensation, while technology salaries are rising fastest year-on-year.',
        'category': 'Salary Guides',
        'author_name': 'Natasha Kabwe',
        'author_role': 'Head of Research, PEZAJOB',
        'cover_image_url': 'https://images.unsplash.com/photo-1499750310107-5fef28a66643?w=800&q=75',
        'read_minutes': 12,
        'is_featured': True,
    },
    {
        'slug': '10-interview-questions-zambia',
        'title': '10 Questions You Must Prepare For Any Job Interview in Zambia',
        'excerpt': 'From competency questions to salary expectations — ace every interview with these proven answers.',
        'content': 'Zambian employers consistently ask a core set of interview questions. Preparation is the difference between a good answer and a winning one.\n\nPractice structuring responses using the STAR method and always tie your examples to measurable outcomes.',
        'category': 'Interview Prep',
        'author_name': 'Tendai Mwale',
        'author_role': 'Career Coach',
        'cover_image_url': 'https://images.unsplash.com/photo-1573497019940-1c28c88b4f3e?w=600&q=70',
        'read_minutes': 8,
    },
    {
        'slug': 'business-while-employed-zambia',
        'title': 'How to Start a Business While Still Employed: A Zambian Guide',
        'excerpt': 'Practical steps for side hustles, compliance, and balancing employment with entrepreneurship.',
        'content': 'Many Zambian professionals are building businesses alongside full-time roles. Understand your employment contract, tax obligations, and how to validate ideas before going all-in.',
        'category': 'Career Tips',
        'author_name': 'Grace Phiri',
        'author_role': 'Entrepreneurship Editor',
        'cover_image_url': 'https://images.unsplash.com/photo-1522202176988-66273c2fd55f?w=600&q=70',
        'read_minutes': 10,
    },
    {
        'slug': 'cv-vs-resume-zambia',
        'title': 'CV vs Resume: What Zambian Employers Actually Want to See',
        'excerpt': 'Clear guidance on format, length, and the details recruiters scan first.',
        'content': 'In Zambia, CV and resume are often used interchangeably — but top employers expect specific formats. Keep it concise, quantify achievements, and tailor each application.',
        'category': 'Career Tips',
        'author_name': 'Brian Kabwe',
        'author_role': 'HR Consultant',
        'cover_image_url': 'https://images.unsplash.com/photo-1586281380347-632531db7ed4?w=600&q=70',
        'read_minutes': 6,
    },
    {
        'slug': 'remote-work-zambia',
        'title': 'Remote Work in Zambia: Opportunities, Challenges & How to Thrive',
        'excerpt': 'The remote job market is growing — here is how to find roles and stay productive.',
        'content': 'Remote work adoption accelerated across Zambian tech and finance teams. Build a strong online presence, invest in reliable connectivity, and communicate proactively with distributed teams.',
        'category': 'Industry News',
        'author_name': 'Lina Mutale',
        'author_role': 'Workplace Analyst',
        'cover_image_url': 'https://images.unsplash.com/photo-1522071820081-009f0129c71c?w=600&q=70',
        'read_minutes': 9,
    },
]


class Command(BaseCommand):
    help = 'Seed blog posts'

    def handle(self, *args, **options):
        for data in POSTS:
            BlogPost.objects.update_or_create(slug=data['slug'], defaults={**data, 'is_published': True})
        self.stdout.write(self.style.SUCCESS(f'Seeded {BlogPost.objects.count()} blog posts'))
