#
# 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 codechecker_api_shared.ttypes

from thrift.transport import TTransport
all_structs = []


class Confidentiality(object):
    CONFIDENTIAL = 0
    INTERNAL = 1
    OPEN = 2

    _VALUES_TO_NAMES = {
        0: "CONFIDENTIAL",
        1: "INTERNAL",
        2: "OPEN",
    }

    _NAMES_TO_VALUES = {
        "CONFIDENTIAL": 0,
        "INTERNAL": 1,
        "OPEN": 2,
    }


class DatabaseConnection(object):
    """
    Attributes:
     - engine
     - host
     - port
     - username_b64
     - password_b64
     - database
    """


    def __init__(self, engine=None, host=None, port=None, username_b64=None, password_b64=None, database=None,):
        self.engine = engine
        self.host = host
        self.port = port
        self.username_b64 = username_b64
        self.password_b64 = password_b64
        self.database = database

    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.engine = 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.host = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.I32:
                    self.port = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.STRING:
                    self.username_b64 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.STRING:
                    self.password_b64 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 6:
                if ftype == TType.STRING:
                    self.database = 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('DatabaseConnection')
        if self.engine is not None:
            oprot.writeFieldBegin('engine', TType.STRING, 1)
            oprot.writeString(self.engine.encode('utf-8') if sys.version_info[0] == 2 else self.engine)
            oprot.writeFieldEnd()
        if self.host is not None:
            oprot.writeFieldBegin('host', TType.STRING, 2)
            oprot.writeString(self.host.encode('utf-8') if sys.version_info[0] == 2 else self.host)
            oprot.writeFieldEnd()
        if self.port is not None:
            oprot.writeFieldBegin('port', TType.I32, 3)
            oprot.writeI32(self.port)
            oprot.writeFieldEnd()
        if self.username_b64 is not None:
            oprot.writeFieldBegin('username_b64', TType.STRING, 4)
            oprot.writeString(self.username_b64.encode('utf-8') if sys.version_info[0] == 2 else self.username_b64)
            oprot.writeFieldEnd()
        if self.password_b64 is not None:
            oprot.writeFieldBegin('password_b64', TType.STRING, 5)
            oprot.writeString(self.password_b64.encode('utf-8') if sys.version_info[0] == 2 else self.password_b64)
            oprot.writeFieldEnd()
        if self.database is not None:
            oprot.writeFieldBegin('database', TType.STRING, 6)
            oprot.writeString(self.database.encode('utf-8') if sys.version_info[0] == 2 else self.database)
            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 ProductConfiguration(object):
    """
    Attributes:
     - id
     - endpoint
     - displayedName_b64
     - description_b64
     - connection
     - runLimit
     - isReviewStatusChangeDisabled
     - confidentiality
     - reportLimit
    """


    def __init__(self, id=None, endpoint=None, displayedName_b64=None, description_b64=None, connection=None, runLimit=None, isReviewStatusChangeDisabled=None, confidentiality=None, reportLimit=None,):
        self.id = id
        self.endpoint = endpoint
        self.displayedName_b64 = displayedName_b64
        self.description_b64 = description_b64
        self.connection = connection
        self.runLimit = runLimit
        self.isReviewStatusChangeDisabled = isReviewStatusChangeDisabled
        self.confidentiality = confidentiality
        self.reportLimit = reportLimit

    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.STRING:
                    self.endpoint = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRING:
                    self.displayedName_b64 = 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.description_b64 = 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.connection = DatabaseConnection()
                    self.connection.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 6:
                if ftype == TType.I64:
                    self.runLimit = iprot.readI64()
                else:
                    iprot.skip(ftype)
            elif fid == 7:
                if ftype == TType.BOOL:
                    self.isReviewStatusChangeDisabled = iprot.readBool()
                else:
                    iprot.skip(ftype)
            elif fid == 8:
                if ftype == TType.I32:
                    self.confidentiality = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 9:
                if ftype == TType.I64:
                    self.reportLimit = iprot.readI64()
                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('ProductConfiguration')
        if self.id is not None:
            oprot.writeFieldBegin('id', TType.I64, 1)
            oprot.writeI64(self.id)
            oprot.writeFieldEnd()
        if self.endpoint is not None:
            oprot.writeFieldBegin('endpoint', TType.STRING, 2)
            oprot.writeString(self.endpoint.encode('utf-8') if sys.version_info[0] == 2 else self.endpoint)
            oprot.writeFieldEnd()
        if self.displayedName_b64 is not None:
            oprot.writeFieldBegin('displayedName_b64', TType.STRING, 3)
            oprot.writeString(self.displayedName_b64.encode('utf-8') if sys.version_info[0] == 2 else self.displayedName_b64)
            oprot.writeFieldEnd()
        if self.description_b64 is not None:
            oprot.writeFieldBegin('description_b64', TType.STRING, 4)
            oprot.writeString(self.description_b64.encode('utf-8') if sys.version_info[0] == 2 else self.description_b64)
            oprot.writeFieldEnd()
        if self.connection is not None:
            oprot.writeFieldBegin('connection', TType.STRUCT, 5)
            self.connection.write(oprot)
            oprot.writeFieldEnd()
        if self.runLimit is not None:
            oprot.writeFieldBegin('runLimit', TType.I64, 6)
            oprot.writeI64(self.runLimit)
            oprot.writeFieldEnd()
        if self.isReviewStatusChangeDisabled is not None:
            oprot.writeFieldBegin('isReviewStatusChangeDisabled', TType.BOOL, 7)
            oprot.writeBool(self.isReviewStatusChangeDisabled)
            oprot.writeFieldEnd()
        if self.confidentiality is not None:
            oprot.writeFieldBegin('confidentiality', TType.I32, 8)
            oprot.writeI32(self.confidentiality)
            oprot.writeFieldEnd()
        if self.reportLimit is not None:
            oprot.writeFieldBegin('reportLimit', TType.I64, 9)
            oprot.writeI64(self.reportLimit)
            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 Product(object):
    """
    Attributes:
     - id
     - endpoint
     - displayedName_b64
     - description_b64
     - connected
     - accessible
     - administrating
     - databaseStatus
     - runCount
     - latestStoreToProduct
     - runLimit
     - admins
     - runStoreInProgress
     - confidentiality
     - reportLimit
    """


    def __init__(self, id=None, endpoint=None, displayedName_b64=None, description_b64=None, connected=None, accessible=None, administrating=None, databaseStatus=None, runCount=None, latestStoreToProduct=None, runLimit=None, admins=None, runStoreInProgress=None, confidentiality=None, reportLimit=None,):
        self.id = id
        self.endpoint = endpoint
        self.displayedName_b64 = displayedName_b64
        self.description_b64 = description_b64
        self.connected = connected
        self.accessible = accessible
        self.administrating = administrating
        self.databaseStatus = databaseStatus
        self.runCount = runCount
        self.latestStoreToProduct = latestStoreToProduct
        self.runLimit = runLimit
        self.admins = admins
        self.runStoreInProgress = runStoreInProgress
        self.confidentiality = confidentiality
        self.reportLimit = reportLimit

    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.STRING:
                    self.endpoint = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRING:
                    self.displayedName_b64 = 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.description_b64 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.BOOL:
                    self.connected = iprot.readBool()
                else:
                    iprot.skip(ftype)
            elif fid == 6:
                if ftype == TType.BOOL:
                    self.accessible = iprot.readBool()
                else:
                    iprot.skip(ftype)
            elif fid == 7:
                if ftype == TType.BOOL:
                    self.administrating = iprot.readBool()
                else:
                    iprot.skip(ftype)
            elif fid == 8:
                if ftype == TType.I32:
                    self.databaseStatus = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 9:
                if ftype == TType.I64:
                    self.runCount = iprot.readI64()
                else:
                    iprot.skip(ftype)
            elif fid == 10:
                if ftype == TType.STRING:
                    self.latestStoreToProduct = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 11:
                if ftype == TType.I64:
                    self.runLimit = iprot.readI64()
                else:
                    iprot.skip(ftype)
            elif fid == 12:
                if ftype == TType.LIST:
                    self.admins = []
                    (_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.admins.append(_elem5)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 13:
                if ftype == TType.LIST:
                    self.runStoreInProgress = []
                    (_etype9, _size6) = iprot.readListBegin()
                    for _i10 in range(_size6):
                        _elem11 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.runStoreInProgress.append(_elem11)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 14:
                if ftype == TType.I32:
                    self.confidentiality = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 15:
                if ftype == TType.I64:
                    self.reportLimit = iprot.readI64()
                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('Product')
        if self.id is not None:
            oprot.writeFieldBegin('id', TType.I64, 1)
            oprot.writeI64(self.id)
            oprot.writeFieldEnd()
        if self.endpoint is not None:
            oprot.writeFieldBegin('endpoint', TType.STRING, 2)
            oprot.writeString(self.endpoint.encode('utf-8') if sys.version_info[0] == 2 else self.endpoint)
            oprot.writeFieldEnd()
        if self.displayedName_b64 is not None:
            oprot.writeFieldBegin('displayedName_b64', TType.STRING, 3)
            oprot.writeString(self.displayedName_b64.encode('utf-8') if sys.version_info[0] == 2 else self.displayedName_b64)
            oprot.writeFieldEnd()
        if self.description_b64 is not None:
            oprot.writeFieldBegin('description_b64', TType.STRING, 4)
            oprot.writeString(self.description_b64.encode('utf-8') if sys.version_info[0] == 2 else self.description_b64)
            oprot.writeFieldEnd()
        if self.connected is not None:
            oprot.writeFieldBegin('connected', TType.BOOL, 5)
            oprot.writeBool(self.connected)
            oprot.writeFieldEnd()
        if self.accessible is not None:
            oprot.writeFieldBegin('accessible', TType.BOOL, 6)
            oprot.writeBool(self.accessible)
            oprot.writeFieldEnd()
        if self.administrating is not None:
            oprot.writeFieldBegin('administrating', TType.BOOL, 7)
            oprot.writeBool(self.administrating)
            oprot.writeFieldEnd()
        if self.databaseStatus is not None:
            oprot.writeFieldBegin('databaseStatus', TType.I32, 8)
            oprot.writeI32(self.databaseStatus)
            oprot.writeFieldEnd()
        if self.runCount is not None:
            oprot.writeFieldBegin('runCount', TType.I64, 9)
            oprot.writeI64(self.runCount)
            oprot.writeFieldEnd()
        if self.latestStoreToProduct is not None:
            oprot.writeFieldBegin('latestStoreToProduct', TType.STRING, 10)
            oprot.writeString(self.latestStoreToProduct.encode('utf-8') if sys.version_info[0] == 2 else self.latestStoreToProduct)
            oprot.writeFieldEnd()
        if self.runLimit is not None:
            oprot.writeFieldBegin('runLimit', TType.I64, 11)
            oprot.writeI64(self.runLimit)
            oprot.writeFieldEnd()
        if self.admins is not None:
            oprot.writeFieldBegin('admins', TType.LIST, 12)
            oprot.writeListBegin(TType.STRING, len(self.admins))
            for iter12 in self.admins:
                oprot.writeString(iter12.encode('utf-8') if sys.version_info[0] == 2 else iter12)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.runStoreInProgress is not None:
            oprot.writeFieldBegin('runStoreInProgress', TType.LIST, 13)
            oprot.writeListBegin(TType.STRING, len(self.runStoreInProgress))
            for iter13 in self.runStoreInProgress:
                oprot.writeString(iter13.encode('utf-8') if sys.version_info[0] == 2 else iter13)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.confidentiality is not None:
            oprot.writeFieldBegin('confidentiality', TType.I32, 14)
            oprot.writeI32(self.confidentiality)
            oprot.writeFieldEnd()
        if self.reportLimit is not None:
            oprot.writeFieldBegin('reportLimit', TType.I64, 15)
            oprot.writeI64(self.reportLimit)
            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(DatabaseConnection)
DatabaseConnection.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'engine', 'UTF8', None, ),  # 1
    (2, TType.STRING, 'host', 'UTF8', None, ),  # 2
    (3, TType.I32, 'port', None, None, ),  # 3
    (4, TType.STRING, 'username_b64', 'UTF8', None, ),  # 4
    (5, TType.STRING, 'password_b64', 'UTF8', None, ),  # 5
    (6, TType.STRING, 'database', 'UTF8', None, ),  # 6
)
all_structs.append(ProductConfiguration)
ProductConfiguration.thrift_spec = (
    None,  # 0
    (1, TType.I64, 'id', None, None, ),  # 1
    (2, TType.STRING, 'endpoint', 'UTF8', None, ),  # 2
    (3, TType.STRING, 'displayedName_b64', 'UTF8', None, ),  # 3
    (4, TType.STRING, 'description_b64', 'UTF8', None, ),  # 4
    (5, TType.STRUCT, 'connection', [DatabaseConnection, None], None, ),  # 5
    (6, TType.I64, 'runLimit', None, None, ),  # 6
    (7, TType.BOOL, 'isReviewStatusChangeDisabled', None, None, ),  # 7
    (8, TType.I32, 'confidentiality', None, None, ),  # 8
    (9, TType.I64, 'reportLimit', None, None, ),  # 9
)
all_structs.append(Product)
Product.thrift_spec = (
    None,  # 0
    (1, TType.I64, 'id', None, None, ),  # 1
    (2, TType.STRING, 'endpoint', 'UTF8', None, ),  # 2
    (3, TType.STRING, 'displayedName_b64', 'UTF8', None, ),  # 3
    (4, TType.STRING, 'description_b64', 'UTF8', None, ),  # 4
    (5, TType.BOOL, 'connected', None, None, ),  # 5
    (6, TType.BOOL, 'accessible', None, None, ),  # 6
    (7, TType.BOOL, 'administrating', None, None, ),  # 7
    (8, TType.I32, 'databaseStatus', None, None, ),  # 8
    (9, TType.I64, 'runCount', None, None, ),  # 9
    (10, TType.STRING, 'latestStoreToProduct', 'UTF8', None, ),  # 10
    (11, TType.I64, 'runLimit', None, None, ),  # 11
    (12, TType.LIST, 'admins', (TType.STRING, 'UTF8', False), None, ),  # 12
    (13, TType.LIST, 'runStoreInProgress', (TType.STRING, 'UTF8', False), None, ),  # 13
    (14, TType.I32, 'confidentiality', None, None, ),  # 14
    (15, TType.I64, 'reportLimit', None, None, ),  # 15
)
fix_spec(all_structs)
del all_structs
