# Path: messagebird/base.py
# class Base:
#     def load(self, data):
#         if data is not None:
#             for name, value in list(data.items()):
#                 if hasattr(self, name) and not callable(getattr(self, name)):
#                     setattr(self, name, value)
# 
#         return self
# 
#     @staticmethod
#     def value_to_time(value, format='%Y-%m-%dT%H:%M:%S+00:00'):
#         if value is not None:
#             return dateutil.parser.parse(value).replace(microsecond=0)
# 
# Path: messagebird/call_data.py
# class CallData(Base):
# 
#     def __init__(self):
#         self.id = None
#         self.status = None
#         self.source = None
#         self.destination = None
#         self._createdAt = None
#         self._updatedAt = None
#         self._endedAt = None
#         self._webhook = None
# 
#     @property
#     def updatedAt(self):
#         return self._updatedAt
# 
#     @updatedAt.setter
#     def updatedAt(self, value):
#         self._updatedAt = self.value_to_time(value, '%Y-%m-%dT%H:%M:%SZ')
# 
#     @property
#     def createdAt(self):
#         return self._createdAt
# 
#     @createdAt.setter
#     def createdAt(self, value):
#         self._createdAt = self.value_to_time(value, '%Y-%m-%dT%H:%M:%SZ')
# 
#     @property
#     def endedAt(self):
#         return self._endedAt
# 
#     @endedAt.setter
#     def endedAt(self, value):
#         self._endedAt = self.value_to_time(value, '%Y-%m-%dT%H:%M:%SZ')
# 
#     @property
#     def webhook(self):
#         return self._webhook
# 
#     @webhook.setter
#     def webhook(self, value):
#         self._webhook = Webhook.load(value)
# 
#     def __str__(self):
#         return "\n".join([
#             'id                 : %s' % self.id,
#             'status             : %s' % self.status,
#             'source             : %s' % self.source,
#             'destination        : %s' % self.destination,
#             'webhook            : %s' % self.webhook,
#             'updatedAt          : %s' % self.updatedAt,
#             'createdAt          : %s' % self.createdAt,
#             'endedAt            : %s' % self.endedAt,
#         ])


from messagebird.base import Base
from messagebird.call_data import CallData

CALL_STATUS_STARTING = "starting"
CALL_STATUS_ONGOING = "ongoing"
CALL_STATUS_ENDED = "ended"


class Call(Base):

    def __init__(self):
        self.id = None
        self._data = None

    @property
    def data(self):
        return self._data

    @data.setter
    def data(self, value):

# Path: messagebird/base.py
# class Base:
#     def load(self, data):
#         if data is not None:
#             for name, value in list(data.items()):
#                 if hasattr(self, name) and not callable(getattr(self, name)):
#                     setattr(self, name, value)
# 
#         return self
# 
#     @staticmethod
#     def value_to_time(value, format='%Y-%m-%dT%H:%M:%S+00:00'):
#         if value is not None:
#             return dateutil.parser.parse(value).replace(microsecond=0)
# 
# Path: messagebird/call_data.py
# class CallData(Base):
# 
#     def __init__(self):
#         self.id = None
#         self.status = None
#         self.source = None
#         self.destination = None
#         self._createdAt = None
#         self._updatedAt = None
#         self._endedAt = None
#         self._webhook = None
# 
#     @property
#     def updatedAt(self):
#         return self._updatedAt
# 
#     @updatedAt.setter
#     def updatedAt(self, value):
#         self._updatedAt = self.value_to_time(value, '%Y-%m-%dT%H:%M:%SZ')
# 
#     @property
#     def createdAt(self):
#         return self._createdAt
# 
#     @createdAt.setter
#     def createdAt(self, value):
#         self._createdAt = self.value_to_time(value, '%Y-%m-%dT%H:%M:%SZ')
# 
#     @property
#     def endedAt(self):
#         return self._endedAt
# 
#     @endedAt.setter
#     def endedAt(self, value):
#         self._endedAt = self.value_to_time(value, '%Y-%m-%dT%H:%M:%SZ')
# 
#     @property
#     def webhook(self):
#         return self._webhook
# 
#     @webhook.setter
#     def webhook(self, value):
#         self._webhook = Webhook.load(value)
# 
#     def __str__(self):
#         return "\n".join([
#             'id                 : %s' % self.id,
#             'status             : %s' % self.status,
#             'source             : %s' % self.source,
#             'destination        : %s' % self.destination,
#             'webhook            : %s' % self.webhook,
#             'updatedAt          : %s' % self.updatedAt,
#             'createdAt          : %s' % self.createdAt,
#             'endedAt            : %s' % self.endedAt,
#         ])


# Path: messagebird/call.py
from messagebird.base import Base
from messagebird.call_data import CallData


CALL_STATUS_STARTING = "starting"
CALL_STATUS_ONGOING = "ongoing"
CALL_STATUS_ENDED = "ended"


class Call(Base):

    def __init__(self):
        self.id = None
        self._data = None

    @property
    def data(self):
        return self._data

    @data.setter
    def data(self, value):

        self._data = CallData().load(value[0])