#
# 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 TBackupStatus:
  Pending = 1
  InProgress = 2
  Success = 3
  Failed = 4

  _VALUES_TO_NAMES = {
    1: "Pending",
    2: "InProgress",
    3: "Success",
    4: "Failed",
  }

  _NAMES_TO_VALUES = {
    "Pending": 1,
    "InProgress": 2,
    "Success": 3,
    "Failed": 4,
  }


class TBackupData:
  """
  Attributes:
   - offset
   - size
   - data
   - moreData
   - nextOffset
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'offset', None, None, ), # 1
    (2, TType.I32, 'size', None, None, ), # 2
    (3, TType.STRING, 'data', None, None, ), # 3
    None, # 4
    (5, TType.BOOL, 'moreData', None, None, ), # 5
    (6, TType.I64, 'nextOffset', None, None, ), # 6
  )

  def __init__(self, offset=None, size=None, data=None, moreData=None, nextOffset=None,):
    self.offset = offset
    self.size = size
    self.data = data
    self.moreData = moreData
    self.nextOffset = nextOffset

  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.offset = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I32:
          self.size = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.STRING:
          self.data = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.BOOL:
          self.moreData = iprot.readBool();
        else:
          iprot.skip(ftype)
      elif fid == 6:
        if ftype == TType.I64:
          self.nextOffset = 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('TBackupData')
    if self.offset is not None:
      oprot.writeFieldBegin('offset', TType.I64, 1)
      oprot.writeI64(self.offset)
      oprot.writeFieldEnd()
    if self.size is not None:
      oprot.writeFieldBegin('size', TType.I32, 2)
      oprot.writeI32(self.size)
      oprot.writeFieldEnd()
    if self.data is not None:
      oprot.writeFieldBegin('data', TType.STRING, 3)
      oprot.writeString(self.data)
      oprot.writeFieldEnd()
    if self.moreData is not None:
      oprot.writeFieldBegin('moreData', TType.BOOL, 5)
      oprot.writeBool(self.moreData)
      oprot.writeFieldEnd()
    if self.nextOffset is not None:
      oprot.writeFieldBegin('nextOffset', TType.I64, 6)
      oprot.writeI64(self.nextOffset)
      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 TBackup:
  """
  Attributes:
   - id
   - creationTimestamp
   - startedTimestamp
   - completedTimestamp
   - progress
   - numObjects
   - status
   - failureMessage
   - resourceId
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'id', None, None, ), # 1
    (2, TType.I64, 'creationTimestamp', None, None, ), # 2
    (3, TType.I64, 'startedTimestamp', None, None, ), # 3
    (4, TType.I64, 'completedTimestamp', None, None, ), # 4
    (5, TType.DOUBLE, 'progress', None, None, ), # 5
    (6, TType.I32, 'numObjects', None, None, ), # 6
    (7, TType.I32, 'status', None, None, ), # 7
    (8, TType.STRING, 'failureMessage', None, None, ), # 8
    (9, TType.I64, 'resourceId', None, None, ), # 9
  )

  def __init__(self, id=None, creationTimestamp=None, startedTimestamp=None, completedTimestamp=None, progress=None, numObjects=None, status=None, failureMessage=None, resourceId=None,):
    self.id = id
    self.creationTimestamp = creationTimestamp
    self.startedTimestamp = startedTimestamp
    self.completedTimestamp = completedTimestamp
    self.progress = progress
    self.numObjects = numObjects
    self.status = status
    self.failureMessage = failureMessage
    self.resourceId = resourceId

  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.creationTimestamp = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I64:
          self.startedTimestamp = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I64:
          self.completedTimestamp = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.DOUBLE:
          self.progress = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 6:
        if ftype == TType.I32:
          self.numObjects = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 7:
        if ftype == TType.I32:
          self.status = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 8:
        if ftype == TType.STRING:
          self.failureMessage = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 9:
        if ftype == TType.I64:
          self.resourceId = 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('TBackup')
    if self.id is not None:
      oprot.writeFieldBegin('id', TType.I64, 1)
      oprot.writeI64(self.id)
      oprot.writeFieldEnd()
    if self.creationTimestamp is not None:
      oprot.writeFieldBegin('creationTimestamp', TType.I64, 2)
      oprot.writeI64(self.creationTimestamp)
      oprot.writeFieldEnd()
    if self.startedTimestamp is not None:
      oprot.writeFieldBegin('startedTimestamp', TType.I64, 3)
      oprot.writeI64(self.startedTimestamp)
      oprot.writeFieldEnd()
    if self.completedTimestamp is not None:
      oprot.writeFieldBegin('completedTimestamp', TType.I64, 4)
      oprot.writeI64(self.completedTimestamp)
      oprot.writeFieldEnd()
    if self.progress is not None:
      oprot.writeFieldBegin('progress', TType.DOUBLE, 5)
      oprot.writeDouble(self.progress)
      oprot.writeFieldEnd()
    if self.numObjects is not None:
      oprot.writeFieldBegin('numObjects', TType.I32, 6)
      oprot.writeI32(self.numObjects)
      oprot.writeFieldEnd()
    if self.status is not None:
      oprot.writeFieldBegin('status', TType.I32, 7)
      oprot.writeI32(self.status)
      oprot.writeFieldEnd()
    if self.failureMessage is not None:
      oprot.writeFieldBegin('failureMessage', TType.STRING, 8)
      oprot.writeString(self.failureMessage)
      oprot.writeFieldEnd()
    if self.resourceId is not None:
      oprot.writeFieldBegin('resourceId', TType.I64, 9)
      oprot.writeI64(self.resourceId)
      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)
