from django.conf import settings


def site_context(request):
    careers_enabled = getattr(settings, 'CAREERS_ENABLED', False)
    open_jobs_count = 0

    if careers_enabled:
        from apps.careers.models import JobOffer
        open_jobs_count = JobOffer.objects.filter(status=JobOffer.Status.PUBLISHED).count()

    return {
        'careers_enabled': careers_enabled,
        'open_jobs_count': open_jobs_count,
    }
