from django.contrib import admin
from .models import Program, Exercise

class ExerciseInline(admin.TabularInline):
    model = Exercise
    extra = 1

@admin.register(Program)
class ProgramAdmin(admin.ModelAdmin):
    list_display = ('patient_name', 'clinician_name', 'created_at', 'updated_at')
    search_fields = ('patient_name', 'clinician_name')
    inlines = [ExerciseInline]

@admin.register(Exercise)
class ExerciseAdmin(admin.ModelAdmin):
    list_display = ('title', 'program')
    list_filter = ('program',)
    search_fields = ('title', 'notes')