from django.contrib import admin

from eventkit_cloud.user_requests.models import DataProviderRequest, SizeIncreaseRequest, UserSizeRule


class DataProviderRequestAdmin(admin.ModelAdmin):
    list_display = [
        "uid",
        "status",
        "user",
        "name",
        "url",
        "service_description",
        "created_at",
        "updated_at",
    ]

    list_filter = [
        "status",
    ]

    readonly_fields = [
        "uid",
        "created_at",
        "updated_at",
    ]

    search_fields = [
        "uid",
        "user",
    ]


class SizeIncreaseRequestAdmin(admin.ModelAdmin):
    list_display = [
        "uid",
        "status",
        "user",
        "provider",
        "requested_aoi_size",
        "requested_data_size",
        "created_at",
        "updated_at",
    ]

    list_filter = [
        "status",
        "provider",
    ]

    readonly_fields = [
        "uid",
        "created_at",
        "updated_at",
    ]

    search_fields = [
        "uid",
        "user",
    ]


admin.site.register(DataProviderRequest, DataProviderRequestAdmin)
admin.site.register(SizeIncreaseRequest, SizeIncreaseRequestAdmin)
admin.site.register(UserSizeRule)

@@ -1029,16 +1029,671 @@
     %5D%0A%0A%0A
+class UserSizeRuleAdmin(admin.ModelAdmin):%0A    list_display = %5B%0A        %22get_last_name%22,%0A        %22get_first_name%22,%0A        %22user%22,%0A        %22provider%22,%0A        %22max_data_size%22,%0A        %22max_selection_size%22,%0A    %5D%0A%0A    search_fields = (%22user__last_name%22, %22user__first_name%22, %22user%22, %22provider__slug%22, %22provider__name%22)%0A%0A    ordering = (%22user__last_name%22, %22user__first_name%22, %22user__username%22, %22provider__name%22)%0A%0A    def get_last_name(self, obj):%0A        return obj.user.last_name%0A%0A    get_last_name.short_description = %22Last Name%22%0A%0A    def get_first_name(self, obj):%0A        return obj.user.first_name%0A%0A    get_first_name.short_description = %22First Name%22%0A%0A%0A
 admin.si
@@ -1850,10 +1850,29 @@
 SizeRule
+, UserSizeRuleAdmin
 )%0A

change UserSizeRule display and sorting (#1111)