"""
$URL: svn+ssh://svn.mems-exchange.org/repos/trunk/dulcinea/lib/interaction.py $
$Id: interaction.py 29610 2007-03-14 21:12:59Z dbinger $
"""
from dulcinea.history import History
from qp.lib.spec import Mixin

class Interactable (Mixin):
    """
    Storage for a set of interaction events on an object of interest
    """
    interactions_is = History

    EMAIL = 'email'
    MAIL = 'mail'
    PHONE = 'phone'
    FAX = 'fax'
    OTHER = 'other'

    INTERACTION_CODES = (EMAIL, MAIL, PHONE, FAX, OTHER)

    def __init__(self):
        self.interactions = History()

    def get_interaction_history(self):
        return self.interactions

    def get_interaction_codes(self):
        return self.INTERACTION_CODES

    def record_interaction(self, user, code, comment):
        self.interactions.add_event(user, code, comment)


