from typing import Any

from django.db import models
from django.utils.functional import cached_property as cached_property
from wagtail import hooks as hooks
from wagtail.admin.checks import check_panels_in_model as check_panels_in_model
from wagtail.admin.panels import (
    ObjectList as ObjectList,
)
from wagtail.admin.panels import (
    extract_panel_definitions_from_model_class as extract_panel_definitions_from_model_class,
)
from wagtail.admin.ui.components import MediaContainer as MediaContainer
from wagtail.admin.ui.menus import MenuItem as MenuItem
from wagtail.admin.ui.side_panels import ChecksSidePanel as ChecksSidePanel
from wagtail.admin.ui.side_panels import PreviewSidePanel as PreviewSidePanel
from wagtail.admin.ui.tables import (
    BulkActionsCheckboxColumn as BulkActionsCheckboxColumn,
)
from wagtail.admin.ui.tables import (
    NumberColumn as NumberColumn,
)
from wagtail.admin.ui.tables import (
    TitleColumn as TitleColumn,
)
from wagtail.admin.views import generic as generic
from wagtail.admin.views.generic import history as history
from wagtail.admin.views.generic import lock as lock
from wagtail.admin.views.generic import workflow as workflow
from wagtail.admin.views.generic.permissions import PermissionCheckedMixin as PermissionCheckedMixin
from wagtail.admin.views.generic.preview import (
    PreviewOnCreate as PreviewOnCreate,
)
from wagtail.admin.views.generic.preview import (
    PreviewOnEdit as PreviewOnEdit,
)
from wagtail.admin.views.generic.preview import (
    PreviewRevision as PreviewRevision,
)
from wagtail.admin.viewsets import viewsets as viewsets
from wagtail.admin.viewsets.model import ModelViewSet as ModelViewSet
from wagtail.admin.viewsets.model import ModelViewSetGroup as ModelViewSetGroup
from wagtail.admin.widgets.button import (
    BaseButton as BaseButton,
)
from wagtail.admin.widgets.button import (
    Button as Button,
)
from wagtail.admin.widgets.button import (
    ButtonWithDropdown as ButtonWithDropdown,
)
from wagtail.models import (
    DraftStateMixin as DraftStateMixin,
)
from wagtail.models import (
    LockableMixin as LockableMixin,
)
from wagtail.models import (
    PreviewableMixin as PreviewableMixin,
)
from wagtail.models import (
    RevisionMixin as RevisionMixin,
)
from wagtail.models import (
    WorkflowMixin as WorkflowMixin,
)
from wagtail.permissions import ModelPermissionPolicy as ModelPermissionPolicy
from wagtail.snippets.action_menu import SnippetActionMenu as SnippetActionMenu
from wagtail.snippets.models import (
    SnippetAdminURLFinder as SnippetAdminURLFinder,
)
from wagtail.snippets.models import (
    get_snippet_models as get_snippet_models,
)
from wagtail.snippets.side_panels import SnippetStatusSidePanel as SnippetStatusSidePanel
from wagtail.snippets.views.chooser import SnippetChooserViewSet as SnippetChooserViewSet

def get_snippet_model_from_url_params(app_name, model_name): ...
def get_snippet_models_for_index_view(): ...

class ModelIndexView(generic.BaseListingView):
    page_title: str
    header_icon: str
    index_url_name: str
    default_ordering: str
    snippet_types: list[dict[str, Any]]
    def setup(self, request, *args, **kwargs) -> None: ...
    def dispatch(self, request, *args, **kwargs): ...
    def get_list_url(self, model): ...
    def get_queryset(self) -> None: ...
    @cached_property
    def columns(self): ...
    def get_context_data(self, **kwargs): ...
    def get_template_names(self): ...

class IndexView(generic.IndexViewOptionalFeaturesMixin, generic.IndexView):
    view_name: str
    queryset: Any
    def get_base_queryset(self): ...
    @cached_property
    def columns(self): ...
    def get_list_buttons(self, instance): ...

class CreateView(generic.CreateEditViewOptionalFeaturesMixin, generic.CreateView):
    view_name: str
    template_name: str
    def run_before_hook(self): ...
    def run_after_hook(self): ...
    def get_side_panels(self): ...
    def get_context_data(self, **kwargs): ...

class CopyView(generic.CopyViewMixin, CreateView): ...

class EditView(generic.CreateEditViewOptionalFeaturesMixin, generic.EditView):
    view_name: str
    template_name: str
    def run_before_hook(self): ...
    def run_after_hook(self): ...
    def get_side_panels(self): ...
    def get_context_data(self, **kwargs): ...

class DeleteView(generic.DeleteView):
    view_name: str
    def run_before_hook(self): ...
    def run_after_hook(self): ...

class UsageView(generic.UsageView):
    view_name: str

class HistoryView(history.HistoryView):
    view_name: str

class InspectView(generic.InspectView):
    view_name: str

class PreviewOnCreateView(PreviewOnCreate): ...
class PreviewOnEditView(PreviewOnEdit): ...

class PreviewRevisionView(PermissionCheckedMixin, PreviewRevision):
    permission_required: str

class RevisionsCompareView(PermissionCheckedMixin, generic.RevisionsCompareView):
    permission_required: str

class UnpublishView(PermissionCheckedMixin, generic.UnpublishView):
    permission_required: str

class RevisionsUnscheduleView(PermissionCheckedMixin, generic.RevisionsUnscheduleView):
    permission_required: str

class LockView(PermissionCheckedMixin, lock.LockView):
    permission_required: str
    def user_has_permission(self, permission): ...

class UnlockView(PermissionCheckedMixin, lock.UnlockView):
    permission_required: str
    def user_has_permission(self, permission): ...

