from birds.models import Bird, BirdingCSVImport, BirdingLocation
from django.contrib import admin
from scrobbles.admin import ScrobbleInline


@admin.register(Bird)
class BirdAdmin(admin.ModelAdmin):
    date_hierarchy = "created"
    list_display = ("uuid", "common_name", "scientific_name", "ebird_code")
    ordering = ("-created",)
    search_fields = ("common_name", "scientific_name")


@admin.register(BirdingLocation)
class BirdingLocationAdmin(admin.ModelAdmin):
    date_hierarchy = "created"
    list_display = ("uuid", "title")
    ordering = ("-created",)
    raw_id_fields = ("geo_location",)
    search_fields = ("title",)
    inlines = [
        ScrobbleInline,
    ]


@admin.register(BirdingCSVImport)
class BirdingCSVImportAdmin(admin.ModelAdmin):
    date_hierarchy = "created"
    list_display = ("uuid", "process_count", "processed_finished", "processing_started", "error_log")
    raw_id_fields = ("user",)
    ordering = ("-created",)
