#
# Autogenerated by Thrift Compiler (0.18.1)
#
# 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 ModelType(object):
    LR = 0
    RF = 1
    ADA = 2
    BAG = 3

    _VALUES_TO_NAMES = {
        0: "LR",
        1: "RF",
        2: "ADA",
        3: "BAG",
    }

    _NAMES_TO_VALUES = {
        "LR": 0,
        "RF": 1,
        "ADA": 2,
        "BAG": 3,
    }


class EvalMethod(object):
    EXP = 0
    MET = 1
    BOTH = 2

    _VALUES_TO_NAMES = {
        0: "EXP",
        1: "MET",
        2: "BOTH",
    }

    _NAMES_TO_VALUES = {
        "EXP": 0,
        "MET": 1,
        "BOTH": 2,
    }


class FairMetricEnum(object):
    DP = 0
    EO = 1
    PE = 2
    EOD = 3
    PP = 4
    CEA = 5

    _VALUES_TO_NAMES = {
        0: "DP",
        1: "EO",
        2: "PE",
        3: "EOD",
        4: "PP",
        5: "CEA",
    }

    _NAMES_TO_VALUES = {
        "DP": 0,
        "EO": 1,
        "PE": 2,
        "EOD": 3,
        "PP": 4,
        "CEA": 5,
    }


class FairMetric(object):
    """
    Attributes:
     - type
     - value

    """


    def __init__(self, type=None, value=None,):
        self.type = type
        self.value = value

    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.I32:
                    self.type = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.DOUBLE:
                    self.value = iprot.readDouble()
                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('FairMetric')
        if self.type is not None:
            oprot.writeFieldBegin('type', TType.I32, 1)
            oprot.writeI32(self.type)
            oprot.writeFieldEnd()
        if self.value is not None:
            oprot.writeFieldBegin('value', TType.DOUBLE, 2)
            oprot.writeDouble(self.value)
            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)


class SensitiveFeature(object):
    """
    Attributes:
     - featureIndex
     - name
     - description
     - unprivPop
     - unprivPop_original
     - type

    """


    def __init__(self, featureIndex=None, name=None, description=None, unprivPop=None, unprivPop_original=None, type=None,):
        self.featureIndex = featureIndex
        self.name = name
        self.description = description
        self.unprivPop = unprivPop
        self.unprivPop_original = unprivPop_original
        self.type = type

    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.I32:
                    self.featureIndex = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRING:
                    self.name = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRING:
                    self.description = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.I32:
                    self.unprivPop = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.STRING:
                    self.unprivPop_original = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 6:
                if ftype == TType.I32:
                    self.type = iprot.readI32()
                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('SensitiveFeature')
        if self.featureIndex is not None:
            oprot.writeFieldBegin('featureIndex', TType.I32, 1)
            oprot.writeI32(self.featureIndex)
            oprot.writeFieldEnd()
        if self.name is not None:
            oprot.writeFieldBegin('name', TType.STRING, 2)
            oprot.writeString(self.name.encode('utf-8') if sys.version_info[0] == 2 else self.name)
            oprot.writeFieldEnd()
        if self.description is not None:
            oprot.writeFieldBegin('description', TType.STRING, 3)
            oprot.writeString(self.description.encode('utf-8') if sys.version_info[0] == 2 else self.description)
            oprot.writeFieldEnd()
        if self.unprivPop is not None:
            oprot.writeFieldBegin('unprivPop', TType.I32, 4)
            oprot.writeI32(self.unprivPop)
            oprot.writeFieldEnd()
        if self.unprivPop_original is not None:
            oprot.writeFieldBegin('unprivPop_original', TType.STRING, 5)
            oprot.writeString(self.unprivPop_original.encode('utf-8') if sys.version_info[0] == 2 else self.unprivPop_original)
            oprot.writeFieldEnd()
        if self.type is not None:
            oprot.writeFieldBegin('type', TType.I32, 6)
            oprot.writeI32(self.type)
            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)


class FeatureImportance(object):
    """
    Attributes:
     - indexFeature
     - importance

    """


    def __init__(self, indexFeature=None, importance=None,):
        self.indexFeature = indexFeature
        self.importance = importance

    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.I32:
                    self.indexFeature = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.DOUBLE:
                    self.importance = iprot.readDouble()
                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('FeatureImportance')
        if self.indexFeature is not None:
            oprot.writeFieldBegin('indexFeature', TType.I32, 1)
            oprot.writeI32(self.indexFeature)
            oprot.writeFieldEnd()
        if self.importance is not None:
            oprot.writeFieldBegin('importance', TType.DOUBLE, 2)
            oprot.writeDouble(self.importance)
            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)


