from typing import Any

from django.contrib.auth.base_user import AbstractBaseUser
from django.db import models
from django.utils.functional import cached_property
from wagtail.admin.filters import MultipleUserFilter, WagtailFilterSet
from wagtail.admin.ui.tables import Column, UserColumn
from wagtail.admin.views.generic.base import BaseListingView, BaseObjectMixin, WagtailAdminTemplateMixin
from wagtail.admin.views.generic.permissions import PermissionCheckedMixin
from wagtail.admin.widgets.button import HeaderButton
from wagtail.models import BaseLogEntry, Revision, Task, TaskState, WorkflowState
import django_filters

def get_actions_for_filter(queryset: models.QuerySet[BaseLogEntry]) -> list[tuple[str, str]]: ...

class HistoryFilterSet(WagtailFilterSet):
    action: django_filters.MultipleChoiceFilter
    user: MultipleUserFilter
    timestamp: django_filters.DateFromToRangeFilter
    def __init__(self, *args: Any, **kwargs: Any) -> None: ...
    def get_action_choices(self) -> list[tuple[str, str]]: ...
    def get_users_queryset(self) -> models.QuerySet[AbstractBaseUser]: ...

class ActionColumn(Column):
    object: models.Model
    url_names: dict[str, str | None]
    user_can_unschedule: bool
    revision_enabled: bool
    draftstate_enabled: bool
    def __init__(
        self,
        *args: Any,
        object: models.Model,
        url_names: dict[str, str | None],
        user_can_unschedule: bool,
        **kwargs: Any,
    ) -> None: ...
    @cached_property
    def cell_template_name(self) -> str: ...
    def get_status(self, instance: BaseLogEntry, parent_context: dict[str, Any]) -> str | None: ...
    def get_actions(self, instance: BaseLogEntry, parent_context: dict[str, Any]) -> list[dict[str, str]]: ...
    def get_cell_context_data(self, instance: BaseLogEntry, parent_context: dict[str, Any]) -> dict[str, Any]: ...

class LogEntryUserColumn(UserColumn):
    def __init__(self, name: str, **kwargs: Any) -> None: ...
    def get_cell_context_data(self, instance: BaseLogEntry, parent_context: dict[str, Any]) -> dict[str, Any]: ...

class HistoryView(PermissionCheckedMixin, BaseObjectMixin, BaseListingView):
    any_permission_required: list[str]
    page_title: str
    header_icon: str
    paginate_by: int
    filterset_class: type[HistoryFilterSet]
    history_url_name: str | None
    history_results_url_name: str | None
    edit_url_name: str | None
    revisions_view_url_name: str | None
    revisions_revert_url_name: str | None
    revisions_compare_url_name: str | None
    revisions_unschedule_url_name: str | None
    @cached_property
    def columns(self) -> list[Column]: ...
    def get_base_object_queryset(self) -> models.QuerySet[models.Model]: ...
    def get_page_subtitle(self) -> str: ...
    def get_breadcrumbs_items(self) -> list[dict[str, Any]]: ...
    @cached_property
    def header_buttons(self) -> list[HeaderButton]: ...
    def get_edit_url(self, instance: models.Model) -> str | None: ...
    def get_history_url(self, instance: models.Model) -> str | None: ...
    def get_history_results_url(self, instance: models.Model) -> str | None: ...
    def get_index_url(self) -> str | None: ...
    def get_index_results_url(self) -> str | None: ...
    def user_can_unschedule(self) -> bool: ...
    @cached_property
    def verbose_name_plural(self) -> str: ...
    def get_context_data(
        self, *args: Any, object_list: models.QuerySet[BaseLogEntry] | None = None, **kwargs: Any
    ) -> dict[str, Any]: ...
    def get_base_queryset(self) -> models.QuerySet[BaseLogEntry]: ...
    def _annotate_queryset(self, queryset: models.QuerySet[BaseLogEntry]) -> models.QuerySet[BaseLogEntry]: ...
    def get_filterset_kwargs(self) -> dict[str, Any]: ...

class WorkflowHistoryView(BaseObjectMixin, BaseListingView):
    template_name: str
    results_template_name: str
    paginate_by: int
    index_url_name: str | None
    edit_url_name: str | None
    workflow_history_detail_url_name: str | None
    page_title: str
    context_object_name: str
    @cached_property
    def index_url(self) -> str | None: ...
    @cached_property
    def edit_url(self) -> str | None: ...
    @cached_property
    def header_buttons(self) -> list[HeaderButton]: ...
    def get_page_subtitle(self) -> str: ...
    def get_breadcrumbs_items(self) -> list[dict[str, Any]]: ...
    def get_base_queryset(self) -> models.QuerySet[WorkflowState]: ...
    def get_context_data(self, **kwargs: Any) -> dict[str, Any]: ...

class WorkflowHistoryDetailView(BaseObjectMixin, WagtailAdminTemplateMixin):
    template_name: str
    index_url_name: str | None
    edit_url_name: str | None
    workflow_state_url_kwarg: str
    workflow_history_url_name: str | None
    page_title: str
    header_icon: str
    object_icon: str
    @cached_property
    def index_url(self) -> str | None: ...
    @cached_property
    def edit_url(self) -> str | None: ...
    @cached_property
    def workflow_history_url(self) -> str | None: ...
    def get_breadcrumbs_items(self) -> list[dict[str, Any]]: ...
    def get_page_subtitle(self) -> str: ...
    @cached_property
    def header_buttons(self) -> list[HeaderButton]: ...
    @cached_property
    def workflow_state(self) -> WorkflowState: ...
    @cached_property
    def revisions(self) -> models.QuerySet[Revision]: ...
    @cached_property
    def tasks(self) -> models.QuerySet[Task]: ...
    @cached_property
    def task_states_by_revision(self) -> list[tuple[Revision, list[TaskState | None]]]: ...
    @cached_property
    def timeline(self) -> list[dict[str, Any]]: ...
    def get_context_data(self, **kwargs: Any) -> dict[str, Any]: ...
