#
# Autogenerated by Thrift
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#

from thrift.Thrift import *

from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
try:
  from thrift.protocol import fastbinary
except:
  fastbinary = None


class DestinationType:
  TOPIC = 0
  QUEUE = 1
  VIRTUAL_QUEUE = 2

class ActionType:
  PUBLISH = 0
  POLL = 1
  ACCEPTED = 2
  ACKNOWLEDGE = 3
  SUBSCRIBE = 4
  UNSUBSCRIBE = 5
  NOTIFICATION = 6
  FAULT = 7
  PING = 8
  PONG = 9
  AUTH = 10

class Header:
  """
  Attributes:
   - parameters
  """

  thrift_spec = (
    None, # 0
    (1, TType.MAP, 'parameters', (TType.STRING,None,TType.STRING,None), None, ), # 1
  )

  def __init__(self, parameters=None,):
    self.parameters = parameters

  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.MAP:
          self.parameters = {}
          (_ktype1, _vtype2, _size0 ) = iprot.readMapBegin() 
          for _i4 in xrange(_size0):
            _key5 = iprot.readString();
            _val6 = iprot.readString();
            self.parameters[_key5] = _val6
          iprot.readMapEnd()
        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('Header')
    if self.parameters != None:
      oprot.writeFieldBegin('parameters', TType.MAP, 1)
      oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.parameters))
      for kiter7,viter8 in self.parameters.items():
        oprot.writeString(kiter7)
        oprot.writeString(viter8)
      oprot.writeMapEnd()
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  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 BrokerMessage:
  """
  Attributes:
   - message_id
   - payload
   - expiration
   - timestamp
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'message_id', None, None, ), # 1
    (2, TType.STRING, 'payload', None, None, ), # 2
    (3, TType.I64, 'expiration', None, None, ), # 3
    (4, TType.I64, 'timestamp', None, None, ), # 4
  )

  def __init__(self, message_id=None, payload=None, expiration=None, timestamp=None,):
    self.message_id = message_id
    self.payload = payload
    self.expiration = expiration
    self.timestamp = timestamp

  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.message_id = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.payload = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I64:
          self.expiration = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I64:
          self.timestamp = iprot.readI64();
        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('BrokerMessage')
    if self.message_id != None:
      oprot.writeFieldBegin('message_id', TType.STRING, 1)
      oprot.writeString(self.message_id)
      oprot.writeFieldEnd()
    if self.payload != None:
      oprot.writeFieldBegin('payload', TType.STRING, 2)
      oprot.writeString(self.payload)
      oprot.writeFieldEnd()
    if self.expiration != None:
      oprot.writeFieldBegin('expiration', TType.I64, 3)
      oprot.writeI64(self.expiration)
      oprot.writeFieldEnd()
    if self.timestamp != None:
      oprot.writeFieldBegin('timestamp', TType.I64, 4)
      oprot.writeI64(self.timestamp)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  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 Publish:
  """
  Attributes:
   - action_id
   - destination_type
   - destination
   - message
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'action_id', None, None, ), # 1
    (2, TType.I32, 'destination_type', None, None, ), # 2
    (3, TType.STRING, 'destination', None, None, ), # 3
    (4, TType.STRUCT, 'message', (BrokerMessage, BrokerMessage.thrift_spec), None, ), # 4
  )

  def __init__(self, action_id=None, destination_type=None, destination=None, message=None,):
    self.action_id = action_id
    self.destination_type = destination_type
    self.destination = destination
    self.message = message

  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.action_id = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I32:
          self.destination_type = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.STRING:
          self.destination = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.STRUCT:
          self.message = BrokerMessage()
          self.message.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('Publish')
    if self.action_id != None:
      oprot.writeFieldBegin('action_id', TType.STRING, 1)
      oprot.writeString(self.action_id)
      oprot.writeFieldEnd()
    if self.destination_type != None:
      oprot.writeFieldBegin('destination_type', TType.I32, 2)
      oprot.writeI32(self.destination_type)
      oprot.writeFieldEnd()
    if self.destination != None:
      oprot.writeFieldBegin('destination', TType.STRING, 3)
      oprot.writeString(self.destination)
      oprot.writeFieldEnd()
    if self.message != None:
      oprot.writeFieldBegin('message', TType.STRUCT, 4)
      self.message.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  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 Poll:
  """
  Attributes:
   - action_id
   - destination
   - timeout
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'action_id', None, None, ), # 1
    (2, TType.STRING, 'destination', None, None, ), # 2
    (3, TType.I64, 'timeout', None, None, ), # 3
  )

  def __init__(self, action_id=None, destination=None, timeout=None,):
    self.action_id = action_id
    self.destination = destination
    self.timeout = timeout

  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.action_id = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.destination = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I64:
          self.timeout = iprot.readI64();
        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('Poll')
    if self.action_id != None:
      oprot.writeFieldBegin('action_id', TType.STRING, 1)
      oprot.writeString(self.action_id)
      oprot.writeFieldEnd()
    if self.destination != None:
      oprot.writeFieldBegin('destination', TType.STRING, 2)
      oprot.writeString(self.destination)
      oprot.writeFieldEnd()
    if self.timeout != None:
      oprot.writeFieldBegin('timeout', TType.I64, 3)
      oprot.writeI64(self.timeout)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  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 Accepted:
  """
  Attributes:
   - action_id
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'action_id', None, None, ), # 1
  )

  def __init__(self, action_id=None,):
    self.action_id = action_id

  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.action_id = 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('Accepted')
    if self.action_id != None:
      oprot.writeFieldBegin('action_id', TType.STRING, 1)
      oprot.writeString(self.action_id)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  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 Acknowledge:
  """
  Attributes:
   - action_id
   - message_id
   - destination
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'action_id', None, None, ), # 1
    (2, TType.STRING, 'message_id', None, None, ), # 2
    (3, TType.STRING, 'destination', None, None, ), # 3
  )

  def __init__(self, action_id=None, message_id=None, destination=None,):
    self.action_id = action_id
    self.message_id = message_id
    self.destination = destination

  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.action_id = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.message_id = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.STRING:
          self.destination = 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('Acknowledge')
    if self.action_id != None:
      oprot.writeFieldBegin('action_id', TType.STRING, 1)
      oprot.writeString(self.action_id)
      oprot.writeFieldEnd()
    if self.message_id != None:
      oprot.writeFieldBegin('message_id', TType.STRING, 2)
      oprot.writeString(self.message_id)
      oprot.writeFieldEnd()
    if self.destination != None:
      oprot.writeFieldBegin('destination', TType.STRING, 3)
      oprot.writeString(self.destination)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  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 Subscribe:
  """
  Attributes:
   - action_id
   - destination
   - destination_type
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'action_id', None, None, ), # 1
    (2, TType.STRING, 'destination', None, None, ), # 2
    (3, TType.I32, 'destination_type', None, None, ), # 3
  )

  def __init__(self, action_id=None, destination=None, destination_type=None,):
    self.action_id = action_id
    self.destination = destination
    self.destination_type = destination_type

  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.action_id = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.destination = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I32:
          self.destination_type = iprot.readI32();
        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('Subscribe')
    if self.action_id != None:
      oprot.writeFieldBegin('action_id', TType.STRING, 1)
      oprot.writeString(self.action_id)
      oprot.writeFieldEnd()
    if self.destination != None:
      oprot.writeFieldBegin('destination', TType.STRING, 2)
      oprot.writeString(self.destination)
      oprot.writeFieldEnd()
    if self.destination_type != None:
      oprot.writeFieldBegin('destination_type', TType.I32, 3)
      oprot.writeI32(self.destination_type)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  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 Unsubscribe:
  """
  Attributes:
   - action_id
   - destination
   - destination_type
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'action_id', None, None, ), # 1
    (2, TType.STRING, 'destination', None, None, ), # 2
    (3, TType.I32, 'destination_type', None, None, ), # 3
  )

  def __init__(self, action_id=None, destination=None, destination_type=None,):
    self.action_id = action_id
    self.destination = destination
    self.destination_type = destination_type

  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.action_id = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.destination = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I32:
          self.destination_type = iprot.readI32();
        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('Unsubscribe')
    if self.action_id != None:
      oprot.writeFieldBegin('action_id', TType.STRING, 1)
      oprot.writeString(self.action_id)
      oprot.writeFieldEnd()
    if self.destination != None:
      oprot.writeFieldBegin('destination', TType.STRING, 2)
      oprot.writeString(self.destination)
      oprot.writeFieldEnd()
    if self.destination_type != None:
      oprot.writeFieldBegin('destination_type', TType.I32, 3)
      oprot.writeI32(self.destination_type)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  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 Notification:
  """
  Attributes:
   - destination
   - subscription
   - destination_type
   - message
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'destination', None, None, ), # 1
    (2, TType.STRING, 'subscription', None, None, ), # 2
    (3, TType.I32, 'destination_type', None, None, ), # 3
    (4, TType.STRUCT, 'message', (BrokerMessage, BrokerMessage.thrift_spec), None, ), # 4
  )

  def __init__(self, destination=None, subscription=None, destination_type=None, message=None,):
    self.destination = destination
    self.subscription = subscription
    self.destination_type = destination_type
    self.message = message

  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.destination = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.subscription = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I32:
          self.destination_type = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.STRUCT:
          self.message = BrokerMessage()
          self.message.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('Notification')
    if self.destination != None:
      oprot.writeFieldBegin('destination', TType.STRING, 1)
      oprot.writeString(self.destination)
      oprot.writeFieldEnd()
    if self.subscription != None:
      oprot.writeFieldBegin('subscription', TType.STRING, 2)
      oprot.writeString(self.subscription)
      oprot.writeFieldEnd()
    if self.destination_type != None:
      oprot.writeFieldBegin('destination_type', TType.I32, 3)
      oprot.writeI32(self.destination_type)
      oprot.writeFieldEnd()
    if self.message != None:
      oprot.writeFieldBegin('message', TType.STRUCT, 4)
      self.message.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  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 Fault:
  """
  Attributes:
   - action_id
   - fault_code
   - fault_message
   - fault_detail
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'action_id', None, None, ), # 1
    (2, TType.STRING, 'fault_code', None, None, ), # 2
    (3, TType.STRING, 'fault_message', None, None, ), # 3
    (4, TType.STRING, 'fault_detail', None, None, ), # 4
  )

  def __init__(self, action_id=None, fault_code=None, fault_message=None, fault_detail=None,):
    self.action_id = action_id
    self.fault_code = fault_code
    self.fault_message = fault_message
    self.fault_detail = fault_detail

  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.action_id = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.fault_code = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.STRING:
          self.fault_message = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.STRING:
          self.fault_detail = 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('Fault')
    if self.action_id != None:
      oprot.writeFieldBegin('action_id', TType.STRING, 1)
      oprot.writeString(self.action_id)
      oprot.writeFieldEnd()
    if self.fault_code != None:
      oprot.writeFieldBegin('fault_code', TType.STRING, 2)
      oprot.writeString(self.fault_code)
      oprot.writeFieldEnd()
    if self.fault_message != None:
      oprot.writeFieldBegin('fault_message', TType.STRING, 3)
      oprot.writeString(self.fault_message)
      oprot.writeFieldEnd()
    if self.fault_detail != None:
      oprot.writeFieldBegin('fault_detail', TType.STRING, 4)
      oprot.writeString(self.fault_detail)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  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 Ping:
  """
  Attributes:
   - action_id
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'action_id', None, None, ), # 1
  )

  def __init__(self, action_id=None,):
    self.action_id = action_id

  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.action_id = 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('Ping')
    if self.action_id != None:
      oprot.writeFieldBegin('action_id', TType.STRING, 1)
      oprot.writeString(self.action_id)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  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 Pong:
  """
  Attributes:
   - action_id
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'action_id', None, None, ), # 1
  )

  def __init__(self, action_id=None,):
    self.action_id = action_id

  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.action_id = 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('Pong')
    if self.action_id != None:
      oprot.writeFieldBegin('action_id', TType.STRING, 1)
      oprot.writeString(self.action_id)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  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 Authentication:
  """
  Attributes:
   - action_id
   - authentication_type
   - token
   - user_id
   - roles
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'action_id', None, None, ), # 1
    (2, TType.STRING, 'authentication_type', None, None, ), # 2
    (3, TType.STRING, 'token', None, None, ), # 3
    (4, TType.STRING, 'user_id', None, None, ), # 4
    (5, TType.LIST, 'roles', (TType.STRING,None), None, ), # 5
  )

  def __init__(self, action_id=None, authentication_type=None, token=None, user_id=None, roles=None,):
    self.action_id = action_id
    self.authentication_type = authentication_type
    self.token = token
    self.user_id = user_id
    self.roles = roles

  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.action_id = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.authentication_type = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.STRING:
          self.token = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.STRING:
          self.user_id = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.LIST:
          self.roles = []
          (_etype12, _size9) = iprot.readListBegin()
          for _i13 in xrange(_size9):
            _elem14 = iprot.readString();
            self.roles.append(_elem14)
          iprot.readListEnd()
        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('Authentication')
    if self.action_id != None:
      oprot.writeFieldBegin('action_id', TType.STRING, 1)
      oprot.writeString(self.action_id)
      oprot.writeFieldEnd()
    if self.authentication_type != None:
      oprot.writeFieldBegin('authentication_type', TType.STRING, 2)
      oprot.writeString(self.authentication_type)
      oprot.writeFieldEnd()
    if self.token != None:
      oprot.writeFieldBegin('token', TType.STRING, 3)
      oprot.writeString(self.token)
      oprot.writeFieldEnd()
    if self.user_id != None:
      oprot.writeFieldBegin('user_id', TType.STRING, 4)
      oprot.writeString(self.user_id)
      oprot.writeFieldEnd()
    if self.roles != None:
      oprot.writeFieldBegin('roles', TType.LIST, 5)
      oprot.writeListBegin(TType.STRING, len(self.roles))
      for iter15 in self.roles:
        oprot.writeString(iter15)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  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 Action:
  """
  Attributes:
   - publish
   - poll
   - accepted
   - ack_message
   - subscribe
   - unsubscribe
   - notification
   - fault
   - ping
   - pong
   - auth
   - action_type
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'publish', (Publish, Publish.thrift_spec), None, ), # 1
    (2, TType.STRUCT, 'poll', (Poll, Poll.thrift_spec), None, ), # 2
    (3, TType.STRUCT, 'accepted', (Accepted, Accepted.thrift_spec), None, ), # 3
    (4, TType.STRUCT, 'ack_message', (Acknowledge, Acknowledge.thrift_spec), None, ), # 4
    (5, TType.STRUCT, 'subscribe', (Subscribe, Subscribe.thrift_spec), None, ), # 5
    (6, TType.STRUCT, 'unsubscribe', (Unsubscribe, Unsubscribe.thrift_spec), None, ), # 6
    (7, TType.STRUCT, 'notification', (Notification, Notification.thrift_spec), None, ), # 7
    (8, TType.STRUCT, 'fault', (Fault, Fault.thrift_spec), None, ), # 8
    (9, TType.STRUCT, 'ping', (Ping, Ping.thrift_spec), None, ), # 9
    (10, TType.STRUCT, 'pong', (Pong, Pong.thrift_spec), None, ), # 10
    (11, TType.STRUCT, 'auth', (Authentication, Authentication.thrift_spec), None, ), # 11
    (12, TType.I32, 'action_type', None, None, ), # 12
  )

  def __init__(self, publish=None, poll=None, accepted=None, ack_message=None, subscribe=None, unsubscribe=None, notification=None, fault=None, ping=None, pong=None, auth=None, action_type=None,):
    self.publish = publish
    self.poll = poll
    self.accepted = accepted
    self.ack_message = ack_message
    self.subscribe = subscribe
    self.unsubscribe = unsubscribe
    self.notification = notification
    self.fault = fault
    self.ping = ping
    self.pong = pong
    self.auth = auth
    self.action_type = action_type

  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.publish = Publish()
          self.publish.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRUCT:
          self.poll = Poll()
          self.poll.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.STRUCT:
          self.accepted = Accepted()
          self.accepted.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.STRUCT:
          self.ack_message = Acknowledge()
          self.ack_message.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.STRUCT:
          self.subscribe = Subscribe()
          self.subscribe.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 6:
        if ftype == TType.STRUCT:
          self.unsubscribe = Unsubscribe()
          self.unsubscribe.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 7:
        if ftype == TType.STRUCT:
          self.notification = Notification()
          self.notification.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 8:
        if ftype == TType.STRUCT:
          self.fault = Fault()
          self.fault.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 9:
        if ftype == TType.STRUCT:
          self.ping = Ping()
          self.ping.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 10:
        if ftype == TType.STRUCT:
          self.pong = Pong()
          self.pong.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 11:
        if ftype == TType.STRUCT:
          self.auth = Authentication()
          self.auth.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 12:
        if ftype == TType.I32:
          self.action_type = iprot.readI32();
        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('Action')
    if self.publish != None:
      oprot.writeFieldBegin('publish', TType.STRUCT, 1)
      self.publish.write(oprot)
      oprot.writeFieldEnd()
    if self.poll != None:
      oprot.writeFieldBegin('poll', TType.STRUCT, 2)
      self.poll.write(oprot)
      oprot.writeFieldEnd()
    if self.accepted != None:
      oprot.writeFieldBegin('accepted', TType.STRUCT, 3)
      self.accepted.write(oprot)
      oprot.writeFieldEnd()
    if self.ack_message != None:
      oprot.writeFieldBegin('ack_message', TType.STRUCT, 4)
      self.ack_message.write(oprot)
      oprot.writeFieldEnd()
    if self.subscribe != None:
      oprot.writeFieldBegin('subscribe', TType.STRUCT, 5)
      self.subscribe.write(oprot)
      oprot.writeFieldEnd()
    if self.unsubscribe != None:
      oprot.writeFieldBegin('unsubscribe', TType.STRUCT, 6)
      self.unsubscribe.write(oprot)
      oprot.writeFieldEnd()
    if self.notification != None:
      oprot.writeFieldBegin('notification', TType.STRUCT, 7)
      self.notification.write(oprot)
      oprot.writeFieldEnd()
    if self.fault != None:
      oprot.writeFieldBegin('fault', TType.STRUCT, 8)
      self.fault.write(oprot)
      oprot.writeFieldEnd()
    if self.ping != None:
      oprot.writeFieldBegin('ping', TType.STRUCT, 9)
      self.ping.write(oprot)
      oprot.writeFieldEnd()
    if self.pong != None:
      oprot.writeFieldBegin('pong', TType.STRUCT, 10)
      self.pong.write(oprot)
      oprot.writeFieldEnd()
    if self.auth != None:
      oprot.writeFieldBegin('auth', TType.STRUCT, 11)
      self.auth.write(oprot)
      oprot.writeFieldEnd()
    if self.action_type != None:
      oprot.writeFieldBegin('action_type', TType.I32, 12)
      oprot.writeI32(self.action_type)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  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 Atom:
  """
  Attributes:
   - header
   - action
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'header', (Header, Header.thrift_spec), None, ), # 1
    (2, TType.STRUCT, 'action', (Action, Action.thrift_spec), None, ), # 2
  )

  def __init__(self, header=None, action=None,):
    self.header = header
    self.action = action

  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.header = Header()
          self.header.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRUCT:
          self.action = Action()
          self.action.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('Atom')
    if self.header != None:
      oprot.writeFieldBegin('header', TType.STRUCT, 1)
      self.header.write(oprot)
      oprot.writeFieldEnd()
    if self.action != None:
      oprot.writeFieldBegin('action', TType.STRUCT, 2)
      self.action.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  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)

