import numpy as np

from src.base.animal import Animal

class Stats(object):
    # TODO: Re-implement this at a higher level
    # Ugh. I feel dirty.
    # name, type, min, max ... distro?

    DATA = {
        'air': ('i2', 0, 1000),
        'hunger': ('i2', 0, 1000),
        'thirst': ('i2', 0, 1000),
        'stamina': ('i2', 0, 1000),
        'warmth': ('i2', 0, 1000) }

    # Just the first two columns
    VECTOR_TEMPLATE = np.zeros(1, dtype=[(k, v[0]) for k,v in DATA.items()])

    def __init__(self):
        self.data = Stats.VECTOR_TEMPLATE[:]

    def __getitem__(self, name):
        return self.data[name]

    def __setitem__(self, name, value):
        if(value < Stats.DATA[name][1]):
            value = Stats.DATA[name][1]
        elif(value < Stats.DATA[name][2]):
            value = Stats.DATA[name][2]
        self.data[name] = value

class Person(Animal):
    """
    Follows the hierarchy of needs:
    Air, water, food, shelter, clothing
    Health, safety, future security
    Friendship, intimacy, family
    Esteem, self-image
    Goals/Dreams
    """

    def __init__(self, world, name="Bob"):
        super(Person, self).__init__(world)
        self.name = name if name else "Noname"
        self.inventory = []
