# automatically generated by the FlatBuffers compiler, do not modify

# namespace: generated

class Result(object):
    NONE = 0
    Packets_HelloResult = 1
    Packets_QueryScreenResult = 2
    Packets_FindObjectsResult = 3
    Packets_QueryObjectInteractableResult = 4
    Packets_ActionsResult = 5
    Packets_ExecuteRpcResult = 6
    Packets_InspectObjectOnScreenResult = 7
    Packets_InspectObjectWithIdResult = 8
    Packets_DumpObjectsHierarchyResult = 9
    Packets_ChangeConfigurationResult = 10
    Packets_QueryProfileResult = 11

def ResultCreator(unionType, table):
    from flatbuffers.table import Table
    if not isinstance(table, Table):
        return None
    if unionType == Result().Packets_HelloResult:
        import gamium.protocol.generated.Packets.HelloResult
        return gamium.protocol.generated.Packets.HelloResult.HelloResultT.InitFromBuf(table.Bytes, table.Pos)
    if unionType == Result().Packets_QueryScreenResult:
        import gamium.protocol.generated.Packets.QueryScreenResult
        return gamium.protocol.generated.Packets.QueryScreenResult.QueryScreenResultT.InitFromBuf(table.Bytes, table.Pos)
    if unionType == Result().Packets_FindObjectsResult:
        import gamium.protocol.generated.Packets.FindObjectsResult
        return gamium.protocol.generated.Packets.FindObjectsResult.FindObjectsResultT.InitFromBuf(table.Bytes, table.Pos)
    if unionType == Result().Packets_QueryObjectInteractableResult:
        import gamium.protocol.generated.Packets.QueryObjectInteractableResult
        return gamium.protocol.generated.Packets.QueryObjectInteractableResult.QueryObjectInteractableResultT.InitFromBuf(table.Bytes, table.Pos)
    if unionType == Result().Packets_ActionsResult:
        import gamium.protocol.generated.Packets.ActionsResult
        return gamium.protocol.generated.Packets.ActionsResult.ActionsResultT.InitFromBuf(table.Bytes, table.Pos)
    if unionType == Result().Packets_ExecuteRpcResult:
        import gamium.protocol.generated.Packets.ExecuteRpcResult
        return gamium.protocol.generated.Packets.ExecuteRpcResult.ExecuteRpcResultT.InitFromBuf(table.Bytes, table.Pos)
    if unionType == Result().Packets_InspectObjectOnScreenResult:
        import gamium.protocol.generated.Packets.InspectObjectOnScreenResult
        return gamium.protocol.generated.Packets.InspectObjectOnScreenResult.InspectObjectOnScreenResultT.InitFromBuf(table.Bytes, table.Pos)
    if unionType == Result().Packets_InspectObjectWithIdResult:
        import gamium.protocol.generated.Packets.InspectObjectWithIdResult
        return gamium.protocol.generated.Packets.InspectObjectWithIdResult.InspectObjectWithIdResultT.InitFromBuf(table.Bytes, table.Pos)
    if unionType == Result().Packets_DumpObjectsHierarchyResult:
        import gamium.protocol.generated.Packets.DumpObjectsHierarchyResult
        return gamium.protocol.generated.Packets.DumpObjectsHierarchyResult.DumpObjectsHierarchyResultT.InitFromBuf(table.Bytes, table.Pos)
    if unionType == Result().Packets_ChangeConfigurationResult:
        import gamium.protocol.generated.Packets.ChangeConfigurationResult
        return gamium.protocol.generated.Packets.ChangeConfigurationResult.ChangeConfigurationResultT.InitFromBuf(table.Bytes, table.Pos)
    if unionType == Result().Packets_QueryProfileResult:
        import gamium.protocol.generated.Packets.QueryProfileResult
        return gamium.protocol.generated.Packets.QueryProfileResult.QueryProfileResultT.InitFromBuf(table.Bytes, table.Pos)
    return None
