from django.contrib import admin
from .models import TelegramBot, BotConfig, TelegramChat


@admin.register(TelegramBot)
class TelegramBotAdmin(admin.ModelAdmin):
    list_display = ("id", "name", "username", "is_active")
    list_filter = ("is_active",)
    search_fields = ("name", "username")


@admin.register(BotConfig)
class BotConfigAdmin(admin.ModelAdmin):
    list_display = ("id", "bot", "parse_mode", "use_webhook")
    list_filter = ("use_webhook", "parse_mode")
    autocomplete_fields = ("bot",)


@admin.register(TelegramChat)
class TelegramChatAdmin(admin.ModelAdmin):
    list_display = ("id", "type", "title", "username", "is_member", "joined_at", "left_at", "last_message_at")
    list_filter = ("type", "is_member")
    search_fields = ("title", "username")
    readonly_fields = ("joined_at", "left_at", "last_message_at")
