from django.contrib import admin
from .models import MailSender, MailEmail, MailNotificationToken


@admin.register(MailSender)
class MailSenderAdmin(admin.ModelAdmin):
    list_display = ('__str__', 'rule', 'note', 'created_at')
    list_filter = ('rule',)
    search_fields = ('email', 'domain', 'note')


@admin.register(MailEmail)
class MailEmailAdmin(admin.ModelAdmin):
    list_display = ('subject', 'sender_email', 'account', 'llm_verdict', 'feedback', 'received_at')
    list_filter = ('account', 'llm_verdict', 'feedback')
    search_fields = ('subject', 'sender_email', 'sender_domain')
    readonly_fields = ('message_id', 'received_at', 'notified_at', 'feedback_at')


@admin.register(MailNotificationToken)
class MailNotificationTokenAdmin(admin.ModelAdmin):
    list_display = ('token', 'email', 'created_at')
    readonly_fields = ('token', 'created_at')
