"""
Core app admin
"""
from django.contrib import admin

from .models import AuditEvent


@admin.register(AuditEvent)
class AuditEventAdmin(admin.ModelAdmin):
    list_display = ['event_type', 'user', 'description', 'created_at']
    list_filter = ['event_type', 'created_at']
    search_fields = ['description', 'user__email', 'user__first_name', 'user__last_name']
    readonly_fields = ['id', 'created_at', 'updated_at']
    date_hierarchy = 'created_at'
    
    def has_add_permission(self, request):
        # Audit events should not be manually created
        return False
    
    def has_delete_permission(self, request, obj=None):
        # Audit events should not be deleted
        return False
