import os
import django

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'aacore.settings')
django.setup()

from services.models import Service

print("=" * 60)
print("AJUSTEMENT DE L'ORDRE DES SERVICES")
print("=" * 60)
print()

# Ordre correct selon WordPress
order_mapping = {
    "Transport national et régional": 1,
    "Transport exceptionnel": 2,
    "30 Ans d'existence": 3,
    "Transport BTP": 4,
    "Accompagnement personnalisé": 5,
}

for title, order in order_mapping.items():
    service = Service.objects.filter(title=title).first()
    if service:
        service.order = order
        service.save()
        print(f"✅ {order}. {title}")
    else:
        print(f"❌ Service non trouvé : {title}")

print()
print("=" * 60)
print("ORDRE FINAL DES SERVICES :")
print("=" * 60)
for service in Service.objects.all().order_by('order'):
    print(f"{service.order}. {service.title}")
    print(f"   Image : {service.image.url if service.image else 'Aucune'}")
    print(f"   Actif : {'Oui' if service.is_active else 'Non'}")
    print()
