from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from .models import DepotUser


@admin.register(DepotUser)
class DepotUserAdmin(UserAdmin):
    # Add your custom fields to the fieldsets
    fieldsets = UserAdmin.fieldsets + (
        ('Additional Info', {'fields': (
            'phone_number',
            'company',
            'line',
            'company_permissions',
            'user_type',
        )}),
    )

    # Add fields to display in list view
    list_display = ('username', 'email', 'user_type', 'company', 'line', 'is_active', 'is_staff', 'is_superuser')
    search_fields = ('username', 'email')
    list_filter = ('user_type', 'is_active', 'is_staff', 'is_superuser')

    # Add fields to the add form
    add_fieldsets = UserAdmin.add_fieldsets + (
        ('Additional Info', {'fields': (
            'email',
            'phone_number',
            'company',
            'line',
            'company_permissions',
            'user_type',
        )}),
    )