from typing import Any
import functools

from django import forms
from django.db import models
from django.forms.boundfield import BoundField
from django.utils.functional import cached_property
from wagtail.admin.compare import FieldComparison

from .base import Panel

class FieldPanel(Panel):
    TEMPLATE_VAR: str
    read_only_output_template_name: str
    field_name: str
    widget: type[forms.Widget] | forms.Widget | None
    disable_comments: bool | None
    permission: str | None
    read_only: bool
    required_on_save: bool | None

    def __init__(
        self,
        field_name: str,
        widget: type[forms.Widget] | forms.Widget | None = None,
        disable_comments: bool | None = None,
        permission: str | None = None,
        read_only: bool = False,
        required_on_save: bool | None = None,
        **kwargs: str | type[forms.Form] | dict[str, str] | None,
    ) -> None: ...
    def clone_kwargs(self) -> dict[str, str | type[forms.Widget] | forms.Widget | bool | None]: ...
    def get_form_options(self) -> dict[str, list[str] | dict[str, str | forms.Widget | type[forms.Widget]]]: ...
    def get_comparison_class(self) -> type[FieldComparison]: ...
    @cached_property
    def db_field(self) -> models.Field[Any, Any]: ...
    @property
    def clean_name(self) -> str: ...
    def format_value_for_display(self, value: Any) -> str | Any: ...

    class BoundPanel(Panel.BoundPanel):
        template_name: str
        default_field_icons: dict[str, str]
        bound_field: BoundField | None
        read_only: bool

        def __init__(self, **kwargs: Panel | models.Model | forms.Form | str | None) -> None: ...
        @property
        def field_name(self) -> str: ...
        def is_shown(self) -> bool: ...
        def is_required(self) -> bool: ...
        def classes(self) -> list[str]: ...
        @property
        def icon(self) -> str | None: ...
        def id_for_label(self) -> str: ...
        @property
        def comments_enabled(self) -> bool: ...
        @cached_property
        def value_from_instance(self) -> Any: ...
        def get_context_data(self, parent_context: dict[str, Any] | None = None) -> dict[str, Any]: ...
        def get_editable_context_data(self) -> dict[str, Any]: ...
        def get_read_only_context_data(self) -> dict[str, Any]: ...
        def get_comparison(self) -> list[functools.partial[FieldComparison]]: ...
