from django.contrib import admin
from .models import Service, ServiceFeature, WorkProcess

class ServiceFeatureInline(admin.TabularInline):
    model = ServiceFeature
    extra = 1

@admin.register(Service)
class ServiceAdmin(admin.ModelAdmin):
    list_display = ('title', 'order', 'slug') # J'ai retiré icon_class de l'affichage liste pour alléger
    search_fields = ('title', 'short_description')
    prepopulated_fields = {'slug': ('title',)}
    inlines = [ServiceFeatureInline]
    
    # Organisation du formulaire par sections
    fieldsets = (
        ('Identité du Service', {
            'fields': ('title', 'slug', 'icon_class', 'order')
        }),
        ('Contenu', {
            'fields': ('short_description', 'full_description')
        }),
        ('Médias', {
            'fields': ('thumbnail', 'banner_image')
        }),
    )

@admin.register(WorkProcess)
class WorkProcessAdmin(admin.ModelAdmin):
    list_display = ('step_number', 'title')
    ordering = ('step_number',)