#
# Autogenerated by Thrift Compiler (0.9.1)
#
# 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
import koverse.thriftgen.ttypes
import koverse.thriftgen.security.ttypes


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



class TApplicationTypeDescription:
  """
  Attributes:
   - id
   - addOnId
   - applicationId
   - version
   - disabled
   - displayName
   - responsibleUserId
   - autoDeploy
   - parameters
   - defaultCategoryDisplayName
   - userDeployable
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'id', None, None, ), # 1
    (2, TType.I64, 'addOnId', None, None, ), # 2
    (3, TType.STRING, 'applicationId', None, None, ), # 3
    (4, TType.STRING, 'version', None, None, ), # 4
    (5, TType.BOOL, 'disabled', None, None, ), # 5
    (6, TType.STRING, 'displayName', None, None, ), # 6
    (7, TType.I64, 'responsibleUserId', None, None, ), # 7
    (8, TType.BOOL, 'autoDeploy', None, None, ), # 8
    (9, TType.LIST, 'parameters', (TType.STRUCT,(koverse.thriftgen.ttypes.TParameter, koverse.thriftgen.ttypes.TParameter.thrift_spec)), None, ), # 9
    (10, TType.STRING, 'defaultCategoryDisplayName', None, None, ), # 10
    (11, TType.BOOL, 'userDeployable', None, None, ), # 11
  )

  def __init__(self, id=None, addOnId=None, applicationId=None, version=None, disabled=None, displayName=None, responsibleUserId=None, autoDeploy=None, parameters=None, defaultCategoryDisplayName=None, userDeployable=None,):
    self.id = id
    self.addOnId = addOnId
    self.applicationId = applicationId
    self.version = version
    self.disabled = disabled
    self.displayName = displayName
    self.responsibleUserId = responsibleUserId
    self.autoDeploy = autoDeploy
    self.parameters = parameters
    self.defaultCategoryDisplayName = defaultCategoryDisplayName
    self.userDeployable = userDeployable

  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.I64:
          self.id = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I64:
          self.addOnId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.STRING:
          self.applicationId = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.STRING:
          self.version = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.BOOL:
          self.disabled = iprot.readBool();
        else:
          iprot.skip(ftype)
      elif fid == 6:
        if ftype == TType.STRING:
          self.displayName = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 7:
        if ftype == TType.I64:
          self.responsibleUserId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 8:
        if ftype == TType.BOOL:
          self.autoDeploy = iprot.readBool();
        else:
          iprot.skip(ftype)
      elif fid == 9:
        if ftype == TType.LIST:
          self.parameters = []
          (_etype3, _size0) = iprot.readListBegin()
          for _i4 in xrange(_size0):
            _elem5 = koverse.thriftgen.ttypes.TParameter()
            _elem5.read(iprot)
            self.parameters.append(_elem5)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 10:
        if ftype == TType.STRING:
          self.defaultCategoryDisplayName = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 11:
        if ftype == TType.BOOL:
          self.userDeployable = iprot.readBool();
        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('TApplicationTypeDescription')
    if self.id is not None:
      oprot.writeFieldBegin('id', TType.I64, 1)
      oprot.writeI64(self.id)
      oprot.writeFieldEnd()
    if self.addOnId is not None:
      oprot.writeFieldBegin('addOnId', TType.I64, 2)
      oprot.writeI64(self.addOnId)
      oprot.writeFieldEnd()
    if self.applicationId is not None:
      oprot.writeFieldBegin('applicationId', TType.STRING, 3)
      oprot.writeString(self.applicationId)
      oprot.writeFieldEnd()
    if self.version is not None:
      oprot.writeFieldBegin('version', TType.STRING, 4)
      oprot.writeString(self.version)
      oprot.writeFieldEnd()
    if self.disabled is not None:
      oprot.writeFieldBegin('disabled', TType.BOOL, 5)
      oprot.writeBool(self.disabled)
      oprot.writeFieldEnd()
    if self.displayName is not None:
      oprot.writeFieldBegin('displayName', TType.STRING, 6)
      oprot.writeString(self.displayName)
      oprot.writeFieldEnd()
    if self.responsibleUserId is not None:
      oprot.writeFieldBegin('responsibleUserId', TType.I64, 7)
      oprot.writeI64(self.responsibleUserId)
      oprot.writeFieldEnd()
    if self.autoDeploy is not None:
      oprot.writeFieldBegin('autoDeploy', TType.BOOL, 8)
      oprot.writeBool(self.autoDeploy)
      oprot.writeFieldEnd()
    if self.parameters is not None:
      oprot.writeFieldBegin('parameters', TType.LIST, 9)
      oprot.writeListBegin(TType.STRUCT, len(self.parameters))
      for iter6 in self.parameters:
        iter6.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    if self.defaultCategoryDisplayName is not None:
      oprot.writeFieldBegin('defaultCategoryDisplayName', TType.STRING, 10)
      oprot.writeString(self.defaultCategoryDisplayName)
      oprot.writeFieldEnd()
    if self.userDeployable is not None:
      oprot.writeFieldBegin('userDeployable', TType.BOOL, 11)
      oprot.writeBool(self.userDeployable)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  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 TApplicationGroupPermission:
  """
  Attributes:
   - groupId
   - permissions
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'groupId', None, None, ), # 1
    (2, TType.LIST, 'permissions', (TType.STRING,None), None, ), # 2
  )

  def __init__(self, groupId=None, permissions=None,):
    self.groupId = groupId
    self.permissions = permissions

  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.I64:
          self.groupId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.LIST:
          self.permissions = []
          (_etype10, _size7) = iprot.readListBegin()
          for _i11 in xrange(_size7):
            _elem12 = iprot.readString();
            self.permissions.append(_elem12)
          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('TApplicationGroupPermission')
    if self.groupId is not None:
      oprot.writeFieldBegin('groupId', TType.I64, 1)
      oprot.writeI64(self.groupId)
      oprot.writeFieldEnd()
    if self.permissions is not None:
      oprot.writeFieldBegin('permissions', TType.LIST, 2)
      oprot.writeListBegin(TType.STRING, len(self.permissions))
      for iter13 in self.permissions:
        oprot.writeString(iter13)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  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 TApplicationInstance:
  """
  Attributes:
   - id
   - displayName
   - configurationOptions
   - responsibleUserId
   - disabled
   - groupPermissions
   - urlId
   - builtIn
   - categoryDisplayName
   - applicationTypeId
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'id', None, None, ), # 1
    (2, TType.STRING, 'displayName', None, None, ), # 2
    (3, TType.MAP, 'configurationOptions', (TType.STRING,None,TType.STRING,None), None, ), # 3
    (4, TType.I64, 'responsibleUserId', None, None, ), # 4
    (5, TType.BOOL, 'disabled', None, None, ), # 5
    (6, TType.LIST, 'groupPermissions', (TType.STRUCT,(TApplicationGroupPermission, TApplicationGroupPermission.thrift_spec)), None, ), # 6
    (7, TType.STRING, 'urlId', None, None, ), # 7
    (8, TType.BOOL, 'builtIn', None, None, ), # 8
    None, # 9
    (10, TType.STRING, 'categoryDisplayName', None, None, ), # 10
    (11, TType.STRING, 'applicationTypeId', None, None, ), # 11
  )

  def __init__(self, id=None, displayName=None, configurationOptions=None, responsibleUserId=None, disabled=None, groupPermissions=None, urlId=None, builtIn=None, categoryDisplayName=None, applicationTypeId=None,):
    self.id = id
    self.displayName = displayName
    self.configurationOptions = configurationOptions
    self.responsibleUserId = responsibleUserId
    self.disabled = disabled
    self.groupPermissions = groupPermissions
    self.urlId = urlId
    self.builtIn = builtIn
    self.categoryDisplayName = categoryDisplayName
    self.applicationTypeId = applicationTypeId

  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.I64:
          self.id = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.displayName = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.MAP:
          self.configurationOptions = {}
          (_ktype15, _vtype16, _size14 ) = iprot.readMapBegin()
          for _i18 in xrange(_size14):
            _key19 = iprot.readString();
            _val20 = iprot.readString();
            self.configurationOptions[_key19] = _val20
          iprot.readMapEnd()
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I64:
          self.responsibleUserId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.BOOL:
          self.disabled = iprot.readBool();
        else:
          iprot.skip(ftype)
      elif fid == 6:
        if ftype == TType.LIST:
          self.groupPermissions = []
          (_etype24, _size21) = iprot.readListBegin()
          for _i25 in xrange(_size21):
            _elem26 = TApplicationGroupPermission()
            _elem26.read(iprot)
            self.groupPermissions.append(_elem26)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 7:
        if ftype == TType.STRING:
          self.urlId = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 8:
        if ftype == TType.BOOL:
          self.builtIn = iprot.readBool();
        else:
          iprot.skip(ftype)
      elif fid == 10:
        if ftype == TType.STRING:
          self.categoryDisplayName = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 11:
        if ftype == TType.STRING:
          self.applicationTypeId = 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('TApplicationInstance')
    if self.id is not None:
      oprot.writeFieldBegin('id', TType.I64, 1)
      oprot.writeI64(self.id)
      oprot.writeFieldEnd()
    if self.displayName is not None:
      oprot.writeFieldBegin('displayName', TType.STRING, 2)
      oprot.writeString(self.displayName)
      oprot.writeFieldEnd()
    if self.configurationOptions is not None:
      oprot.writeFieldBegin('configurationOptions', TType.MAP, 3)
      oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.configurationOptions))
      for kiter27,viter28 in self.configurationOptions.items():
        oprot.writeString(kiter27)
        oprot.writeString(viter28)
      oprot.writeMapEnd()
      oprot.writeFieldEnd()
    if self.responsibleUserId is not None:
      oprot.writeFieldBegin('responsibleUserId', TType.I64, 4)
      oprot.writeI64(self.responsibleUserId)
      oprot.writeFieldEnd()
    if self.disabled is not None:
      oprot.writeFieldBegin('disabled', TType.BOOL, 5)
      oprot.writeBool(self.disabled)
      oprot.writeFieldEnd()
    if self.groupPermissions is not None:
      oprot.writeFieldBegin('groupPermissions', TType.LIST, 6)
      oprot.writeListBegin(TType.STRUCT, len(self.groupPermissions))
      for iter29 in self.groupPermissions:
        iter29.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    if self.urlId is not None:
      oprot.writeFieldBegin('urlId', TType.STRING, 7)
      oprot.writeString(self.urlId)
      oprot.writeFieldEnd()
    if self.builtIn is not None:
      oprot.writeFieldBegin('builtIn', TType.BOOL, 8)
      oprot.writeBool(self.builtIn)
      oprot.writeFieldEnd()
    if self.categoryDisplayName is not None:
      oprot.writeFieldBegin('categoryDisplayName', TType.STRING, 10)
      oprot.writeString(self.categoryDisplayName)
      oprot.writeFieldEnd()
    if self.applicationTypeId is not None:
      oprot.writeFieldBegin('applicationTypeId', TType.STRING, 11)
      oprot.writeString(self.applicationTypeId)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  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)