class FIExplanation(object):
    """
    Attributes:
     - listOfFeatureImportance

    """


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

    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.LIST:
                    self.listOfFeatureImportance = []
                    (_etype3, _size0) = iprot.readListBegin()
                    for _i4 in range(_size0):
                        _elem5 = FeatureImportance()
                        _elem5.read(iprot)
                        self.listOfFeatureImportance.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('FIExplanation')
        if self.listOfFeatureImportance is not None:
            oprot.writeFieldBegin('listOfFeatureImportance', TType.LIST, 1)
            oprot.writeListBegin(TType.STRUCT, len(self.listOfFeatureImportance))
            for iter6 in self.listOfFeatureImportance:
                iter6.write(oprot)
            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)


class ModelDefinitions(object):
    """
    Attributes:
     - numFeatures
     - nonNumericFeatures
     - type

    """


    def __init__(self, numFeatures=None, nonNumericFeatures=None, type=None,):
        self.numFeatures = numFeatures
        self.nonNumericFeatures = nonNumericFeatures
        self.type = type

    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.I32:
                    self.numFeatures = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.LIST:
                    self.nonNumericFeatures = []
                    (_etype10, _size7) = iprot.readListBegin()
                    for _i11 in range(_size7):
                        _elem12 = iprot.readI32()
                        self.nonNumericFeatures.append(_elem12)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.I32:
                    self.type = iprot.readI32()
                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('ModelDefinitions')
        if self.numFeatures is not None:
            oprot.writeFieldBegin('numFeatures', TType.I32, 1)
            oprot.writeI32(self.numFeatures)
            oprot.writeFieldEnd()
        if self.nonNumericFeatures is not None:
            oprot.writeFieldBegin('nonNumericFeatures', TType.LIST, 2)
            oprot.writeListBegin(TType.I32, len(self.nonNumericFeatures))
            for iter13 in self.nonNumericFeatures:
                oprot.writeI32(iter13)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.type is not None:
            oprot.writeFieldBegin('type', TType.I32, 3)
            oprot.writeI32(self.type)
            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)


class Instance(object):
    """
    Attributes:
     - y_pred
     - y
     - sensitiveValue

    """


    def __init__(self, y_pred=None, y=None, sensitiveValue=None,):
        self.y_pred = y_pred
        self.y = y
        self.sensitiveValue = sensitiveValue

    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.I32:
                    self.y_pred = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.I32:
                    self.y = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRING:
                    self.sensitiveValue = iprot.readString().decode('utf-8', errors='replace') 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('Instance')
        if self.y_pred is not None:
            oprot.writeFieldBegin('y_pred', TType.I32, 1)
            oprot.writeI32(self.y_pred)
            oprot.writeFieldEnd()
        if self.y is not None:
            oprot.writeFieldBegin('y', TType.I32, 2)
            oprot.writeI32(self.y)
            oprot.writeFieldEnd()
        if self.sensitiveValue is not None:
            oprot.writeFieldBegin('sensitiveValue', TType.STRING, 3)
            oprot.writeString(self.sensitiveValue.encode('utf-8') if sys.version_info[0] == 2 else self.sensitiveValue)
            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(FairMetric)
FairMetric.thrift_spec = (
    None,  # 0
    (1, TType.I32, 'type', None, None, ),  # 1
    (2, TType.DOUBLE, 'value', None, None, ),  # 2
)
all_structs.append(SensitiveFeature)
SensitiveFeature.thrift_spec = (
    None,  # 0
    (1, TType.I32, 'featureIndex', None, None, ),  # 1
    (2, TType.STRING, 'name', 'UTF8', None, ),  # 2
    (3, TType.STRING, 'description', 'UTF8', None, ),  # 3
    (4, TType.I32, 'unprivPop', None, None, ),  # 4
    (5, TType.STRING, 'unprivPop_original', 'UTF8', None, ),  # 5
    (6, TType.I32, 'type', None, None, ),  # 6
)
all_structs.append(FeatureImportance)
FeatureImportance.thrift_spec = (
    None,  # 0
    (1, TType.I32, 'indexFeature', None, None, ),  # 1
    (2, TType.DOUBLE, 'importance', None, None, ),  # 2
)
all_structs.append(FIExplanation)
FIExplanation.thrift_spec = (
    None,  # 0
    (1, TType.LIST, 'listOfFeatureImportance', (TType.STRUCT, [FeatureImportance, None], False), None, ),  # 1
)
all_structs.append(ModelDefinitions)
ModelDefinitions.thrift_spec = (
    None,  # 0
    (1, TType.I32, 'numFeatures', None, None, ),  # 1
    (2, TType.LIST, 'nonNumericFeatures', (TType.I32, None, False), None, ),  # 2
    (3, TType.I32, 'type', None, None, ),  # 3
)
all_structs.append(Instance)
Instance.thrift_spec = (
    None,  # 0
    (1, TType.I32, 'y_pred', None, None, ),  # 1
    (2, TType.I32, 'y', None, None, ),  # 2
    (3, TType.STRING, 'sensitiveValue', 'UTF8', None, ),  # 3
)
fix_spec(all_structs)
del all_structs
