from django.contrib import admin

from apps.annotations.models import Bookmark, Note


@admin.register(Bookmark)
class BookmarkAdmin(admin.ModelAdmin):
    list_display = (
        "user",
        "ebook",
        "chapter_index",
        "chapter_title",
        "page",
        "highlight_color",
        "created_at",
    )
    list_select_related = ("user", "ebook")
    search_fields = ("user__email", "ebook__title", "location_text", "content")
    list_filter = ("created_at",)


@admin.register(Note)
class NoteAdmin(admin.ModelAdmin):
    list_display = ("user", "book", "page", "created_at", "updated_at")
    list_select_related = ("user", "book")
    search_fields = ("user__email", "book__title", "content", "location_text")
    list_filter = ("created_at",)