from typing import Optional, Dict


class Event(object):
    def __init__(self, subject, event_type=None, data=None, source=0, synchronous=False, timeout=-1, headers=None):
        # type: (str, Optional[str], Optional[bytes], int, bool, int, Optional[Dict[str, str]]) -> None
        self.subject = subject
        self.event_type = event_type
        self.source = source
        self.data = data
        self.synchronous = synchronous
        self.timeout = timeout
        self.headers = headers if headers is not None else {}
        self.imp_message = None

    def __str__(self):
        # type: () -> str
        return str({
            "subject": self.subject,
            "event_type": self.event_type,
            "synchronous": self.synchronous,
            "timeout": self.timeout,
            "headers": self.headers
        })
