from model.electronic_message import ElectronicMessage
from model.services import ApiServiceModel


class ElectronicPaymentEventInteractor(object):

    def __init__(self, api_service):
        # type: (ApiServiceModel) -> None

        self.api_service = api_service
        self.counter = 1

    def queue_message(self, electronic_messages):
        # type: (ElectronicMessage) -> None

        fake_pos_id = electronic_messages.pos_id  # TODO: Get the fake pos id here
        electronic_messages.pos_id = fake_pos_id
        electronic_messages.message_id = self.counter
        self.counter += 1

        self.api_service.send_electronic_messages(electronic_messages)
