from django.contrib import admin

from .models import CreditAccount, CreditLedger, CreditReservation, QuotaPolicy


@admin.register(CreditAccount)
class CreditAccountAdmin(admin.ModelAdmin):
    list_display = ("team", "balance", "reserved_balance", "currency", "updated_at")
    search_fields = ("team__name",)


@admin.register(CreditLedger)
class CreditLedgerAdmin(admin.ModelAdmin):
    list_display = ("team", "user", "project", "task", "ledger_type", "amount", "balance_after", "created_at")
    search_fields = ("team__name", "user__username", "project__name", "task__idempotency_key")
    list_filter = ("ledger_type",)


admin.site.register(CreditReservation)
admin.site.register(QuotaPolicy)

