"""
This program has been developed by students from the bachelor Computer Science at Utrecht
University within the Software Project course.
© Copyright Utrecht University (Department of Information and Computing Sciences)
"""

import logging
from abc import ABC

from control_backend.core.agent_system import BaseAgent as CoreBaseAgent


class BaseAgent(CoreBaseAgent, ABC):
    """
    The primary base class for all implementation agents.

    Inherits from :class:`control_backend.core.agent_system.BaseAgent`.
    This class ensures that every agent instance is automatically equipped with a
    properly configured ``logger``.

    :ivar logger: A logger instance named after the agent's package and class.
    """

    logger: logging.Logger

    def __init_subclass__(cls, **kwargs) -> None:
        """
        Whenever a subclass is initiated, give it the correct logger.
        :param kwargs: Keyword arguments for the subclass.
        """
        super().__init_subclass__(**kwargs)

        cls.logger = logging.getLogger(__package__).getChild(cls.__name__)
