"""
Defines the abstract base class GameGoal. Concrete implementations of this class represent goals that
can be achieved in a game.

It generally implements pseudo code from the book "Artificial Intelligence for Games", Second Edtion, by
Ian Millington and John Funge, Chapter 5, Section 5.7.2-3, 2009.

Concrete implementation child classes of GameGoal must:
    (1) Implement the method getInsistence(), which is called to get the insistence value of the goal.

Exported Classes:
    GameGoal -- Abstract base class representing a goal in a goal-oriented behavior (GOB) system for decision making by game AI.
    GoalInsistence -- Enumeration representing the insistence values of goals in a goal-oriented behavior (GOB) system for decision making by game AI.
                      Creates a scale where each higher level of urgency/importance is double the previous level.

Exported Exceptions:
    None
    
Exceptions raised:
    None
 
Exported Functions:
    None
"""


# standard imports
from enum import IntEnum

# local imports

class GoalInsistence(IntEnum):
    """
    This class represents the insistence values of goals in a goal-oriented behavior (GOB) system for decision making by game AI.
    """
    ZERO = 0
    LOW = 2
    MEDIUM = 4
    HIGH = 8
    VERY_HIGH = 16
    URGENT = 32


class GameGoal(object):
    """
    This class represents a goal within a goal-oriented behavior (GOB) system for decicion making by game AI.
    """
    def __init__(self, name='a goal'):
        """
        :parameter name: The name of the goal, as string.
        """
        self._name=name

    @property
    def name(self):
        """
        Return the name of the goal.
        :return: The name of the goal, as string.
        """
        return self._name

    def __str__(self):
        """
        Return the string representation of the goal.
        :return: The string representation of the goal, as string.
        """
        return f"Goal: {self._name}"

    def getInsistence(self):
        """
        Return the insistence value of the goal. This method should be overridden by subclasses to provide specific goal behavior.
        The insistence value indicates the urgency or importance of achieving the goal, with higher values representing greater urgency/importance.
        Raises NotImplementedError if the method is not implemented in a subclass.
        :return: The insistence value of the goal, int
        """
        raise NotImplementedError("Subclasses must implement this method.")
