from typing import Any

from django.contrib import messages
from django.http import HttpResponse, HttpResponseRedirect
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _
from django_filters.views import FilterView
from rules.contrib.views import PermissionRequiredMixin

from members.filters import MemberFilter
from members.models import Member


class MemberListView(PermissionRequiredMixin, FilterView):
    filterset_class = MemberFilter
    paginate_by = 50
    permission_denied_message = _("You do not have permission to view this page.")
    permission_required = "members.view_member"

    def handle_no_permission(self) -> HttpResponseRedirect:
        messages.error(self.request, self.get_permission_denied_message())
        return HttpResponseRedirect(reverse_lazy("backend:index"))


class MemberAddView: ...


class MemberEditView: ...


class MemberDeleteView: ...


class MemberLoadView: ...
