from typing import Any, Self
import uuid

from django.core.checks.messages import CheckMessage
from django.db import migrations, models

def pk(obj: models.Model | int | str) -> int | str: ...

class LocaleManager(models.Manager["Locale"]):
    def get_for_language(self, language_code: str) -> Locale: ...

class Locale(models.Model):
    language_code: models.CharField[str, str]
    objects: LocaleManager  # type: ignore[assignment]
    all_objects: models.Manager[Locale]

    class Meta:
        ordering: list[str]

    @classmethod
    def get_default(cls) -> Locale: ...
    @classmethod
    def get_active(cls) -> Locale: ...
    def delete(
        self,
        using: str | None = None,
        keep_parents: bool = False,
    ) -> tuple[int, dict[str, int]]: ...
    def language_code_is_valid(self) -> bool: ...
    def get_display_name(self) -> str: ...
    def _get_language_info(self) -> dict[str, str]: ...
    @property
    def language_info(self) -> dict[str, str]: ...
    @property
    def language_name(self) -> str: ...
    @property
    def language_name_local(self) -> str: ...
    @property
    def language_name_localized(self) -> str: ...
    @property
    def is_bidi(self) -> bool: ...
    @property
    def is_default(self) -> bool: ...
    @property
    def is_active(self) -> bool: ...

class TranslatableMixin(models.Model):
    translation_key: models.UUIDField[str | uuid.UUID, uuid.UUID]
    locale: models.ForeignKey[Locale, Locale]

    class Meta:
        abstract: bool
        unique_together: list[tuple[str, str]]

    @classmethod
    def check(cls, **kwargs: Any) -> list[CheckMessage]: ...
    @property
    def localized(self) -> Self: ...
    @property
    def localized_draft(self) -> Self: ...
    def get_translations(self, inclusive: bool = False) -> models.QuerySet[Self]: ...
    def get_translation(self, locale: Locale | int) -> Self: ...
    def get_translation_or_none(self, locale: Locale | int) -> Self | None: ...
    def has_translation(self, locale: Locale | int) -> bool: ...
    def copy_for_translation(
        self,
        locale: Locale,
        exclude_fields: list[str] | None = None,
    ) -> Self: ...
    def get_default_locale(self) -> Locale: ...
    @classmethod
    def get_translation_model(cls) -> type[TranslatableMixin]: ...

def bootstrap_translatable_model(model: type[models.Model], locale: Locale) -> None: ...

class BootstrapTranslatableModel(migrations.RunPython):
    def __init__(self, model_string: str, language_code: str | None = None) -> None: ...

class BootstrapTranslatableMixin(TranslatableMixin):
    translation_key: models.UUIDField[str | uuid.UUID | None, uuid.UUID | None]  # type: ignore[assignment]
    locale: models.ForeignKey[Locale | None, Locale | None]  # type: ignore[assignment]

    class Meta:
        abstract: bool

    @classmethod
    def check(cls, **kwargs: Any) -> list[CheckMessage]: ...

def get_translatable_models(include_subclasses: bool = False) -> list[type[TranslatableMixin]]: ...
def set_locale_on_new_instance(sender: type, instance: models.Model, **kwargs: Any) -> None: ...
