# Path: sexting/lib/transformer.py
# class Transformer(object):
# 
#     def can_handle_character(self, character):
#         False
# 
#     def can_handle_contact(self, contact, clock):
#         False
# 
#     def num_required_contacts(self):
#         0
# 
#     def transform(self, character, contacts, clock):
#         return 'Character: {0}'.format(character)
# 
# Path: sexting/lib/instruction.py
# class Instruction(object):
# 
#     def __init__(self, medium, character, clock, contact, data = {}):
#         self._medium = medium
#         self._character = character
#         self._clock = clock
#         self._contact = contact
#         self._data = data
# 
#     def medium(self):
#         return self._medium
# 
#     def character(self):
#         return self._character
# 
#     def clock(self):
#         return self._clock
# 
#     def contact(self):
#         return self._contact
# 
#     def data(self, key):
#         return self._data[key]
# 
#     def __str__(self):
#         data = ', '.join(map(lambda k: "{0}: {1}".format(k, self._data[k]), self._data))
#         return "For: '{0}', at {1}, {2}, should {3} ({4})".format(self._character, self._clock.block_range_str(), self._contact.get('name'), self._medium, data)


from ..lib.transformer import Transformer
from ..lib.instruction import Instruction
import utils

class BankWire(Transformer):

    def can_handle_character(self, character):
        return utils.is_character_rare2(character)

    def can_handle_contact(self, contact, clock):
        return contact.has('name')

    def num_required_contacts(self):
        return 2

    def transform(self, character, contacts, clock):
        contact_from, contact_to, odd = utils.rare2_character_transform(character, contacts, 'name')


# Path: sexting/lib/transformer.py
# class Transformer(object):
# 
#     def can_handle_character(self, character):
#         False
# 
#     def can_handle_contact(self, contact, clock):
#         False
# 
#     def num_required_contacts(self):
#         0
# 
#     def transform(self, character, contacts, clock):
#         return 'Character: {0}'.format(character)
# 
# Path: sexting/lib/instruction.py
# class Instruction(object):
# 
#     def __init__(self, medium, character, clock, contact, data = {}):
#         self._medium = medium
#         self._character = character
#         self._clock = clock
#         self._contact = contact
#         self._data = data
# 
#     def medium(self):
#         return self._medium
# 
#     def character(self):
#         return self._character
# 
#     def clock(self):
#         return self._clock
# 
#     def contact(self):
#         return self._contact
# 
#     def data(self, key):
#         return self._data[key]
# 
#     def __str__(self):
#         data = ', '.join(map(lambda k: "{0}: {1}".format(k, self._data[k]), self._data))
#         return "For: '{0}', at {1}, {2}, should {3} ({4})".format(self._character, self._clock.block_range_str(), self._contact.get('name'), self._medium, data)


# Path: sexting/transformers/bankwire.py
from ..lib.transformer import Transformer
from ..lib.instruction import Instruction
import utils


class BankWire(Transformer):

    def can_handle_character(self, character):
        return utils.is_character_rare2(character)

    def can_handle_contact(self, contact, clock):
        return contact.has('name')

    def num_required_contacts(self):
        return 2

    def transform(self, character, contacts, clock):
        contact_from, contact_to, odd = utils.rare2_character_transform(character, contacts, 'name')


        return Instruction('bankwire', character, clock, contact_from, {'to': contact_to, 'odd_pence': odd})