"""
Provide the Note entity type and utilities.
"""
from __future__ import annotations
from typing import final, TYPE_CHECKING
from typing_extensions import override
from betty.ancestry.link import HasLinks
from betty.locale.localizable import (
_,
RequiredStaticTranslationsLocalizableAttr,
ShorthandStaticTranslations,
Localizable,
)
from betty.model import UserFacingEntity, Entity
from betty.model.association import (
ToOneResolver,
BidirectionalToZeroOrOne,
ToZeroOrOneResolver,
)
from betty.plugin import ShorthandPluginBase
from betty.privacy import HasPrivacy, Privacy
if TYPE_CHECKING:
from betty.ancestry.has_notes import HasNotes
from betty.serde.dump import DumpMapping, Dump
from betty.project import Project
[docs]
@final
class Note(ShorthandPluginBase, UserFacingEntity, HasPrivacy, HasLinks, Entity):
"""
A note is a bit of textual information that can be associated with another entity.
"""
_plugin_id = "note"
_plugin_label = _("Note")
#: The entity the note belongs to.
entity = BidirectionalToZeroOrOne["Note", "HasNotes"](
"betty.ancestry.note:Note",
"entity",
"betty.ancestry.has_notes:HasNotes",
"notes",
title="Entity",
description="The entity the note belongs to",
)
#: The human-readable note text.
text = RequiredStaticTranslationsLocalizableAttr("text", title="Text")