from django.contrib import admin
from .models import Category, FleetUnit, Maintenance, Breakdown, PartRequest, Document

@admin.register(Category)
class CategoryAdmin(admin.ModelAdmin):
    list_display = ('name',)

@admin.register(FleetUnit)
class FleetUnitAdmin(admin.ModelAdmin):
    list_display = ('name', 'category', 'plate_number', 'status', 'year')
    list_filter = ('status', 'category')
    search_fields = ('name', 'vin', 'plate_number')

@admin.register(Maintenance)
class MaintenanceAdmin(admin.ModelAdmin):
    list_display = ('fleet_unit', 'm_type', 'planned_date', 'status')
    list_filter = ('status', 'm_type')

@admin.register(Breakdown)
class BreakdownAdmin(admin.ModelAdmin):
    list_display = ('fleet_unit', 'system_node', 'status', 'date')
    list_filter = ('status',)

@admin.register(PartRequest)
class PartRequestAdmin(admin.ModelAdmin):
    list_display = ('part_name', 'fleet_unit', 'status', 'quantity')
    list_filter = ('status',)

@admin.register(Document)
class DocumentAdmin(admin.ModelAdmin):
    list_display = ('doc_type', 'fleet_unit', 'uploaded_at')