from typing import Optional, Any


class Controller:
    """
    Abstract controller to control an agent in the environment

    :param environment: environment for the controller
    """

    def __init__(self, environment) -> None:
        self.environment = environment

    def action_choice(self, observation, agent):
        """
        Choose the action.

        :param observation: the observation used to choose the action.
        :param agent: the agent who choose the action.
        :return: the action chosen for the agent.
        """
        pass

    def on_observe(self, observation, reward: Optional[Any] = None):
        """
        do something when the agent observes the state and possibly a reward.

        Usefull for learning controllers.
        """
        pass
