from django.contrib import admin
from .models import RouterMonSettings, DnsQuery, DhcpLease


@admin.register(RouterMonSettings)
class RouterMonSettingsAdmin(admin.ModelAdmin):
    list_display = ['syslog_port', 'enabled', 'retention_days', 'last_received_at']


@admin.register(DnsQuery)
class DnsQueryAdmin(admin.ModelAdmin):
    list_display = ['timestamp', 'client_ip', 'client_name', 'domain', 'query_type', 'is_nxdomain', 'resolved_ip', 'country']
    list_filter = ['is_nxdomain', 'query_type']
    search_fields = ['domain', 'client_ip', 'client_name']
    ordering = ['-timestamp']


@admin.register(DhcpLease)
class DhcpLeaseAdmin(admin.ModelAdmin):
    list_display = ['ip', 'mac', 'hostname', 'last_seen']
    search_fields = ['ip', 'mac', 'hostname']
    ordering = ['-last_seen']
