from django.contrib import admin
from .models import CourseAnalytics, InstructorAnalytics, StudentAnalytics

@admin.register(CourseAnalytics)
class CourseAnalyticsAdmin(admin.ModelAdmin):
    list_display = ('course', 'total_students', 'average_progress', 'completion_rate', 'revenue', 'created_at', 'updated_at')
    list_filter = ('created_at', 'updated_at')
    search_fields = ('course__title',)

@admin.register(InstructorAnalytics)
class InstructorAnalyticsAdmin(admin.ModelAdmin):
    list_display = ('instructor', 'total_lessons', 'total_students', 'average_rating', 'completion_rate', 'created_at', 'updated_at')
    list_filter = ('created_at', 'updated_at')
    search_fields = ('instructor__profile__user__username', 'instructor__profile__user__email')

@admin.register(StudentAnalytics)
class StudentAnalyticsAdmin(admin.ModelAdmin):
    list_display = ('student', 'total_lessons', 'attendance_rate', 'average_grade', 'created_at', 'updated_at')
    list_filter = ('created_at', 'updated_at')
    search_fields = ('student__profile__user__username', 'student__profile__user__email') 