activity.models.age_barrier
===========================

.. py:module:: activity.models.age_barrier


Classes
-------

.. autoapisummary::

   activity.models.age_barrier.AgeBarrier
   activity.models.age_barrier.ExactAgeBarrier
   activity.models.age_barrier.YearAgeBarrier


Module Contents
---------------

.. py:class:: AgeBarrier

   Holds various age barrier approaches available to the period. 


   .. py:attribute:: registry
      :type:  dict[str, type[AgeBarrier]]


   .. py:method:: __init_subclass__(name: str, **kwargs: object)
      :classmethod:



   .. py:method:: from_name(name: str, *args: object, **kwargs: object) -> AgeBarrier
      :classmethod:



   .. py:method:: is_too_young(birth_date: datetime.date | datetime.datetime, start_date: datetime.date, min_age: int) -> bool
      :abstractmethod:



   .. py:method:: is_too_old(birth_date: datetime.date | datetime.datetime, start_date: datetime.date, max_age: int) -> bool
      :abstractmethod:



.. py:class:: ExactAgeBarrier

   Bases: :py:obj:`AgeBarrier`


   Checks the age by exact date.

   The attendee can be 1 year too old (otherwise, the day the attendee
   is a day older than the max age, he'll be rejected - in other word
   the min age is exclusive, the max age is inclusive).



   .. py:method:: age(birth_date: datetime.date | datetime.datetime, start_date: datetime.date) -> int

      Calculates the age at the given date. 



   .. py:method:: is_too_young(birth_date: datetime.date | datetime.datetime, start_date: datetime.date, min_age: int) -> bool


   .. py:method:: is_too_old(birth_date: datetime.date | datetime.datetime, start_date: datetime.date, max_age: int) -> bool


.. py:class:: YearAgeBarrier

   Bases: :py:obj:`AgeBarrier`


   Checks the age by using the year of the start_date and the age.

   In German, we would say this is by "Jahrgang".
   The person must be of that age during the year of the start date.



   .. py:method:: is_too_young(birth_date: datetime.date | datetime.datetime, start_date: datetime.date, min_age: int) -> bool


   .. py:method:: is_too_old(birth_date: datetime.date | datetime.datetime, start_date: datetime.date, max_age: int) -> bool