#
# 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

from thrift.transport import TTransport
all_structs = []


class AffectedVerb(object):
    SELECTED = 0
    INSERTED = 1
    UPDATED = 2
    DELETED = 3
    NONE = 4

    _VALUES_TO_NAMES = {
        0: "SELECTED",
        1: "INSERTED",
        2: "UPDATED",
        3: "DELETED",
        4: "NONE",
    }

    _NAMES_TO_VALUES = {
        "SELECTED": 0,
        "INSERTED": 1,
        "UPDATED": 2,
        "DELETED": 3,
        "NONE": 4,
    }


class StatementResponse(object):
    """
    Attributes:
     - statementId
     - statementString
     - numMatchedRows
     - numAffectedRows
     - affectedVerb
     - statementName
    """


    def __init__(self, statementId=None, statementString=None, numMatchedRows=None, numAffectedRows=None, affectedVerb=None, statementName=None,):
        self.statementId = statementId
        self.statementString = statementString
        self.numMatchedRows = numMatchedRows
        self.numAffectedRows = numAffectedRows
        self.affectedVerb = affectedVerb
        self.statementName = statementName

    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.STRING:
                    self.statementId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRING:
                    self.statementString = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.I64:
                    self.numMatchedRows = iprot.readI64()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.I64:
                    self.numAffectedRows = iprot.readI64()
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.I32:
                    self.affectedVerb = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 6:
                if ftype == TType.STRING:
                    self.statementName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                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('StatementResponse')
        if self.statementId is not None:
            oprot.writeFieldBegin('statementId', TType.STRING, 1)
            oprot.writeString(self.statementId.encode('utf-8') if sys.version_info[0] == 2 else self.statementId)
            oprot.writeFieldEnd()
        if self.statementString is not None:
            oprot.writeFieldBegin('statementString', TType.STRING, 2)
            oprot.writeString(self.statementString.encode('utf-8') if sys.version_info[0] == 2 else self.statementString)
            oprot.writeFieldEnd()
        if self.numMatchedRows is not None:
            oprot.writeFieldBegin('numMatchedRows', TType.I64, 3)
            oprot.writeI64(self.numMatchedRows)
            oprot.writeFieldEnd()
        if self.numAffectedRows is not None:
            oprot.writeFieldBegin('numAffectedRows', TType.I64, 4)
            oprot.writeI64(self.numAffectedRows)
            oprot.writeFieldEnd()
        if self.affectedVerb is not None:
            oprot.writeFieldBegin('affectedVerb', TType.I32, 5)
            oprot.writeI32(self.affectedVerb)
            oprot.writeFieldEnd()
        if self.statementName is not None:
            oprot.writeFieldBegin('statementName', TType.STRING, 6)
            oprot.writeString(self.statementName.encode('utf-8') if sys.version_info[0] == 2 else self.statementName)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.statementId is None:
            raise TProtocolException(message='Required field statementId is unset!')
        if self.numMatchedRows is None:
            raise TProtocolException(message='Required field numMatchedRows is unset!')
        if self.numAffectedRows is None:
            raise TProtocolException(message='Required field numAffectedRows is unset!')
        if self.affectedVerb is None:
            raise TProtocolException(message='Required field affectedVerb is unset!')
        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(StatementResponse)
StatementResponse.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'statementId', 'UTF8', None, ),  # 1
    (2, TType.STRING, 'statementString', 'UTF8', None, ),  # 2
    (3, TType.I64, 'numMatchedRows', None, None, ),  # 3
    (4, TType.I64, 'numAffectedRows', None, None, ),  # 4
    (5, TType.I32, 'affectedVerb', None, None, ),  # 5
    (6, TType.STRING, 'statementName', 'UTF8', None, ),  # 6
)
fix_spec(all_structs)
del all_structs
