from django.contrib import admin
from .models import Cryptocurrency, Account, Asset, Order, Transaction, SiteSettings

@admin.register(SiteSettings)
class SiteSettingsAdmin(admin.ModelAdmin):
    list_display = ('site_name', 'customer_service_url', 'is_pinning_active')

@admin.register(Cryptocurrency)
class CryptocurrencyAdmin(admin.ModelAdmin):
    list_display = ('symbol', 'name', 'current_price', 'manual_price', 'change_24h', 'is_active')
    search_fields = ('symbol', 'name')
    list_editable = ('manual_price', 'is_active')

@admin.register(Account)
class AccountAdmin(admin.ModelAdmin):
    list_display = ('uid', 'user', 'balance', 'credit_score', 'kyc_status', 'win_loss_control', 'created_at')
    search_fields = ('uid', 'user__username')
    list_filter = ('kyc_status', 'account_type')
    list_editable = ('win_loss_control',)

@admin.register(Asset)
class AssetAdmin(admin.ModelAdmin):
    list_display = ('account', 'currency', 'balance', 'frozen')
    list_filter = ('currency',)

@admin.register(Order)
class OrderAdmin(admin.ModelAdmin):
    list_display = ('account', 'symbol', 'trade_type', 'side', 'status', 'created_at')
    list_filter = ('trade_type', 'side', 'status')

@admin.register(Transaction)
class TransactionAdmin(admin.ModelAdmin):
    list_display = ('account', 'transaction_type', 'amount', 'currency', 'status', 'timestamp')
    list_filter = ('transaction_type', 'status')