from django.contrib import admin
from .models import ScanProfile, ScanRun, ScanFinding


@admin.register(ScanProfile)
class ScanProfileAdmin(admin.ModelAdmin):
    list_display = ['name', 'enabled', 'schedule_interval', 'gateway_ip', 'public_ip', 'last_run_at', 'created_at']
    list_filter = ['enabled', 'schedule_interval']


@admin.register(ScanRun)
class ScanRunAdmin(admin.ModelAdmin):
    list_display = ['profile', 'status', 'triggered_by', 'started_at', 'finished_at']
    list_filter = ['status', 'triggered_by', 'profile']
    readonly_fields = ['started_at', 'finished_at', 'summary']


@admin.register(ScanFinding)
class ScanFindingAdmin(admin.ModelAdmin):
    list_display = ['run', 'check_name', 'severity', 'title']
    list_filter = ['severity', 'check_name']
