text: #
  # Autogenerated by Thrift Compiler (0.9.3)
  #
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  #
  #  options string: py
  #
  
  from thrift.Thrift import TType, TMessageType, TException, TApplicationException
  
  from thrift.transport import TTransport
  from thrift.protocol import TBinaryProtocol, TProtocol
  try:
    from thrift.protocol import fastbinary
  except:
    fastbinary = None
  
  
  class CrudType:
    CREATE = 0
    READ = 1
    UPDATE = 2
    DELETE = 3
  
    _VALUES_TO_NAMES = {
      0: "CREATE",
      1: "READ",
      2: "UPDATE",
      3: "DELETE",
    }
  
    _NAMES_TO_VALUES = {
      "CREATE": 0,
      "READ": 1,
      "UPDATE": 2,
      "DELETE": 3,
    }
  
  class EntityType:
    USER_PROFILE = 0
    TENANT = 1
    GROUP = 2
    PROJECT = 3
    EXPERIMENT = 4
    APPLICATION = 5
    SHARING = 6
    REGISTRY = 7
  
    _VALUES_TO_NAMES = {
      0: "USER_PROFILE",
      1: "TENANT",
      2: "GROUP",
      3: "PROJECT",
      4: "EXPERIMENT",
      5: "APPLICATION",
      6: "SHARING",
      7: "REGISTRY",
    }
  
    _NAMES_TO_VALUES = {
      "USER_PROFILE": 0,
      "TENANT": 1,
      "GROUP": 2,
      "PROJECT": 3,
      "EXPERIMENT": 4,
      "APPLICATION": 5,
      "SHARING": 6,
      "REGISTRY": 7,
    }
  
  class DBEventType:
    PUBLISHER = 0
    SUBSCRIBER = 1
  
    _VALUES_TO_NAMES = {
      0: "PUBLISHER",
      1: "SUBSCRIBER",
    }
  
    _NAMES_TO_VALUES = {
      "PUBLISHER": 0,
      "SUBSCRIBER": 1,
    }
  
  
  class DBEventPublisherContext:
    """
    Attributes:
     - crudType
     - entityType
     - entityDataModel
    """
  
    thrift_spec = (
      None, # 0
      (1, TType.I32, 'crudType', None, None, ), # 1
      (2, TType.I32, 'entityType', None, None, ), # 2
      (3, TType.STRING, 'entityDataModel', None, None, ), # 3
    )
  
    def __init__(self, crudType=None, entityType=None, entityDataModel=None,):
      self.crudType = crudType
      self.entityType = entityType
      self.entityDataModel = entityDataModel
  
    def read(self, iprot):
      if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
        fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
        return
      iprot.readStructBegin()
      while True:
        (fname, ftype, fid) = iprot.readFieldBegin()
        if ftype == TType.STOP:
          break
        if fid == 1:
          if ftype == TType.I32:
            self.crudType = iprot.readI32()
          else:
            iprot.skip(ftype)
        elif fid == 2:
          if ftype == TType.I32:
            self.entityType = iprot.readI32()
          else:
            iprot.skip(ftype)
        elif fid == 3:
          if ftype == TType.STRING:
            self.entityDataModel = iprot.readString()
          else:
            iprot.skip(ftype)
        else:
          iprot.skip(ftype)
        iprot.readFieldEnd()
      iprot.readStructEnd()
  
    def write(self, oprot):
      if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
        oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
        return
      oprot.writeStructBegin('DBEventPublisherContext')
      if self.crudType is not None:
        oprot.writeFieldBegin('crudType', TType.I32, 1)
        oprot.writeI32(self.crudType)
        oprot.writeFieldEnd()
      if self.entityType is not None:
        oprot.writeFieldBegin('entityType', TType.I32, 2)
        oprot.writeI32(self.entityType)
        oprot.writeFieldEnd()
      if self.entityDataModel is not None:
        oprot.writeFieldBegin('entityDataModel', TType.STRING, 3)
        oprot.writeString(self.entityDataModel)
        oprot.writeFieldEnd()
      oprot.writeFieldStop()
      oprot.writeStructEnd()
  
    def validate(self):
      if self.crudType is None:
        raise TProtocol.TProtocolException(message='Required field crudType is unset!')
      if self.entityType is None:
        raise TProtocol.TProtocolException(message='Required field entityType is unset!')
      if self.entityDataModel is None:
        raise TProtocol.TProtocolException(message='Required field entityDataModel is unset!')
      return
  
  
    def __hash__(self):
      value = 17
      value = (value * 31) ^ hash(self.crudType)
      value = (value * 31) ^ hash(self.entityType)
      value = (value * 31) ^ hash(self.entityDataModel)
      return value
  
    def __repr__(self):
      L = ['%s=%r' % (key, value)
        for key, value in self.__dict__.iteritems()]
      return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
  
    def __eq__(self, other):
      return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
  
    def __ne__(self, other):
      return not (self == other)
  
  class DBEventPublisher:
    """
    Attributes:
     - publisherContext
    """
  
    thrift_spec = (
      None, # 0
      (1, TType.STRUCT, 'publisherContext', (DBEventPublisherContext, DBEventPublisherContext.thrift_spec), None, ), # 1
    )
  
    def __init__(self, publisherContext=None,):
      self.publisherContext = publisherContext
  
    def read(self, iprot):
      if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
        fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
        return
      iprot.readStructBegin()
      while True:
        (fname, ftype, fid) = iprot.readFieldBegin()
        if ftype == TType.STOP:
          break
        if fid == 1:
          if ftype == TType.STRUCT:
            self.publisherContext = DBEventPublisherContext()
            self.publisherContext.read(iprot)
          else:
            iprot.skip(ftype)
        else:
          iprot.skip(ftype)
        iprot.readFieldEnd()
      iprot.readStructEnd()
  
    def write(self, oprot):
      if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
        oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
        return
      oprot.writeStructBegin('DBEventPublisher')
      if self.publisherContext is not None:
        oprot.writeFieldBegin('publisherContext', TType.STRUCT, 1)
        self.publisherContext.write(oprot)
        oprot.writeFieldEnd()
      oprot.writeFieldStop()
      oprot.writeStructEnd()
  
    def validate(self):
      if self.publisherContext is None:
        raise TProtocol.TProtocolException(message='Required field publisherContext is unset!')
      return
  
  
    def __hash__(self):
      value = 17
      value = (value * 31) ^ hash(self.publisherContext)
      return value
  
    def __repr__(self):
      L = ['%s=%r' % (key, value)
        for key, value in self.__dict__.iteritems()]
      return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
  
    def __eq__(self, other):
      return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
  
    def __ne__(self, other):
      return not (self == other)
  
  class DBEventSubscriber:
    """
    Attributes:
     - subscriberService
    """
  
    thrift_spec = (
      None, # 0
      (1, TType.STRING, 'subscriberService', None, None, ), # 1
    )
  
    def __init__(self, subscriberService=None,):
      self.subscriberService = subscriberService
  
    def read(self, iprot):
      if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
        fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
        return
      iprot.readStructBegin()
      while True:
        (fname, ftype, fid) = iprot.readFieldBegin()
        if ftype == TType.STOP:
          break
        if fid == 1:
          if ftype == TType.STRING:
            self.subscriberService = iprot.readString()
          else:
            iprot.skip(ftype)
        else:
          iprot.skip(ftype)
        iprot.readFieldEnd()
      iprot.readStructEnd()
  
    def write(self, oprot):
      if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
        oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
        return
      oprot.writeStructBegin('DBEventSubscriber')
      if self.subscriberService is not None:
        oprot.writeFieldBegin('subscriberService', TType.STRING, 1)
        oprot.writeString(self.subscriberService)
        oprot.writeFieldEnd()
      oprot.writeFieldStop()
      oprot.writeStructEnd()
  
    def validate(self):
      if self.subscriberService is None:
        raise TProtocol.TProtocolException(message='Required field subscriberService is unset!')
      return
  
  
    def __hash__(self):
      value = 17
      value = (value * 31) ^ hash(self.subscriberService)
      return value
  
    def __repr__(self):
      L = ['%s=%r' % (key, value)
        for key, value in self.__dict__.iteritems()]
      return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
  
    def __eq__(self, other):
      return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
  
    def __ne__(self, other):
      return not (self == other)
  
  class DBEventMessageContext:
    """
    Attributes:
     - publisher
     - subscriber
    """
  
    thrift_spec = (
      None, # 0
      (1, TType.STRUCT, 'publisher', (DBEventPublisher, DBEventPublisher.thrift_spec), None, ), # 1
      (2, TType.STRUCT, 'subscriber', (DBEventSubscriber, DBEventSubscriber.thrift_spec), None, ), # 2
    )
  
    def __init__(self, publisher=None, subscriber=None,):
      self.publisher = publisher
      self.subscriber = subscriber
  
    def read(self, iprot):
      if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
        fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
        return
      iprot.readStructBegin()
      while True:
        (fname, ftype, fid) = iprot.readFieldBegin()
        if ftype == TType.STOP:
          break
        if fid == 1:
          if ftype == TType.STRUCT:
            self.publisher = DBEventPublisher()
            self.publisher.read(iprot)
          else:
            iprot.skip(ftype)
        elif fid == 2:
          if ftype == TType.STRUCT:
            self.subscriber = DBEventSubscriber()
            self.subscriber.read(iprot)
          else:
            iprot.skip(ftype)
        else:
          iprot.skip(ftype)
        iprot.readFieldEnd()
      iprot.readStructEnd()
  
    def write(self, oprot):
      if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
        oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
        return
      oprot.writeStructBegin('DBEventMessageContext')
      if self.publisher is not None:
        oprot.writeFieldBegin('publisher', TType.STRUCT, 1)
        self.publisher.write(oprot)
        oprot.writeFieldEnd()
      if self.subscriber is not None:
        oprot.writeFieldBegin('subscriber', TType.STRUCT, 2)
        self.subscriber.write(oprot)
        oprot.writeFieldEnd()
      oprot.writeFieldStop()
      oprot.writeStructEnd()
  
    def validate(self):
      return
  
  
    def __hash__(self):
      value = 17
      value = (value * 31) ^ hash(self.publisher)
      value = (value * 31) ^ hash(self.subscriber)
      return value
  
    def __repr__(self):
      L = ['%s=%r' % (key, value)
        for key, value in self.__dict__.iteritems()]
      return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
  
    def __eq__(self, other):
      return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
  
    def __ne__(self, other):
      return not (self == other)
  
  class DBEventMessage:
    """
    Attributes:
     - dbEventType
     - messageContext
     - publisherService
    """
  
    thrift_spec = (
      None, # 0
      (1, TType.I32, 'dbEventType', None, None, ), # 1
      (2, TType.STRUCT, 'messageContext', (DBEventMessageContext, DBEventMessageContext.thrift_spec), None, ), # 2
      (3, TType.STRING, 'publisherService', None, None, ), # 3
    )
  
    def __init__(self, dbEventType=None, messageContext=None, publisherService=None,):
      self.dbEventType = dbEventType
      self.messageContext = messageContext
      self.publisherService = publisherService
  
    def read(self, iprot):
      if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
        fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
        return
      iprot.readStructBegin()
      while True:
        (fname, ftype, fid) = iprot.readFieldBegin()
        if ftype == TType.STOP:
          break
        if fid == 1:
          if ftype == TType.I32:
            self.dbEventType = iprot.readI32()
          else:
            iprot.skip(ftype)
        elif fid == 2:
          if ftype == TType.STRUCT:
            self.messageContext = DBEventMessageContext()
            self.messageContext.read(iprot)
          else:
            iprot.skip(ftype)
        elif fid == 3:
          if ftype == TType.STRING:
            self.publisherService = iprot.readString()
          else:
            iprot.skip(ftype)
        else:
          iprot.skip(ftype)
        iprot.readFieldEnd()
      iprot.readStructEnd()
  
    def write(self, oprot):
      if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
        oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
        return
      oprot.writeStructBegin('DBEventMessage')
      if self.dbEventType is not None:
        oprot.writeFieldBegin('dbEventType', TType.I32, 1)
        oprot.writeI32(self.dbEventType)
        oprot.writeFieldEnd()
      if self.messageContext is not None:
        oprot.writeFieldBegin('messageContext', TType.STRUCT, 2)
        self.messageContext.write(oprot)
        oprot.writeFieldEnd()
      if self.publisherService is not None:
        oprot.writeFieldBegin('publisherService', TType.STRING, 3)
        oprot.writeString(self.publisherService)
        oprot.writeFieldEnd()
      oprot.writeFieldStop()
      oprot.writeStructEnd()
  
    def validate(self):
      if self.dbEventType is None:
        raise TProtocol.TProtocolException(message='Required field dbEventType is unset!')
      if self.messageContext is None:
        raise TProtocol.TProtocolException(message='Required field messageContext is unset!')
      if self.publisherService is None:
        raise TProtocol.TProtocolException(message='Required field publisherService is unset!')
      return
  
  
    def __hash__(self):
      value = 17
      value = (value * 31) ^ hash(self.dbEventType)
      value = (value * 31) ^ hash(self.messageContext)
      value = (value * 31) ^ hash(self.publisherService)
      return value
  
    def __repr__(self):
      L = ['%s=%r' % (key, value)
        for key, value in self.__dict__.iteritems()]
      return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
  
    def __eq__(self, other):
      return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
  
    def __ne__(self, other):
      return not (self == other)
  