from django.contrib import admin
from .models import User, UserConfirmation, UserActivityLog, NotificationSettings

@admin.register(User)
class UserAdmin(admin.ModelAdmin):
    list_display = ('username', 'telegram_id', 'chat_id', 'role', 'confirmed')
    search_fields = ('username', 'telegram_id', 'chat_id')
    list_filter = ('role', 'confirmed')
    ordering = ('-id',)
    
@admin.register(UserConfirmation)
class UserConfirmationAdmin(admin.ModelAdmin):
    list_display = ('user', 'confirmation_code', 'created_at')
    search_fields = ('user__username', 'confirmation_code')
    list_filter = ('created_at',)

@admin.register(UserActivityLog)
class UserActivityLogAdmin(admin.ModelAdmin):
    list_display = ( 'id', 'user_id', 'ip', 'timestamp', 'date_time', 'agent', 'platform', 'version', 'model', 'device', 'UAString', 'location', 'page_id', 'url_parameters', 'page_title', 'type', 'last_counter', 'hits', 'honeypot', 'reply', 'page_url')
    search_fields = ('user_id', 'ip', 'datetime', 'agent', 'platform', 'version', 'model', 'device', 'UAString', 'location', 'page_id', 'url_parameters', 'page_title', 'type', 'last_counter', 'hits', 'honeypot', 'reply', 'page_url')
    list_filter = ('page_title', 'user_id', 'ip')
    ordering = ('-id',)
    
@admin.register(NotificationSettings)
class NotificationSettingsAdmin(admin.ModelAdmin):
    list_display = ('user', 'email', 'telegram_enabled', 'email_enabled', 'notification_time')
    search_fields = ('user', 'email', 'telegram_enabled', 'email_enabled', 'notification_time')
    list_filter = ('user', 'email', 'telegram_enabled', 'email_enabled', 'notification_time')
    ordering = ('-id',)
    