from django.contrib import admin

from boardgames.models import (
    BoardGame,
    BoardGameLocation,
    BoardGamePublisher,
    BoardGameDesigner,
)

from scrobbles.admin import ScrobbleInline


@admin.register(BoardGamePublisher)
class BoardGamePublisherAdmin(admin.ModelAdmin):
    date_hierarchy = "created"
    list_display = (
        "name",
        "uuid",
    )
    ordering = ("-created",)


@admin.register(BoardGameDesigner)
class BoardGameDesignerAdmin(admin.ModelAdmin):
    date_hierarchy = "created"
    list_display = (
        "name",
        "uuid",
    )
    ordering = ("-created",)


@admin.register(BoardGameLocation)
class BoardGameLocationAdmin(admin.ModelAdmin):
    date_hierarchy = "created"
    list_display = (
        "name",
        "uuid",
        "geo_location",
    )
    ordering = ("-created",)


@admin.register(BoardGame)
class BoardGameAdmin(admin.ModelAdmin):
    date_hierarchy = "created"
    list_display = (
        "bggeek_id",
        "title",
        "published_year",
    )
    search_fields = ("title",)
    ordering = ("-created",)
    inlines = [
        ScrobbleInline,
    ]
