from django.contrib import admin
from .models import Project, PipelineStep, CgiAsset

class PipelineStepInline(admin.TabularInline):
    model = PipelineStep
    extra = 1

class CgiAssetInline(admin.TabularInline):
    model = CgiAsset
    extra = 1

@admin.register(Project)
class ProjectAdmin(admin.ModelAdmin):
    list_display = ('title', 'project_type', 'status', 'created_at')
    list_filter = ('project_type', 'status')
    search_fields = ('title', 'description')
    prepopulated_fields = {'slug': ('title',)}
    inlines = [PipelineStepInline, CgiAssetInline]

@admin.register(PipelineStep)
class PipelineStepAdmin(admin.ModelAdmin):
    list_display = ('project', 'name', 'progress', 'is_completed')
    list_filter = ('name', 'is_completed')

@admin.register(CgiAsset)
class CgiAssetAdmin(admin.ModelAdmin):
    list_display = ('name', 'project', 'asset_type', 'is_realistic')
    list_filter = ('asset_type', 'is_realistic')
