# backend/apps/links/admin.py

from django.contrib import admin
from .models import LinkGroup, Link

@admin.register(LinkGroup)
class LinkGroupAdmin(admin.ModelAdmin):
    list_display = ('title', 'owner', 'order')
    list_filter = ('owner',)
    search_fields = ('title', 'owner__username')
    ordering = ('owner', 'order')

@admin.register(Link)
class LinkAdmin(admin.ModelAdmin):
    list_display = ('title', 'group', 'is_active', 'order', 'created_at')
    list_filter = ('group', 'is_active')
    search_fields = ('title', 'url', 'group__title', 'group__owner__username')
    ordering = ('group', 'order')
