# from django.contrib import admin
# from .models import Senior


# @admin.register(Senior)
# class SeniorAdmin(admin.ModelAdmin):
#     list_display = ['name', 'phone_number', 'age', 'caregiver', 'is_active', 'created_at']
#     list_filter = ['is_active', 'created_at', 'caregiver']
#     search_fields = ['name', 'phone_number']
#     readonly_fields = ['created_at', 'updated_at']
    
#     fieldsets = (
#         ('Basic Information', {
#             'fields': ('name', 'phone_number', 'age', 'timezone')
#         }),
#         ('Companion Settings', {
#             'fields': ('companion_name', 'first_message'),
#             'description': 'Customize the AI companion name and first message for this senior. Use {senior.name} and {companion.name} as template variables in the first message.'
#         }),
#         ('Preferences', {
#             'fields': ('preferred_call_times', 'interests', 'health_notes')
#         }),
#         ('Relationship', {
#             'fields': ('caregiver',)
#         }),
#         ('Status', {
#             'fields': ('is_active',)
#         }),
#         ('Timestamps', {
#             'fields': ('created_at', 'updated_at'),
#             'classes': ('collapse',)
#         }),
#     )
from django.contrib import admin
from .models import Senior


@admin.register(Senior)
class SeniorAdmin(admin.ModelAdmin):
    list_display = ['name', 'phone_number', 'age', 'caregiver', 'is_active', 'created_at']
    list_filter = ['is_active', 'created_at', 'caregiver']
    search_fields = ['name', 'phone_number']
    readonly_fields = ['created_at', 'updated_at']
    
    fieldsets = (
        ('Basic Information', {
            'fields': ('name', 'phone_number', 'age', 'timezone')
        }),
        ('Companion Settings', {
            'fields': ('companion_name', 'first_message'),
            'description': 'Customize the AI companion name and first message for this senior. Use {senior.name} and {companion.name} as template variables in the first message.'
        }),
        ('Preferences', {
            'fields': ('preferred_call_times', 'interests', 'health_notes')
        }),
        ('Relationship', {
            'fields': ('caregiver',)
        }),
        ('Status', {
            'fields': ('is_active',)
        }),
        ('Time Management', {
            'fields': ('monthly_timelimit', 'extra_minutes_balance'),
            'description': 'Manage call time allowance. "Monthly Allowance" resets logically each month. "Extra Balance" can be topped up by admins and carries over.'
        }),
        ('Timestamps', {
            'fields': ('created_at', 'updated_at'),
            'classes': ('collapse',)
        }),
    )