from .initializer import Initializer


class InitializerCharacInterface(Initializer):
    """
    initializer used to initialize a Characteristic from the interface.

    An initializer is created from a dictionary. the format is the following:

    - name: name of the initializer used as id
    - value_type: for Characteristic, the type of the value (as string)
    - subclass_initializer: name of sub initializer used to initialize sub BaseObject. \
                          These initializers must already exist in the game
    - value_mode: mode of the interface initialization : INIT_TYPE_*
    - param: for INIT_TYPE_DICE, string representing the dice and INIT_TYPE_CHOICE, list of tuples (description, value)

    :param game: the game where the initializer is created
    :param initializer_dict: the dictionary used to create the initializer
    """

    """ Value is chosen in the interface"""
    INIT_TYPE_VALUE = 'value'
    """ value is chosen by a dice interface"""
    INIT_TYPE_DICE = 'dice'
    """ value is chosen in the interface among some choices"""
    INIT_TYPE_CHOICE = 'choice'

    def __init__(self, game, initializer_dict: dict) -> None:
        super().__init__(game, initializer_dict)
        self.initializer_type = initializer_dict['init_type']
        self.value_mode = initializer_dict.get('value_mode')
        self.param = initializer_dict.get('param', None)
        self.init_type = self.INIT_TYPE_INTERFACE
