/*
 * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
 * agreements. See the NOTICE file distributed with this work for additional information regarding
 * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance with the License. You may obtain a
 * copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */

/*
* These ProtoBuf files are part of an experimental interface.
* Use this interface at your own risk.
*/


syntax = "proto3";
package org.apache.geode.internal.protocol.protobuf.v1;

import "google/protobuf/struct.proto";

message Entry {
    EncodedValue key = 1;
    EncodedValue value = 2;
}

message EncodedValueList {
  repeated EncodedValue element = 1;
}

//Represents a table, such as the results of
//an OQL query. The field names and all rows
//should have the same number of elements.
message Table {
    repeated string fieldName = 1;
    repeated EncodedValueList row = 2;
}

message EncodedValue {
    oneof value{
        int32 intResult = 1;
        int64 longResult = 2;
        int32 shortResult = 3;
        int32 byteResult = 4;
        bool booleanResult = 5;
        double doubleResult = 6;
        float floatResult = 7;
        bytes binaryResult = 8;
        string stringResult = 9;
        string jsonObjectResult = 10;
        google.protobuf.NullValue nullResult = 11;
        // Result serialized using a custom serialization format. This can only be used if
        // A HandshakeRequest is sent with valueFormat set to a valid format.
        //
         // See HandshakeRequest.valueFormat.
        bytes customObjectResult = 12;
    }
}

message Server {
    string hostname = 1;
    int32 port = 2;
}

message Error {
    ErrorCode errorCode = 1;
    string message = 2;
}

message KeyedError {
    EncodedValue key = 1;
    Error error = 2;
}

enum ErrorCode {
    INVALID_ERROR_CODE = 0;
    AUTHENTICATION_REQUIRED = 10;
    AUTHENTICATION_FAILED = 11;
    ALREADY_AUTHENTICATED = 12;
    AUTHENTICATION_NOT_SUPPORTED = 13;
    AUTHORIZATION_FAILED = 20;
    INVALID_REQUEST = 50;
    UNSUPPORTED_OPERATION = 60;
    SERVER_ERROR = 100;
    NO_AVAILABLE_SERVER = 101;
}