class WorkflowActionView(workflow.WorkflowAction): ...
class CollectWorkflowActionDataView(workflow.CollectWorkflowActionData): ...
class ConfirmWorkflowCancellationView(workflow.ConfirmWorkflowCancellation): ...
class WorkflowPreviewView(workflow.PreviewRevisionForTask): ...

class WorkflowHistoryView(PermissionCheckedMixin, history.WorkflowHistoryView):
    permission_required: str

class WorkflowHistoryDetailView(PermissionCheckedMixin, history.WorkflowHistoryDetailView):
    permission_required: str

class ReorderView(generic.ReorderView):
    @cached_property
    def permission_required(self): ...

class SnippetViewSet(ModelViewSet):
    model: type[models.Model] | None
    chooser_per_page: int
    admin_url_namespace: str | None
    base_url_path: str | None
    chooser_admin_url_namespace: str | None
    chooser_base_url_path: str | None
    index_view_class: type[IndexView]
    add_view_class: type[CreateView]
    copy_view_class: type[CopyView]
    edit_view_class: type[EditView]
    delete_view_class: type[DeleteView]
    usage_view_class: type[UsageView]
    history_view_class: type[HistoryView]
    inspect_view_class: type[InspectView]
    reorder_view_class: type[ReorderView]
    revisions_view_class: type[PreviewRevisionView]
    revisions_compare_view_class: type[RevisionsCompareView]
    revisions_unschedule_view_class: type[RevisionsUnscheduleView]
    unpublish_view_class: type[UnpublishView]
    preview_on_add_view_class: type[PreviewOnCreateView]
    preview_on_edit_view_class: type[PreviewOnEditView]
    lock_view_class: type[LockView]
    unlock_view_class: type[UnlockView]
    workflow_action_view_class: type[WorkflowActionView]
    collect_workflow_action_data_view_class: type[CollectWorkflowActionDataView]
    confirm_workflow_cancellation_view_class: type[ConfirmWorkflowCancellationView]
    workflow_preview_view_class: type[WorkflowPreviewView]
    workflow_history_view_class: type[WorkflowHistoryView]
    workflow_history_detail_view_class: type[WorkflowHistoryDetailView]
    chooser_viewset_class: type[SnippetChooserViewSet]
    template_prefix: str
    model_opts: Any
    app_label: str
    model_name: str
    preview_enabled: bool
    revision_enabled: bool
    draftstate_enabled: bool
    workflow_enabled: bool
    locking_enabled: bool
    menu_item_is_registered: bool
    def __init__(self, **kwargs) -> None: ...
    @cached_property
    def url_prefix(self): ...
    @cached_property
    def url_namespace(self): ...
    @property
    def revisions_revert_view_class(self): ...
    @property
    def permission_policy(self): ...
    def get_common_view_kwargs(self, **kwargs): ...
    def get_index_view_kwargs(self, **kwargs): ...
    def get_add_view_kwargs(self, **kwargs): ...
    def get_copy_view_kwargs(self, **kwargs): ...
    def get_edit_view_kwargs(self, **kwargs): ...
    @property
    def revisions_view(self): ...
    @property
    def revisions_revert_view(self): ...
    @property
    def revisions_compare_view(self): ...
    @property
    def revisions_unschedule_view(self): ...
    @property
    def unpublish_view(self): ...
    @property
    def preview_on_add_view(self): ...
    @property
    def preview_on_edit_view(self): ...
    @property
    def lock_view(self): ...
    @property
    def copy_view(self): ...
    @property
    def unlock_view(self): ...
    @property
    def workflow_action_view(self): ...
    @property
    def collect_workflow_action_data_view(self): ...
    @property
    def confirm_workflow_cancellation_view(self): ...
    @property
    def workflow_preview_view(self): ...
    @property
    def workflow_history_view(self): ...
    @property
    def workflow_history_detail_view(self): ...
    @property
    def chooser_viewset(self): ...
    @cached_property
    def icon(self): ...
    def get_icon(self): ...
    @cached_property
    def menu_label(self): ...
    def get_menu_label(self): ...
    @cached_property
    def menu_name(self): ...
    def get_menu_name(self): ...
    @cached_property
    def menu_icon(self): ...
    def get_menu_icon(self): ...
    @cached_property
    def menu_order(self): ...
    def get_menu_order(self): ...
    def get_menu_item_is_registered(self): ...
    @property
    def breadcrumbs_items(self): ...
    def get_queryset(self, request) -> None: ...
    @cached_property
    def index_template_name(self): ...
    def get_index_template(self): ...
    @cached_property
    def index_results_template_name(self): ...
    def get_index_results_template(self): ...
    @cached_property
    def create_template_name(self): ...
    def get_create_template(self): ...
    @cached_property
    def edit_template_name(self): ...
    def get_edit_template(self): ...
    @cached_property
    def delete_template_name(self): ...
    def get_delete_template(self): ...
    @cached_property
    def history_template_name(self): ...
    def get_history_template(self): ...
    @cached_property
    def inspect_template_name(self): ...
    def get_inspect_template(self): ...
    def get_admin_url_namespace(self): ...
    def get_admin_base_path(self): ...
    def get_chooser_admin_url_namespace(self): ...
    def get_chooser_admin_base_path(self): ...
    @property
    def url_finder_class(self): ...
    def get_urlpatterns(self): ...
    def get_edit_handler(self): ...
    def register_chooser_viewset(self) -> None: ...
    def register_model_check(self): ...
    def register_snippet_model(self): ...
    def on_register(self) -> None: ...

class SnippetViewSetGroup(ModelViewSetGroup):
    def __init__(self) -> None: ...
