from django.contrib import admin
from .models import Corporation, TaxConfig, CorpMonthStat, CorpTokenLink, CorpJournalEntry, AllianceSettings


@admin.register(Corporation)
class CorporationAdmin(admin.ModelAdmin):
    list_display = ("name", "ticker", "corporation_id")
    search_fields = ("name", "ticker", "corporation_id")


@admin.register(TaxConfig)
class TaxConfigAdmin(admin.ModelAdmin):
    list_display = ("corp", "tax_rate_percent")
    search_fields = ("corp__name", "corp__ticker")


@admin.register(CorpMonthStat)
class CorpMonthStatAdmin(admin.ModelAdmin):
    list_display = ("corp", "year", "month", "corp_bounty_tax_amount", "closed")
    list_filter = ("year", "month", "closed")
    search_fields = ("corp__name", "corp__ticker")


@admin.register(CorpTokenLink)
class CorpTokenLinkAdmin(admin.ModelAdmin):
    list_display = ("corp", "character_id", "character_name", "updated_at")
    search_fields = ("corp__name", "character_name", "character_id")


@admin.register(CorpJournalEntry)
class CorpJournalEntryAdmin(admin.ModelAdmin):
    list_display = ("corp", "division", "journal_id", "date", "ref_type", "amount")
    list_filter = ("division", "ref_type")
    search_fields = ("corp__name", "journal_id", "reason")


@admin.register(AllianceSettings)
class AllianceSettingsAdmin(admin.ModelAdmin):
    list_display = ("default_tax_rate_percent", "flat_tax_reduction")