"""
Provide presence roles.
"""
from __future__ import annotations
from typing import final
from typing_extensions import override
from betty.json.schema import Schema
from betty.locale.localizable import Localizable, _
from betty.plugin import Plugin, PluginRepository
from betty.plugin.entry_point import EntryPointPluginRepository
[docs]
class PresenceRole(Plugin):
"""
A person's role at an event.
Read more about :doc:`/development/plugin/presence-role`.
"""
pass
PRESENCE_ROLE_REPOSITORY: PluginRepository[PresenceRole] = EntryPointPluginRepository(
"betty.presence_role"
)
"""
The presence role plugin repository.
Read more about :doc:`/development/plugin/presence-role`.
"""
[docs]
class PresenceRoleSchema(Schema):
"""
A JSON Schema for presence roles.
"""
[docs]
def __init__(self):
super().__init__(def_name="presenceRole")
self._schema["type"] = "string"
self._schema["description"] = "A person's role in an event."
[docs]
@final
class Subject(PresenceRole):
"""
Someone was the subject of the event.
The meaning of this role depends on the event type. For example, for :py:class:`betty.ancestry.event_type.Marriage`,
the subjects are the people who got married. For :py:class:`betty.ancestry.event_type.Death` it is the person who
died.
"""
[docs]
@final
class Beneficiary(PresenceRole):
"""
Someone was a `benificiary <https://en.wikipedia.org/wiki/Beneficiary>`_ in the event, such as a :py:class:`betty.ancestry.event_type.Will`.
"""
[docs]
@final
class Celebrant(PresenceRole):
"""
Someone was the `celebrant <https://en.wikipedia.org/wiki/Officiant>`_ at the event.
This includes but is not limited to:
- civil servant
- religious leader
- civilian
"""