from source.behaviors import roles
from source.managers import Manager


class RoleManager:
    """
    Role Manager
    Responsible for the passive behavior of the machine and sending packets
    """
    def __init__(self, manager: "Manager"):
        self.manager = manager

        # the currently used role
        self.current: roles.base.BaseRole = roles.UndefinedRole(self.manager)

    def handle(self) -> None:
        """
        Run the role
        """

        self.current.handle()

    def loop(self) -> None:
        """
        Handle forever
        """

        while True:
            self.handle()
