#
# Autogenerated by Thrift Compiler (0.11.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
#  options string: py
#

from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
from thrift.TRecursive import fix_spec

import sys
import koverse.thriftgen.ttypes
import koverse.thriftgen.security.ttypes
import koverse.thriftgen.usergroup.ttypes

from thrift.transport import TTransport
all_structs = []


class TAuditLogEntry(object):
    """
    Attributes:
     - id
     - creationDate
     - actionType
     - actionDetails
     - user
     - collectionIds
    """


    def __init__(self, id=None, creationDate=None, actionType=None, actionDetails=None, user=None, collectionIds=None,):
        self.id = id
        self.creationDate = creationDate
        self.actionType = actionType
        self.actionDetails = actionDetails
        self.user = user
        self.collectionIds = collectionIds

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [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.creationDate = iprot.readI64()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRING:
                    self.actionType = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.STRING:
                    self.actionDetails = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.STRUCT:
                    self.user = koverse.thriftgen.usergroup.ttypes.TUser()
                    self.user.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 6:
                if ftype == TType.LIST:
                    self.collectionIds = []
                    (_etype3, _size0) = iprot.readListBegin()
                    for _i4 in range(_size0):
                        _elem5 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.collectionIds.append(_elem5)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('TAuditLogEntry')
        if self.id is not None:
            oprot.writeFieldBegin('id', TType.I64, 1)
            oprot.writeI64(self.id)
            oprot.writeFieldEnd()
        if self.creationDate is not None:
            oprot.writeFieldBegin('creationDate', TType.I64, 2)
            oprot.writeI64(self.creationDate)
            oprot.writeFieldEnd()
        if self.actionType is not None:
            oprot.writeFieldBegin('actionType', TType.STRING, 3)
            oprot.writeString(self.actionType.encode('utf-8') if sys.version_info[0] == 2 else self.actionType)
            oprot.writeFieldEnd()
        if self.actionDetails is not None:
            oprot.writeFieldBegin('actionDetails', TType.STRING, 4)
            oprot.writeString(self.actionDetails.encode('utf-8') if sys.version_info[0] == 2 else self.actionDetails)
            oprot.writeFieldEnd()
        if self.user is not None:
            oprot.writeFieldBegin('user', TType.STRUCT, 5)
            self.user.write(oprot)
            oprot.writeFieldEnd()
        if self.collectionIds is not None:
            oprot.writeFieldBegin('collectionIds', TType.LIST, 6)
            oprot.writeListBegin(TType.STRING, len(self.collectionIds))
            for iter6 in self.collectionIds:
                oprot.writeString(iter6.encode('utf-8') if sys.version_info[0] == 2 else iter6)
            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__.items()]
        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)
all_structs.append(TAuditLogEntry)
TAuditLogEntry.thrift_spec = (
    None,  # 0
    (1, TType.I64, 'id', None, None, ),  # 1
    (2, TType.I64, 'creationDate', None, None, ),  # 2
    (3, TType.STRING, 'actionType', 'UTF8', None, ),  # 3
    (4, TType.STRING, 'actionDetails', 'UTF8', None, ),  # 4
    (5, TType.STRUCT, 'user', [koverse.thriftgen.usergroup.ttypes.TUser, None], None, ),  # 5
    (6, TType.LIST, 'collectionIds', (TType.STRING, 'UTF8', False), None, ),  # 6
)
fix_spec(all_structs)
del all_structs
